Merge branch 'features/feature-facture-type' into staging
This commit is contained in:
commit
5aaf38c05e
@ -172,5 +172,6 @@ return [
|
||||
|
||||
//group of devis and facture
|
||||
['name' => 'page#exportGroupOfDevisIntoFacture','url' => '/devis/exportGroupOfDevisIntoFacture', 'verb' => 'POST'],
|
||||
['name' => 'page#getClientTemplateTypes','url' => '/client/getClientTemplateTypes', 'verb' => 'PROPFIND'],
|
||||
]
|
||||
];
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
10
gestion/lib/Constants/ClientTemplateTypeConstant.php
Normal file
10
gestion/lib/Constants/ClientTemplateTypeConstant.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OCA\Gestion\Constants;
|
||||
abstract class ClientTemplateTypeConstant
|
||||
{
|
||||
const PRIVEES = "PRIVEES";
|
||||
const FUNECAP = "FUNECAP";
|
||||
const OGF = "OGF";
|
||||
}
|
||||
@ -2948,4 +2948,13 @@ class PageController extends Controller {
|
||||
return json_encode([]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @NoCSRFRequired
|
||||
*
|
||||
*/
|
||||
public function getClientTemplateTypes(){
|
||||
return $this->myDb->getClientTemplateTypes();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace OCA\Gestion\Db;
|
||||
|
||||
use OCA\Gestion\Constants\ClientTemplateTypeConstant;
|
||||
use OCA\Gestion\Constants\FactureStatusConstant;
|
||||
use OCA\Gestion\Constants\FactureTypeConstant;
|
||||
use OCA\Gestion\Helpers\DateHelpers;
|
||||
@ -50,7 +51,7 @@ class Bdd {
|
||||
"product_brand","product_reference",
|
||||
"fk_user_uuid",
|
||||
"phone_number","address",'postal_code','city','email','siret_number','tva_intracommu',
|
||||
'order_number','case_number');
|
||||
'order_number','case_number','fk_template_type_key');
|
||||
$this->whiteTable = array(
|
||||
"client", "lieu", "trajet", "devis", "produit_devis", "facture", "produit", "configuration", "ligne_trajet", "thanato", "article", "defunt", "article_devis", "bibliotheque", "bijou_defunt", "obs_defunt", "hypo_defunt",
|
||||
"client_group_discount","client_group",
|
||||
@ -2818,6 +2819,7 @@ class Bdd {
|
||||
$totalTva = 0;
|
||||
$caseNumber = "";
|
||||
$orderNumber = "";
|
||||
$templateType = ClientTemplateTypeConstant::PRIVEES;
|
||||
foreach($factureDevisList as &$devis){
|
||||
if($factureIncrement == 0){
|
||||
if($isFactureForSingleClient){
|
||||
@ -2834,6 +2836,7 @@ class Bdd {
|
||||
$factureData["client_mail"] = $devis["group_email"];
|
||||
$factureData["siret"] = $devis["group_siret_number"];
|
||||
$factureData["group_name"] = $devis["group_name"] ?? "";
|
||||
$templateType = $devis['fk_template_type_key'] ?? ClientTemplateTypeConstant::PRIVEES;
|
||||
}
|
||||
}
|
||||
$caseNumber = empty($devis["case_number"]) ? $caseNumber : $devis["case_number"];
|
||||
@ -2865,6 +2868,7 @@ class Bdd {
|
||||
$factureData["totalPrices"] = $totaPricesArray;
|
||||
$factureData["case_number"] = $caseNumber;
|
||||
$factureData["order_number"] = $orderNumber;
|
||||
$factureData["template_type_key"] = $templateType;
|
||||
return $factureData;
|
||||
}
|
||||
|
||||
@ -4288,7 +4292,8 @@ class Bdd {
|
||||
client_group_facturation.city as group_city,
|
||||
client_group_facturation.email as group_email,
|
||||
client_group_facturation.siret_number as group_siret_number,
|
||||
client_group_facturation.tva_intracommu as group_tva_intracommu
|
||||
client_group_facturation.tva_intracommu as group_tva_intracommu,
|
||||
client_group_facturation.fk_template_type_key as fk_template_type_key
|
||||
FROM ".$this->tableprefix."devis as devis
|
||||
LEFT JOIN ".$this->tableprefix."client as client on devis.id_client = client.id
|
||||
LEFT JOIN ".$this->tableprefix."defunt as defunt on devis.id_defunt = defunt.id
|
||||
@ -4337,7 +4342,8 @@ class Bdd {
|
||||
client_group_facturation.city as group_city,
|
||||
client_group_facturation.email as group_email,
|
||||
client_group_facturation.siret_number as group_siret_number,
|
||||
client_group_facturation.tva_intracommu as group_tva_intracommu
|
||||
client_group_facturation.tva_intracommu as group_tva_intracommu,
|
||||
client_group_facturation.fk_template_type_key as fk_template_type_key
|
||||
FROM ".$this->tableprefix."devis as devis
|
||||
LEFT JOIN ".$this->tableprefix."client as client on devis.id_client = client.id
|
||||
LEFT JOIN ".$this->tableprefix."defunt as defunt on devis.id_defunt = defunt.id
|
||||
@ -4358,4 +4364,9 @@ class Bdd {
|
||||
|
||||
return $devisList;
|
||||
}
|
||||
|
||||
public function getClientTemplateTypes(){
|
||||
$sql = "SELECT * FROM ".$this->tableprefix."client_template_type as client_template_type";
|
||||
return $this->execSQL($sql,[]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* Calendar App
|
||||
*
|
||||
* @copyright 2021 Anna Larch <anna.larch@gmx.net>
|
||||
*
|
||||
* @author Anna Larch <anna.larch@gmx.net>
|
||||
* @author Richard Steinmetz <richard@steinmetz.cloud>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OCA\Gestion\Service\InvoiceGroupPdfHandler;
|
||||
|
||||
use DateTime;
|
||||
use OCA\Gestion\Helpers\FileExportHelpers;
|
||||
use OCA\Gestion\Helpers\PriceHelpers;
|
||||
|
||||
class InvoiceFunecapPdfHandler extends InvoiceGroupPdfHandler {
|
||||
public int $maxArticlePerPage = 6;
|
||||
|
||||
public function DrawArticlesTableValue(){
|
||||
$this->SetFont('ComicSans','',10);
|
||||
$devisData = $this->factureData['devis'];
|
||||
$tvaValue = $this->factureData["configuration"]->tva_default;
|
||||
$totalHt = 0;
|
||||
$totalTtc = 0;
|
||||
$totalTva = 0;
|
||||
$yValue = $this->startingYOfArticlesTable + 11;
|
||||
$maxDescriptionWidth = 98;
|
||||
$currentIndexPosition = $this->currentIndexPosition;
|
||||
for($currentIndexPosition;$currentIndexPosition<($this->initialIndexPosition + $this->devisCountToGet);$currentIndexPosition++){
|
||||
$currentDevis = $devisData[$currentIndexPosition];
|
||||
$devisDate = $currentDevis['devis_date'];
|
||||
$devisDate = DateTime::createFromFormat('Y-m-d',$devisDate);
|
||||
$devisDate = $devisDate->format('d-m-Y');
|
||||
$products = $currentDevis["products"];
|
||||
$subcontractorOrderNumberText = "Numéro de sous traitance ".$currentDevis["order_number"];
|
||||
$subcontractorCaseNumberText = "Numéro de dossier ".$currentDevis["case_number"];
|
||||
$this->SetXY( 35,$yValue );
|
||||
$this->MultiAlignCell(100, 6, FileExportHelpers::FormatTextForExport($subcontractorOrderNumberText),0,'0',);
|
||||
$yValue += 6;
|
||||
|
||||
$this->SetXY( 35,$yValue );
|
||||
$this->MultiAlignCell(100, 6, FileExportHelpers::FormatTextForExport($subcontractorCaseNumberText),0,'0',);
|
||||
$yValue += 6;
|
||||
foreach($products as $product){
|
||||
$valueHt = $product['produit_price'];
|
||||
$valueTtc = PriceHelpers::calculPriceWithVatValue($valueHt,$tvaValue);
|
||||
$totalHt+=$valueHt;
|
||||
$totalTtc+=$valueTtc;
|
||||
$productDescription = $product["produit_description"] ?? "";
|
||||
$dateValue = "";
|
||||
if($product === end($products)){
|
||||
$dateValue = $devisDate;
|
||||
$productDescription .= " de " . $currentDevis["defunt_nom"] ?? "";
|
||||
}
|
||||
$productDescriptionWidth = $this->GetStringWidth($productDescription);
|
||||
$productDescriptionIsMultiline = $productDescriptionWidth > $maxDescriptionWidth;
|
||||
$tvaAmount = $valueTtc - $valueHt;
|
||||
|
||||
$this->SetXY( 8,$yValue );
|
||||
$this->Cell(20, 6, $dateValue, 0,0);
|
||||
|
||||
$this->SetXY( 35,$yValue );
|
||||
$this->MultiAlignCell(100, 6, FileExportHelpers::FormatTextForExport($productDescription),0,'0',);
|
||||
|
||||
$this->SetXY( 138,$yValue );
|
||||
$this->Cell(20, 6, number_format($valueHt,2,'.','').chr(128), 0, 0, 'C');
|
||||
|
||||
$this->SetXY( 160,$yValue );
|
||||
$this->Cell(20, 6, number_format($tvaAmount,2,'.','').chr(128), 0, 0, 'C');
|
||||
|
||||
$this->SetXY( 181,$yValue );
|
||||
$this->Cell(25, 6, number_format($valueTtc,2,'.','').chr(128), 0, 1, 'C');
|
||||
$yValue += 6;
|
||||
$totalTva += $tvaAmount;
|
||||
if($productDescriptionIsMultiline){
|
||||
$yValue += 6;
|
||||
}
|
||||
}
|
||||
$yValue += 2;
|
||||
}
|
||||
$this->currentIndexPosition = $currentIndexPosition;
|
||||
$this->initialIndexPosition = $this->currentIndexPosition;
|
||||
$chargedDevisCount = $this->currentIndexPosition + 1;
|
||||
$devisLeftToGet = $this->devisCount - $chargedDevisCount;
|
||||
$this->devisCountToGet = ($devisLeftToGet <= $this->maxArticlePerPage) ? $devisLeftToGet + 1 : $this->maxArticlePerPage;
|
||||
}
|
||||
|
||||
}
|
||||
@ -32,25 +32,25 @@ use OCA\Gestion\Helpers\FileExportHelpers;
|
||||
use OCA\Gestion\Helpers\PriceHelpers;
|
||||
|
||||
class InvoiceGroupPdfHandler extends FPDF {
|
||||
private $factureData = [];
|
||||
private $logo = null;
|
||||
public $factureData = [];
|
||||
public $logo = null;
|
||||
|
||||
private $productsCount = 0;
|
||||
public $productsCount = 0;
|
||||
|
||||
private $totalPrices = [];
|
||||
private $devisCount = 0;
|
||||
private $logoPath = "/var/www/html/data/admin/files/.gestion/";
|
||||
public $totalPrices = [];
|
||||
public $devisCount = 0;
|
||||
public $logoPath = "/var/www/html/data/admin/files/.gestion/";
|
||||
|
||||
private $currentIndexPosition = 0;
|
||||
private $initialIndexPosition = 0;
|
||||
public $currentIndexPosition = 0;
|
||||
public $initialIndexPosition = 0;
|
||||
|
||||
private $devisCountToGet = 0;
|
||||
private $devisList = [];
|
||||
public $devisCountToGet = 0;
|
||||
public $devisList = [];
|
||||
|
||||
private $thereIsOrderOrCaseNumber = false;
|
||||
private $startingYOfArticlesTable = 95;
|
||||
private const MAX_ARTICLES_PER_PAGE = 19;
|
||||
private $additionalArticlesLineBasedOnMultiline = 0;
|
||||
public $thereIsOrderOrCaseNumber = false;
|
||||
public $startingYOfArticlesTable = 95;
|
||||
public int $maxArticlePerPage = 19;
|
||||
public $additionalArticlesLineBasedOnMultiline = 0;
|
||||
function Header()
|
||||
{
|
||||
if($this->logo != "nothing"){
|
||||
@ -66,7 +66,7 @@ class InvoiceGroupPdfHandler extends FPDF {
|
||||
function Footer()
|
||||
{
|
||||
$this->SetY(-35);
|
||||
$this->SetFont('ComicSans', '', 7);
|
||||
$this->SetFont('ComicSans', '', size: 7);
|
||||
$this->MultiCell(0,5,utf8_decode(html_entity_decode('Tout retard de paiement entraînera de plein droit une pénalité de retard de 3 fois le taux légal ( Loi 2008-776 du 4 août 2008) et une indemnité forfaitaire de 40 EUR pour frais de recouvrement sera appliquée.')));
|
||||
$this->Ln(1);
|
||||
$this->MultiCell(0,5,utf8_decode(html_entity_decode('Si les frais de recouvrement sont supérieurs à ce montant forfaitaire, une indemnisation complémentaire sera due sur présentation de justificatifs ( articles L.441-3 et L.441-6 du code de commerce ).
|
||||
@ -82,7 +82,7 @@ class InvoiceGroupPdfHandler extends FPDF {
|
||||
$this->productsCount = $this->factureData["productsCount"];
|
||||
$this->devisCount = count($this->factureData['devis']);
|
||||
$this->totalPrices = $this->factureData["totalPrices"];
|
||||
$this->devisCountToGet = ($this->devisCount <= self::MAX_ARTICLES_PER_PAGE ) ? $this->devisCount : self::MAX_ARTICLES_PER_PAGE;
|
||||
$this->devisCountToGet = ($this->devisCount <= $this->maxArticlePerPage ) ? $this->devisCount : $this->maxArticlePerPage;
|
||||
$this->devisList = $this->factureData['devis'];
|
||||
$this->logo = $logo;
|
||||
}
|
||||
@ -94,13 +94,13 @@ class InvoiceGroupPdfHandler extends FPDF {
|
||||
return $this->factureData['configuration']->facture_prefixe.'_'.$factureNum.'_'.mb_strtoupper($clientName,'UTF-8');
|
||||
}
|
||||
|
||||
private function DrawPageNumbersText($pageNumber,$pageCount){
|
||||
public function DrawPageNumbersText($pageNumber,$pageCount){
|
||||
$this->SetXY( 120, 5 );
|
||||
$this->Cell( 160, 8, $pageNumber . '/' . $pageCount, 0, 0, 'C');
|
||||
}
|
||||
|
||||
private function DrawArticlesTable(){
|
||||
$pageCount = ceil($this->devisCount / self::MAX_ARTICLES_PER_PAGE);
|
||||
public function DrawArticlesTable(){
|
||||
$pageCount = ceil($this->devisCount / $this->maxArticlePerPage);
|
||||
$pageNumber = 1;
|
||||
while($pageNumber <= $pageCount){
|
||||
if($pageNumber > 1){
|
||||
@ -114,7 +114,7 @@ class InvoiceGroupPdfHandler extends FPDF {
|
||||
}
|
||||
}
|
||||
|
||||
private function DrawInvoiceCompanyInfo(){
|
||||
public function DrawInvoiceCompanyInfo(){
|
||||
$this->SetY(40);
|
||||
$this->SetFont('ComicSans', '', 10);
|
||||
$this->Cell(0, 5, FileExportHelpers::FormatTextForExport($this->factureData['configuration']->entreprise), 0, 1);
|
||||
@ -123,7 +123,7 @@ class InvoiceGroupPdfHandler extends FPDF {
|
||||
$this->Cell(0, 5, FileExportHelpers::FormatTextForExport('Tél : ') . FileExportHelpers::FormatTextForExport($this->factureData['configuration']->telephone),0,1);
|
||||
$this->Cell(0, 5, 'Mail : ' . $this->factureData['configuration']->mail, 0, 1);
|
||||
}
|
||||
private function DrawInvoiceClientInfo(){
|
||||
public function DrawInvoiceClientInfo(){
|
||||
$this->SetFont('ComicSans', '', 10);
|
||||
$clientName = $this->factureData['group_name'];
|
||||
$clientInfoXAxis = 125;
|
||||
@ -146,20 +146,14 @@ class InvoiceGroupPdfHandler extends FPDF {
|
||||
$clientInfoYAxis += 5;
|
||||
$this->SetXY($clientInfoXAxis,$clientInfoYAxis);
|
||||
$this->Cell(0, 5, trim(FileExportHelpers::FormatTextForExport($this->factureData['client_adress_city'])));
|
||||
$clientInfoYAxis += 5;
|
||||
$this->SetXY($clientInfoXAxis,$clientInfoYAxis);
|
||||
$this->Cell(0, 5, FileExportHelpers::FormatTextForExport('Numéro') . ' Siret: ' . $this->factureData['siret']);
|
||||
$clientInfoYAxis += 5;
|
||||
$this->SetXY($clientInfoXAxis,$clientInfoYAxis);
|
||||
$this->Cell(0, 5, FileExportHelpers::FormatTextForExport('Mail : ') . $this->factureData['client_mail']);
|
||||
}
|
||||
|
||||
private function DrawInvoiceCompanyAndClientInfo(){
|
||||
public function DrawInvoiceCompanyAndClientInfo(){
|
||||
$this->DrawInvoiceCompanyInfo();
|
||||
$this->DrawInvoiceClientInfo();
|
||||
}
|
||||
|
||||
private function DrawInvoiceInfoTable(){
|
||||
public function DrawInvoiceInfoTable(){
|
||||
$this->setY(67);
|
||||
$factureDatePaiement = $this->factureData['date_paiement'];
|
||||
$factureDatePaiement = DateTime::createFromFormat('Y-m-d',$factureDatePaiement);
|
||||
@ -169,22 +163,20 @@ class InvoiceGroupPdfHandler extends FPDF {
|
||||
$factureDateEcheance = $factureDateEcheance->format('d-m-Y');
|
||||
$this->SetFont('ComicSans', 'B', 11);
|
||||
$this->Cell(30, 7, 'DATE', 1, 0, 'C');
|
||||
$this->Cell(60, 7, 'CLIENT', 1, 0, 'C');
|
||||
$this->Cell(94, 7, 'CLIENT', 1, 0, 'C');
|
||||
$this->Cell(40, 7, 'FACTURE', 1, 0, 'C');
|
||||
$this->Cell(40, 7, 'ECHEANCE', 1, 0, 'C');
|
||||
$this->Cell(34, 7, 'COMMANDE', 1, 1, 'C');
|
||||
$this->Cell(40, 7, 'ECHEANCE', 1, 1, 'C');
|
||||
|
||||
$this->SetFont('ComicSans', '', 10);
|
||||
$this->Cell(30, 7, $factureDatePaiement, 1, 0, 'C');
|
||||
$this->Cell(60, 7, utf8_decode(html_entity_decode($this->factureData['group_name'])), 1, 0, 'C');
|
||||
$this->Cell(94, 7, utf8_decode(html_entity_decode($this->factureData['group_name'])), 1, 0, 'C');
|
||||
$this->Cell(40, 7, $this->factureData['num'], 1, 0, 'C');
|
||||
$this->Cell(40, 7, $factureDateEcheance, 1, 0, 'C');
|
||||
$this->Cell(34, 7, $this->factureData["order_number"], 1, 1, 'C');
|
||||
$this->Cell(40, 7, $factureDateEcheance, 1, 1, 'C');
|
||||
|
||||
$this->startingYOfArticlesTable = 85;
|
||||
}
|
||||
|
||||
private function DrawArticlesTableRect(){
|
||||
public function DrawArticlesTableRect(){
|
||||
$this->SetLineWidth(0.2);
|
||||
$gapBetweenStartingOfArticlesTableAndColumnName = 10;
|
||||
$tableHeight = $this->thereIsOrderOrCaseNumber ? 137 : 137 + 10;
|
||||
@ -198,7 +190,7 @@ class InvoiceGroupPdfHandler extends FPDF {
|
||||
$this->Line(180, $this->startingYOfArticlesTable, 180, 232);
|
||||
}
|
||||
|
||||
private function DrawArticlesTableHeader(){
|
||||
public function DrawArticlesTableHeader(){
|
||||
$tvaValue = $this->factureData["configuration"]->tva_default;
|
||||
$columnNameY = $this->startingYOfArticlesTable + 1;
|
||||
$this->SetFont('ComicSans','',10);
|
||||
@ -227,7 +219,7 @@ class InvoiceGroupPdfHandler extends FPDF {
|
||||
$totalTtc = 0;
|
||||
$totalTva = 0;
|
||||
$yValue = $this->startingYOfArticlesTable + 11;
|
||||
$maxDescriptionWidth = 98;
|
||||
$maxDescriptionWidth = 104;
|
||||
$currentIndexPosition = $this->currentIndexPosition;
|
||||
for($currentIndexPosition;$currentIndexPosition<($this->initialIndexPosition + $this->devisCountToGet);$currentIndexPosition++){
|
||||
$currentDevis = $devisData[$currentIndexPosition];
|
||||
@ -247,13 +239,21 @@ class InvoiceGroupPdfHandler extends FPDF {
|
||||
$productDescription .= " de " . $currentDevis["defunt_nom"] ?? "";
|
||||
}
|
||||
$productDescriptionWidth = $this->GetStringWidth($productDescription);
|
||||
if($currentDevis["defunt_nom"] == "LANGLEMENT Catherine"){
|
||||
var_dump($productDescriptionWidth);
|
||||
}
|
||||
$productDescriptionIsMultiline = $productDescriptionWidth > $maxDescriptionWidth;
|
||||
$tvaAmount = $valueTtc - $valueHt;
|
||||
$this->SetXY( 8,$yValue );
|
||||
$this->Cell(20, 6, $dateValue, 0,0);
|
||||
|
||||
$this->SetXY( 35,$yValue );
|
||||
$this->MultiAlignCell(100, 6, FileExportHelpers::FormatTextForExport($productDescription),0,'0',);
|
||||
if($productDescriptionIsMultiline){
|
||||
$this->MultiAlignCell(100, 6, FileExportHelpers::FormatTextForExport($productDescription),0,'0',);
|
||||
}
|
||||
else{
|
||||
$this->Cell(100,6,FileExportHelpers::FormatTextForExport($productDescription),0,0);
|
||||
}
|
||||
|
||||
$this->SetXY( 138,$yValue );
|
||||
$this->Cell(20, 6, number_format($valueHt,2,'.','').chr(128), 0, 0, 'C');
|
||||
@ -271,13 +271,13 @@ class InvoiceGroupPdfHandler extends FPDF {
|
||||
}
|
||||
}
|
||||
$this->currentIndexPosition = $currentIndexPosition;
|
||||
$this->initialIndexPosition += $this->currentIndexPosition;
|
||||
$this->initialIndexPosition = $this->currentIndexPosition;
|
||||
$chargedDevisCount = $this->currentIndexPosition + 1;
|
||||
$devisLeftToGet = $this->devisCount - $chargedDevisCount;
|
||||
$this->devisCountToGet = ($devisLeftToGet <= self::MAX_ARTICLES_PER_PAGE) ? $devisLeftToGet + 1 : self::MAX_ARTICLES_PER_PAGE;
|
||||
$this->devisCountToGet = ($devisLeftToGet <= $this->maxArticlePerPage) ? $devisLeftToGet + 1 : $this->maxArticlePerPage;
|
||||
}
|
||||
|
||||
private function DrawBankAndTotalPriceInfo(){
|
||||
public function DrawBankAndTotalPriceInfo(){
|
||||
$this->SetY(235);
|
||||
$this->SetFont('ComicSans', '', 7);
|
||||
$this->MultiCell(0,5,utf8_decode(html_entity_decode("Paiement à votre convenance par chèque à l'ordre de ". $this->factureData['configuration']->entreprise)));
|
||||
|
||||
@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* Calendar App
|
||||
*
|
||||
* @copyright 2021 Anna Larch <anna.larch@gmx.net>
|
||||
*
|
||||
* @author Anna Larch <anna.larch@gmx.net>
|
||||
* @author Richard Steinmetz <richard@steinmetz.cloud>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OCA\Gestion\Service\InvoiceGroupPdfHandler;
|
||||
|
||||
use DateTime;
|
||||
use OCA\Gestion\Helpers\FileExportHelpers;
|
||||
use OCA\Gestion\Helpers\PriceHelpers;
|
||||
|
||||
class InvoiceOgfPdfHandler extends InvoiceGroupPdfHandler {
|
||||
|
||||
public function DrawInvoiceClientInfo(){
|
||||
$this->SetFont('ComicSans', '', 10);
|
||||
$clientName = $this->factureData['group_name'];
|
||||
$clientInfoXAxis = 125;
|
||||
|
||||
$clientAddress = $this->factureData['client_real_adress'];
|
||||
$clientAdressWidth = $this->GetStringWidth($clientAddress);
|
||||
$maxWidth = $this->GetPageWidth();
|
||||
$availableWidhtForClientInfo = $maxWidth - 10 - $clientInfoXAxis;
|
||||
$clientAdressIsMultiline = $clientAdressWidth > $availableWidhtForClientInfo;
|
||||
|
||||
$clientInfoYAxis = $clientAdressIsMultiline ? 35 : 40;
|
||||
$this->SetXY($clientInfoXAxis,$clientInfoYAxis);
|
||||
$this->Cell(0, 5, FileExportHelpers::FormatTextForExport($clientName));
|
||||
$clientInfoYAxis += 5;
|
||||
$this->SetXY($clientInfoXAxis,$clientInfoYAxis);
|
||||
$this->MultiCell( 0, 5, trim(FileExportHelpers::FormatTextForExport($clientAddress)));
|
||||
if($clientAdressIsMultiline){
|
||||
$clientInfoYAxis += 5;
|
||||
}
|
||||
$clientInfoYAxis += 5;
|
||||
$this->SetXY($clientInfoXAxis,$clientInfoYAxis);
|
||||
$this->Cell(0, 5, trim(FileExportHelpers::FormatTextForExport($this->factureData['client_adress_city'])));
|
||||
$clientInfoYAxis += 5;
|
||||
$this->SetXY($clientInfoXAxis,$clientInfoYAxis);
|
||||
$this->Cell(0, 5, FileExportHelpers::FormatTextForExport('Numéro') . ' Siret: ' . $this->factureData['siret']);
|
||||
$clientInfoYAxis += 5;
|
||||
$this->SetXY($clientInfoXAxis,$clientInfoYAxis);
|
||||
$this->Cell(0, 5, FileExportHelpers::FormatTextForExport('Mail : ') . $this->factureData['client_mail']);
|
||||
}
|
||||
|
||||
public function DrawInvoiceInfoTable(){
|
||||
$this->setY(67);
|
||||
$factureDatePaiement = $this->factureData['date_paiement'];
|
||||
$factureDatePaiement = DateTime::createFromFormat('Y-m-d',$factureDatePaiement);
|
||||
$factureDateEcheance = $factureDatePaiement;
|
||||
$factureDatePaiement = $factureDatePaiement->format('d-m-Y');
|
||||
$factureDateEcheance->modify('last day of next month');
|
||||
$factureDateEcheance = $factureDateEcheance->format('d-m-Y');
|
||||
$this->SetFont('ComicSans', 'B', 11);
|
||||
$this->Cell(30, 7, 'DATE', 1, 0, 'C');
|
||||
$this->Cell(60, 7, 'CLIENT', 1, 0, 'C');
|
||||
$this->Cell(40, 7, 'FACTURE', 1, 0, 'C');
|
||||
$this->Cell(40, 7, 'ECHEANCE', 1, 0, 'C');
|
||||
$this->Cell(34, 7, 'COMMANDE', 1, 1, 'C');
|
||||
|
||||
$this->SetFont('ComicSans', '', 10);
|
||||
$this->Cell(30, 7, $factureDatePaiement, 1, 0, 'C');
|
||||
$this->Cell(60, 7, utf8_decode(html_entity_decode($this->factureData['group_name'])), 1, 0, 'C');
|
||||
$this->Cell(40, 7, $this->factureData['num'], 1, 0, 'C');
|
||||
$this->Cell(40, 7, $factureDateEcheance, 1, 0, 'C');
|
||||
$this->Cell(34, 7, $this->factureData["order_number"], 1, 1, 'C');
|
||||
|
||||
$this->startingYOfArticlesTable = 85;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -28,11 +28,14 @@ namespace OCA\Gestion\Service;
|
||||
|
||||
use DateTime;
|
||||
use OCA\Gestion\Constants\BddConstant;
|
||||
use OCA\Gestion\Constants\ClientTemplateTypeConstant;
|
||||
use OCA\Gestion\Constants\FactureTypeConstant;
|
||||
use OCA\Gestion\Constants\MultipleFactureTypeConstant;
|
||||
use OCA\Gestion\Db\Bdd;
|
||||
use OCA\Gestion\Helpers\DateHelpers;
|
||||
use OCA\Gestion\Service\InvoiceGroupPdfHandler\InvoiceFunecapPdfHandler;
|
||||
use OCA\Gestion\Service\InvoiceGroupPdfHandler\InvoiceGroupPdfHandler;
|
||||
use OCA\Gestion\Service\InvoiceGroupPdfHandler\InvoiceOgfPdfHandler;
|
||||
use OCA\Gestion\Service\InvoiceRecap\InvoiceRecapService;
|
||||
use OCP\DB\Exception;
|
||||
use OCP\Files\IRootFolder;
|
||||
@ -156,9 +159,22 @@ class InvoicePdfService {
|
||||
if($invoicePdfData == null){
|
||||
return "";
|
||||
}
|
||||
$templateType = $invoicePdfData['template_type_key'];
|
||||
$clean_folder = html_entity_decode(string: $currentConfig->path).'/';
|
||||
$factureFolders = $this->getGroupFactureFolder($invoicePdfData,$clean_folder);
|
||||
$pdf = new InvoiceGroupPdfHandler();
|
||||
switch ($templateType) {
|
||||
case ClientTemplateTypeConstant::FUNECAP:
|
||||
$pdf = new InvoiceFunecapPdfHandler();
|
||||
break;
|
||||
|
||||
case ClientTemplateTypeConstant::OGF:
|
||||
$pdf = new InvoiceOgfPdfHandler();
|
||||
break;
|
||||
|
||||
default:
|
||||
$pdf = new InvoiceGroupPdfHandler();
|
||||
break;
|
||||
}
|
||||
$pdf->AddFont('ComicSans','','Comic Sans MS.php');
|
||||
$pdf->AddFont('ComicSans','B','comic-sans-bold.php');
|
||||
$pdf->InvoicePdfFactory($invoicePdfData,$logo);
|
||||
|
||||
@ -60,6 +60,9 @@ document.body.addEventListener('click', e => {
|
||||
else if(e.target.className.includes("selectClientGroupList")){
|
||||
ClientGroup.loadClientGroupListToSelect(e);
|
||||
}
|
||||
else if(e.target.className.includes("selectClientTemplateTypes")){
|
||||
ClientGroupFacturation.loadClientTemplateTypesIntoSelect(e);
|
||||
}
|
||||
else if(e.target.className.includes("selectClientGroupFacturationList")){
|
||||
ClientGroupFacturation.loadClientGroupFacturationListToSelect(e);
|
||||
}
|
||||
|
||||
@ -1,23 +1,52 @@
|
||||
import { showError } from "@nextcloud/dialogs";
|
||||
import { baseUrl, checkSelectPurJs, LoadDT, showDone } from "../modules/mainFunction.mjs";
|
||||
import {
|
||||
baseUrl,
|
||||
checkSelectPurJs,
|
||||
LoadDT,
|
||||
showDone,
|
||||
} from "../modules/mainFunction.mjs";
|
||||
import { updateDB } from "../modules/ajaxRequest.mjs";
|
||||
|
||||
export class ClientGroupFacturation {
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param myresp instantiate client group facturation object
|
||||
*/
|
||||
constructor(myresp) {
|
||||
this.id = myresp.id;
|
||||
this.clientGroupFacturationName = ((myresp.group_facturation_name.length === 0) ? '-' : myresp.group_facturation_name);
|
||||
this.phoneNumber = (myresp.phone_number != null && myresp.phone_number.length > 0) ? myresp.phone_number : '-';
|
||||
this.address = (myresp.address != null && myresp.address.length > 0) ? myresp.address : '-';
|
||||
this.postalCode = (myresp.postal_code != null && myresp.postal_code.length > 0) ? myresp.postal_code : '-';
|
||||
this.city = (myresp.city != null && myresp.city.length > 0) ? myresp.city : '-';
|
||||
this.email = (myresp.email != null && myresp.email.length > 0) ? myresp.email : '-';
|
||||
this.siretNumber = (myresp.siret_number != null && myresp.siret_number.length > 0) ? myresp.siret_number : '-';
|
||||
this.tvaIntraCommu = (myresp.tva_intracommu != null && myresp.tva_intracommu.length > 0) ? myresp.tva_intracommu : '-';
|
||||
this.clientGroupFacturationName =
|
||||
myresp.group_facturation_name.length === 0
|
||||
? "-"
|
||||
: myresp.group_facturation_name;
|
||||
this.phoneNumber =
|
||||
myresp.phone_number != null && myresp.phone_number.length > 0
|
||||
? myresp.phone_number
|
||||
: "-";
|
||||
this.address =
|
||||
myresp.address != null && myresp.address.length > 0
|
||||
? myresp.address
|
||||
: "-";
|
||||
this.postalCode =
|
||||
myresp.postal_code != null && myresp.postal_code.length > 0
|
||||
? myresp.postal_code
|
||||
: "-";
|
||||
this.city =
|
||||
myresp.city != null && myresp.city.length > 0 ? myresp.city : "-";
|
||||
this.email =
|
||||
myresp.email != null && myresp.email.length > 0 ? myresp.email : "-";
|
||||
this.siretNumber =
|
||||
myresp.siret_number != null && myresp.siret_number.length > 0
|
||||
? myresp.siret_number
|
||||
: "-";
|
||||
this.tvaIntraCommu =
|
||||
myresp.tva_intracommu != null && myresp.tva_intracommu.length > 0
|
||||
? myresp.tva_intracommu
|
||||
: "-";
|
||||
this.templateTypeKey =
|
||||
myresp.fk_template_type_key != null &&
|
||||
myresp.fk_template_type_key.length > 0
|
||||
? myresp.fk_template_type_key
|
||||
: "-";
|
||||
}
|
||||
|
||||
/**
|
||||
@ -25,120 +54,231 @@ export class ClientGroupFacturation {
|
||||
*/
|
||||
getDTRow() {
|
||||
let clientGroupFacturationRow = [
|
||||
'<div>' + this.id + '</div>',
|
||||
'<div class="editable" data-table="client_group_facturation" data-column="group_facturation_name" data-id="' + this.id + '">' + this.clientGroupFacturationName + '</div>',
|
||||
'<div class="editable" data-table="client_group_facturation" data-column="address" data-id="' + this.id + '">' + this.address + '</div>',
|
||||
'<div class="editable" data-table="client_group_facturation" data-column="city" data-id="' + this.id + '">' + this.city + '</div>',
|
||||
'<div class="editable" data-table="client_group_facturation" data-column="postal_code" data-id="' + this.id + '">' + this.postalCode + '</div>',
|
||||
'<div class="editable" data-table="client_group_facturation" data-column="email" data-id="' + this.id + '">' + this.email + '</div>',
|
||||
'<div class="editable" data-table="client_group_facturation" data-column="phone_number" data-id="' + this.id + '">' + this.phoneNumber + '</div>',
|
||||
'<div class="editable" data-table="client_group_facturation" data-column="siret_number" data-id="' + this.id + '">' + this.siretNumber + '</div>',
|
||||
'<div class="editable" data-table="client_group_facturation" data-column="tva_intracommu" data-id="' + this.id + '">' + this.tvaIntraCommu + '</div>',
|
||||
'<div data-modifier="clientGroupFacturation" data-id=' + this.id + ' data-table="client_group_facturation" style="display:inline-block;margin-right:0px;" class="deleteItem icon-delete"></div>'
|
||||
"<div>" + this.id + "</div>",
|
||||
'<div class="editable" data-table="client_group_facturation" data-column="group_facturation_name" data-id="' +
|
||||
this.id +
|
||||
'">' +
|
||||
this.clientGroupFacturationName +
|
||||
"</div>",
|
||||
'<div class="editable" data-table="client_group_facturation" data-column="address" data-id="' +
|
||||
this.id +
|
||||
'">' +
|
||||
this.address +
|
||||
"</div>",
|
||||
'<div class="editable" data-table="client_group_facturation" data-column="city" data-id="' +
|
||||
this.id +
|
||||
'">' +
|
||||
this.city +
|
||||
"</div>",
|
||||
'<div class="editable" data-table="client_group_facturation" data-column="postal_code" data-id="' +
|
||||
this.id +
|
||||
'">' +
|
||||
this.postalCode +
|
||||
"</div>",
|
||||
'<div class="editable" data-table="client_group_facturation" data-column="email" data-id="' +
|
||||
this.id +
|
||||
'">' +
|
||||
this.email +
|
||||
"</div>",
|
||||
'<div class="editable" data-table="client_group_facturation" data-column="phone_number" data-id="' +
|
||||
this.id +
|
||||
'">' +
|
||||
this.phoneNumber +
|
||||
"</div>",
|
||||
'<div class="editable" data-table="client_group_facturation" data-column="siret_number" data-id="' +
|
||||
this.id +
|
||||
'">' +
|
||||
this.siretNumber +
|
||||
"</div>",
|
||||
'<div class="editable" data-table="client_group_facturation" data-column="tva_intracommu" data-id="' +
|
||||
this.id +
|
||||
'">' +
|
||||
this.tvaIntraCommu +
|
||||
"</div>",
|
||||
'<div class="selectClientTemplateTypes" data-table="client_group_facturation" data-column="fk_template_type_key" data-id="' +
|
||||
this.id +
|
||||
'" data-current="' +
|
||||
this.templateTypeKey +
|
||||
'">' +
|
||||
this.templateTypeKey +
|
||||
"</div>",
|
||||
'<div data-modifier="clientGroupFacturation" data-id=' +
|
||||
this.id +
|
||||
' data-table="client_group_facturation" style="display:inline-block;margin-right:0px;" class="deleteItem icon-delete"></div>',
|
||||
];
|
||||
|
||||
return clientGroupFacturationRow;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {*} clientGroupFacturationDatatable
|
||||
*
|
||||
* @param {*} clientGroupFacturationDatatable
|
||||
*/
|
||||
static loadClientGroupFacturationDatatable(clientGroupFacturationDatatable) {
|
||||
var oReq = new XMLHttpRequest();
|
||||
oReq.open('PROPFIND', baseUrl + '/client/getClientGroupFacturations', true);
|
||||
oReq.open("PROPFIND", baseUrl + "/client/getClientGroupFacturations", true);
|
||||
oReq.setRequestHeader("Content-Type", "application/json");
|
||||
oReq.onload = function(e){
|
||||
oReq.onload = function (e) {
|
||||
if (this.status == 200) {
|
||||
LoadDT(clientGroupFacturationDatatable, JSON.parse(this.response), ClientGroupFacturation);
|
||||
}else{
|
||||
LoadDT(
|
||||
clientGroupFacturationDatatable,
|
||||
JSON.parse(this.response),
|
||||
ClientGroupFacturation
|
||||
);
|
||||
} else {
|
||||
showError(this.response);
|
||||
}
|
||||
};
|
||||
oReq.send();
|
||||
}
|
||||
|
||||
static getClientGroupFacturations(callback){
|
||||
var oReq = new XMLHttpRequest();
|
||||
oReq.open('PROPFIND', baseUrl + '/client/getClientGroupFacturations', true);
|
||||
oReq.setRequestHeader("Content-Type", "application/json");
|
||||
oReq.onload = function(e){
|
||||
if (this.status == 200) {
|
||||
callback(JSON.parse(this.response));
|
||||
}else{
|
||||
showError(this.response);
|
||||
}
|
||||
};
|
||||
oReq.send();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {*} lid
|
||||
*/
|
||||
static loadClientGroupFacturationListToSelect(e){
|
||||
ClientGroupFacturation.getClientGroupFacturations(response => {
|
||||
|
||||
var selectElement = document.createElement("select");
|
||||
selectElement.dataset.current = e.target.dataset.current;
|
||||
selectElement.dataset.id = e.target.dataset.id;
|
||||
selectElement.dataset.old = e.target.innerHTML;
|
||||
|
||||
selectElement.addEventListener("change", el=>{
|
||||
if(el.target.value != 0){
|
||||
updateDB(el.target.parentElement.dataset.table,
|
||||
el.target.parentElement.dataset.column,
|
||||
el.target.value,
|
||||
el.target.parentElement.dataset.id
|
||||
);
|
||||
|
||||
// location.reload();
|
||||
|
||||
var parentElement = el.target.parentElement
|
||||
parentElement.innerHTML = el.target.options[el.target.selectedIndex].text;
|
||||
parentElement.dataset.current = el.target.value;
|
||||
}else{
|
||||
var parentElement = el.target.parentElement
|
||||
parentElement.innerHTML = el.target.dataset.old
|
||||
}
|
||||
});
|
||||
|
||||
var option = document.createElement("option");
|
||||
option.value = 0;
|
||||
option.text = t('gestion', 'Cancel');
|
||||
selectElement.appendChild(option);
|
||||
|
||||
JSON.parse(response).forEach(myresp => {
|
||||
var txt = document.createElement("textarea");
|
||||
txt.innerHTML = myresp.group_facturation_name;
|
||||
var option = document.createElement("option");
|
||||
option.value = myresp.id;
|
||||
option.text = txt.value;
|
||||
selectElement.appendChild(option);
|
||||
});
|
||||
|
||||
checkSelectPurJs(selectElement);
|
||||
|
||||
e.target.innerHTML = ''
|
||||
e.target.appendChild(selectElement);
|
||||
});
|
||||
static getClientGroupFacturations(callback) {
|
||||
var oReq = new XMLHttpRequest();
|
||||
oReq.open("PROPFIND", baseUrl + "/client/getClientGroupFacturations", true);
|
||||
oReq.setRequestHeader("Content-Type", "application/json");
|
||||
oReq.onload = function (e) {
|
||||
if (this.status == 200) {
|
||||
callback(JSON.parse(this.response));
|
||||
} else {
|
||||
showError(this.response);
|
||||
}
|
||||
};
|
||||
oReq.send();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {*} dt
|
||||
*
|
||||
* @param {*} lid
|
||||
*/
|
||||
static loadClientGroupFacturationListToSelect(e) {
|
||||
ClientGroupFacturation.getClientGroupFacturations((response) => {
|
||||
var selectElement = document.createElement("select");
|
||||
selectElement.dataset.current = e.target.dataset.current;
|
||||
selectElement.dataset.id = e.target.dataset.id;
|
||||
selectElement.dataset.old = e.target.innerHTML;
|
||||
|
||||
selectElement.addEventListener("change", (el) => {
|
||||
if (el.target.value != 0) {
|
||||
updateDB(
|
||||
el.target.parentElement.dataset.table,
|
||||
el.target.parentElement.dataset.column,
|
||||
el.target.value,
|
||||
el.target.parentElement.dataset.id
|
||||
);
|
||||
|
||||
// location.reload();
|
||||
|
||||
var parentElement = el.target.parentElement;
|
||||
parentElement.innerHTML =
|
||||
el.target.options[el.target.selectedIndex].text;
|
||||
parentElement.dataset.current = el.target.value;
|
||||
} else {
|
||||
var parentElement = el.target.parentElement;
|
||||
parentElement.innerHTML = el.target.dataset.old;
|
||||
}
|
||||
});
|
||||
|
||||
var option = document.createElement("option");
|
||||
option.value = 0;
|
||||
option.text = t("gestion", "Cancel");
|
||||
selectElement.appendChild(option);
|
||||
|
||||
JSON.parse(response).forEach((myresp) => {
|
||||
var txt = document.createElement("textarea");
|
||||
txt.innerHTML = myresp.group_facturation_name;
|
||||
var option = document.createElement("option");
|
||||
option.value = myresp.id;
|
||||
option.text = txt.value;
|
||||
selectElement.appendChild(option);
|
||||
});
|
||||
|
||||
checkSelectPurJs(selectElement);
|
||||
|
||||
e.target.innerHTML = "";
|
||||
e.target.appendChild(selectElement);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {*} dt
|
||||
*/
|
||||
static createDefaultClientGroupFacturation(dt) {
|
||||
var oReq = new XMLHttpRequest();
|
||||
oReq.open('POST', baseUrl + '/client/createDefaultClientGroupFacturation', true);
|
||||
oReq.onload = function(e){
|
||||
oReq.open(
|
||||
"POST",
|
||||
baseUrl + "/client/createDefaultClientGroupFacturation",
|
||||
true
|
||||
);
|
||||
oReq.onload = function (e) {
|
||||
if (this.status == 200) {
|
||||
showDone()
|
||||
showDone();
|
||||
ClientGroupFacturation.loadClientGroupFacturationDatatable(dt);
|
||||
}else{
|
||||
} else {
|
||||
showError(this.response);
|
||||
}
|
||||
};
|
||||
oReq.send();
|
||||
}
|
||||
|
||||
static getClientTemplateTypes(callback) {
|
||||
var oReq = new XMLHttpRequest();
|
||||
oReq.open("PROPFIND", baseUrl + "/client/getClientTemplateTypes", true);
|
||||
oReq.setRequestHeader("Content-Type", "application/json");
|
||||
oReq.onload = function (e) {
|
||||
if (this.status == 200) {
|
||||
callback(JSON.parse(this.response));
|
||||
} else {
|
||||
showError(this.response);
|
||||
}
|
||||
};
|
||||
oReq.send();
|
||||
}
|
||||
|
||||
static loadClientTemplateTypesIntoSelect(e) {
|
||||
ClientGroupFacturation.getClientTemplateTypes((response) => {
|
||||
var selectElement = document.createElement("select");
|
||||
selectElement.dataset.current = e.target.dataset.current;
|
||||
selectElement.dataset.id = e.target.dataset.id;
|
||||
selectElement.dataset.old = e.target.innerHTML;
|
||||
|
||||
selectElement.addEventListener("change", (el) => {
|
||||
if (el.target.value != "") {
|
||||
updateDB(
|
||||
el.target.parentElement.dataset.table,
|
||||
el.target.parentElement.dataset.column,
|
||||
el.target.value,
|
||||
el.target.parentElement.dataset.id
|
||||
);
|
||||
|
||||
var parentElement = el.target.parentElement;
|
||||
parentElement.innerHTML =
|
||||
el.target.options[el.target.selectedIndex].text;
|
||||
parentElement.dataset.current = el.target.value;
|
||||
} else {
|
||||
var parentElement = el.target.parentElement;
|
||||
parentElement.innerHTML = el.target.dataset.old;
|
||||
}
|
||||
});
|
||||
|
||||
var option = document.createElement("option");
|
||||
option.value = "";
|
||||
option.text = t("gestion", "Cancel");
|
||||
selectElement.appendChild(option);
|
||||
|
||||
JSON.parse(response).forEach((myresp) => {
|
||||
var txt = document.createElement("textarea");
|
||||
txt.innerHTML = myresp.template_type_key;
|
||||
var option = document.createElement("option");
|
||||
option.value = myresp.template_type_key;
|
||||
option.text = txt.value;
|
||||
selectElement.appendChild(option);
|
||||
});
|
||||
|
||||
checkSelectPurJs(selectElement);
|
||||
|
||||
e.target.innerHTML = "";
|
||||
e.target.appendChild(selectElement);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,6 +23,7 @@
|
||||
<th><?php p($l->t('Téléphone'));?></th>
|
||||
<th><?php p($l->t('Siret'));?></th>
|
||||
<th><?php p($l->t('Tva Intra-communautaire'));?></th>
|
||||
<th><?php p($l->t('Modèle de facture'));?></th>
|
||||
<th><?php p($l->t('Actions'));?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user