diff --git a/html/css/style-classic7.css b/html/css/style-classic7.css index d8057d772..6883b0842 100644 --- a/html/css/style-classic7.css +++ b/html/css/style-classic7.css @@ -72,6 +72,7 @@ BODY { --bg-inner-box:#DCE1EF; --underline-menu:#d7e8ee; --bg-slide:#c5d5e8; + --end-level1:#eb7c7e; } input{ font-family: 'OpenSansRegular'; @@ -2089,7 +2090,7 @@ div.box { div.box { width: 35rem; max-height: 30%; - height: 45vh; + height: 40rem; } } @@ -2500,6 +2501,8 @@ ul.aligned-block li { padding: 2rem; border:1px solid navy; margin-right:1rem; + width: 20rem; + } /*************************************************************************** * column in the dashboard @@ -2513,6 +2516,7 @@ td.cut { } td.box { border-left: #9999ff solid 1px; + border-radius: 10px 0px; } /**************************************************************************** @@ -3973,8 +3977,7 @@ h2.h-section { .nav-item.li-active.nav-item-underline::before { transform: scale(1); background-color: #d03100; - background-image: linear-gradient(to right,#cc0000 0%,red 20%) ; - background-image: linear-gradient(to right,darkred 0%,red 10%,red 90%,darkred); + background-image: linear-gradient(to right,var(--end-level1) 0%,red 10%,red 90%,var(--end-level1)); } /** @@ -4171,7 +4174,7 @@ h2.h-section { } .topmenu .nav-item.nav-item-underline:hover::before,.topmenu .nav-item.nav-item-underline:focus::before { transform: scaleX(1) scaleY(1); - background-image: linear-gradient(to right,darkred,red); + background-image: linear-gradient(to right,var(--end-level1),red); } @@ -4182,7 +4185,7 @@ h2.h-section { .topmenu .nav-item.nav-item-underline:hover::before,.topmenu .nav-item.nav-item-underline:focus::before { transform: scaleX(1) scaleY(1); - background-image: linear-gradient(to right,darkred 0%,red 30%); + background-image: linear-gradient(to right,var(--end-level1) 0%,red 30%); } /*.topmenu .nav-item.nav-item-underline::before { @@ -4258,6 +4261,8 @@ span.nb-round { .bt-center { margin-bottom: 2rem; + float:inherit; + clear:both; } @@ -4287,4 +4292,10 @@ span.nb-round { #module_setting .selectedcell { background-color:beige; +} + +#facturation_div_id{ + height:auto; + float:left + } \ No newline at end of file diff --git a/include/XMLDocument/xml_reader.class.php b/include/XMLDocument/xml_reader.class.php index 2497cbfff..30b8f8fb4 100644 --- a/include/XMLDocument/xml_reader.class.php +++ b/include/XMLDocument/xml_reader.class.php @@ -229,6 +229,9 @@ abstract class XML_Reader $result = []; $result['ID'] = $this->get_node_value("//cac:AccountingCustomerParty[1]/cac:Party[1]/cbc:EndpointID[1]"); $result['name'] = $this->get_node_value('//cac:AccountingCustomerParty[1]/cac:Party[1]/cac:PartyName[1]/cbc:Name[1]'); + if ($result['name'] == '') { + $result['name'] = $this->get_node_value("//cac:AccountingCustomerParty[1]/cac:Party[1]/cac:PartyLegalEntity[1]/cbc:RegistrationName[1]"); + } $result['street'] = $this->get_node_value('//cac:AccountingCustomerParty[1]/cac:Party[1]/cac:PostalAddress[1]/cbc:StreetName[1]'); $result['city'] = $this->get_node_value('//cac:AccountingCustomerParty[1]/cac:Party[1]/cac:PostalAddress[1]/cbc:CityName[1]'); $result['postcode'] = $this->get_node_value('//cac:AccountingCustomerParty[1]/cac:Party[1]/cac:PostalAddress[1]/cbc:PostalZone[1]'); @@ -247,12 +250,28 @@ abstract class XML_Reader $result = []; $result['ID'] = $this->get_node_value("//cac:AccountingSupplierParty[1]/cac:Party[1]/cbc:EndpointID[1]"); $result['name'] = $this->get_node_value("//cac:AccountingSupplierParty[1]/cac:Party[1]/cac:PartyName[1]/cbc:Name[1]"); + if ($result['name'] == '') { + $result['name'] = $this->get_node_value("//cac:AccountingSupplierParty[1]/cac:Party[1]/cac:PartyLegalEntity[1]/cbc:RegistrationName[1]"); + } $result['street'] = $this->get_node_value("//cac:AccountingSupplierParty[1]/cac:Party[1]/cac:PostalAddress[1]/cbc:StreetName[1]"); $result['city'] = $this->get_node_value("//cac:AccountingSupplierParty[1]/cac:Party[1]/cac:PostalAddress[1]/cbc:CityName[1]"); $result['postcode'] = $this->get_node_value("//cac:AccountingSupplierParty[1]/cac:Party[1]/cac:PostalAddress[1]/cbc:PostalZone[1]"); $result['country_code'] = $this->get_node_value("//cac:AccountingSupplierParty[1]/cac:Party[1]/cac:PostalAddress[1]/cac:Country[1]/cbc:IdentificationCode[1]"); $result['company_id'] = $this->get_node_value("//cac:AccountingSupplierParty[1]/cac:Party[1]/cac:PartyTaxScheme[1]/cbc:CompanyID[1]"); + if ($result['company_id'] == "" ) { + $result['company_id'] = $this->get_node_value("//cac:AccountingSupplierParty[1]/cac:Party[1]/cac:PartyLegalEntity[1]/cbc:CompanyID[1]"); + } $result['scheme'] = $this->get_node("//cac:AccountingSupplierParty[1]/cac:Party[1]/cbc:EndpointID[1]")[0]->getAttribute("schemeID"); + /** + * get contact + + Facturation NOALYSS + invoice@noalyss + + */ + $result['contact_name'] = $this->get_node_value("//cac:AccountingSupplierParty[1]/cac:Party[1]/cac:Contact[1]/cbc:Name[1]"); + $result['contact_mail'] = $this->get_node_value("//cac:AccountingSupplierParty[1]/cac:Party[1]/cac:Contact[1]/cbc:ElectronicMail"); + return $result; } @@ -378,8 +397,6 @@ abstract class XML_Reader /** * * @return array - * @TODODNY - * Implémenter les allowances */ function get_info(): array { @@ -390,6 +407,7 @@ abstract class XML_Reader $result['InvoiceTypeCode'] =$this->get_document_type_code(); $result['DocumentCurrencyCode'] = $this->get_node_value('cbc:DocumentCurrencyCode'); $result['BuyerReference'] = $this->get_node_value('cbc:BuyerReference'); + $result['OrderReference'] = $this->get_node_value('//cac:OrderReference[1]/cbc:ID[1]'); $result['ActualDeliveryDate'] = $this->get_node_value('//cac:Delivery[1]/cbc:ActualDeliveryDate[1]'); $result['info']=array(); @@ -410,6 +428,7 @@ abstract class XML_Reader public function to_pdf(): PDF { //$pdf = new PDF($cn); + $pdf = new PDF(); $result = $this->get_info(); $info=$result; @@ -419,97 +438,133 @@ abstract class XML_Reader $pdf->AddPage(); // 180 mm large $pdf->setFont("DejaVu", "B", 16); - $pdf->write_cell(20, 10, ""); - $pdf->write_cell(170, 10, _("Résumé facture"),1,0,'C'); - $pdf->line_new(10); + $pdf->line_new(2); + $pdf->SetTextColor(0,0,127); + $pdf->write_cell(10, 10, ""); + $pdf->write_cell(170, 10, _("Résumé document"),1,0,'C'); + $pdf->line_new(20); + $pdf->Image(NOALYSS_HOME.'/image/logo10000.png', 10, 10, 20, 0, 'PNG'); + $pdf->setFont("DejaVu", "", 7); + $pdf->SetTextColor(0,0,0); $pdf->write(4, sprintf(_("Document ID %s"), $result['id'])); $pdf->ln(); - $pdf->write(4, sprintf(_("Date facture %s"), $result['IssueDate'])); - $pdf->ln(); - $pdf->write(4, sprintf(_("Date échéance %s"), $result['DueDate'])); - $pdf->ln(); + $pdf->setFont("DejaVu", "B", 8); + $pdf->write_cell(20,4,_('Date')); + $pdf->print_row(); + $pdf->setFont("DejaVuCond", "", 7); + $pdf->write_multi(38,4, sprintf(_(" Facture %s"), $result['IssueDate'])); + $pdf->write_multi(38,4, sprintf(_("Echéance %s"), $result['DueDate'])); + $pdf->write_multi(38,4, sprintf(_("Livraison %s"), $result['ActualDeliveryDate'])); + $pdf->line_new(); $pdf->write(4, sprintf(_("Type et code document %s"), $result['InvoiceTypeCode'])); $pdf->ln(); $pdf->write(4, sprintf(_("Devise document %s"), $result['DocumentCurrencyCode'])); $pdf->ln(); $pdf->write(4, sprintf(_("Référence client %s"), $result['BuyerReference'])); $pdf->ln(); - $pdf->write(4, sprintf(_("Date Livraison %s"), $result['ActualDeliveryDate'])); + $pdf->write(4, sprintf(_("Référence commande %s"), $result['OrderReference'])); $pdf->ln(10); $pdf->setFont("DejaVu", "B", 12); + $pdf->SetTextColor(0,0,127); $pdf->write_cell(60, 4, _("Fournisseur")); - $pdf->line_new(12); + $pdf->line_new(6); $supplier = $this->get_supplier(); - $pdf->setFont("DejaVu", "", 7); - $pdf->write_cell(60, 4, $supplier['name']); - $pdf->write_cell(60, 4, $supplier['company_id']); - $pdf->write_cell(60, 4,$supplier['scheme'].":". $supplier['ID']); + $pdf->setFont("DejaVu", "B", 8); + $pdf->write_multi(10, 4, ""); + $pdf->write_multi(150, 4, $supplier['name']); $pdf->line_new(); - $pdf->write_cell(60, 4, $supplier['street']); - $pdf->write_cell(30, 4, $supplier['postcode']); - $pdf->write_cell(60, 4, $supplier['city']); - $pdf->write_cell(20, 4, $supplier['country_code']); - $pdf->line_new(10); + $pdf->SetTextColor(0,0,0); + $pdf->setFont("DejaVuCond", "", 7); + $pdf->write_multi(70, 4, $supplier['street']); + $pdf->write_multi(30, 4, $supplier['postcode']); + $pdf->write_multi(50, 4, $supplier['city']); + $pdf->write_cell(10, 4, $supplier['country_code']); + $pdf->line_new(); + $pdf->write_cell(50, 4, $supplier['company_id']); + $pdf->write_cell(50, 4,'PEPPOL ID:'.$supplier['scheme'].":". $supplier['ID']); + $pdf->line_new(); + if ( $supplier['contact_name'] != '' || $supplier['contact_mail'] != '') { + $pdf->write_multi(100, 4, "contact: ".$supplier['contact_name']." ". $supplier['contact_mail']); + $pdf->line_new(); + } + $pdf->line_new(4); $customer = $this->get_customer(); $pdf->setFont("DejaVu", "B", 12); + $pdf->SetTextColor(0,0,127); $pdf->write_cell(60, 4, _("Client")); - $pdf->line_new(10); - $pdf->setFont("DejaVu", "", 7); - $pdf->write_cell(60, 4, $customer['name']); - $pdf->write_cell(60, 4, $customer['company_id']); - $pdf->write_cell(60, 4, $customer['scheme'].":".$customer['ID']); + $pdf->line_new(6); + $pdf->setFont("DejaVu", "B", 8); + $pdf->write_multi(10, 4, ""); + $pdf->write_multi(150, 4, $customer['name']); $pdf->line_new(); - $pdf->write_cell(60, 4, $customer['street']); - $pdf->write_cell(40, 4, $customer['postcode']); - $pdf->write_cell(60, 4, $customer['city']); - $pdf->write_cell(20, 4, $customer['country_code']); - $pdf->line_new(10); + $pdf->SetTextColor(0,0,0); + $pdf->setFont("DejaVu", "", 7); + $pdf->write_multi(70, 4, $customer['street']); + $pdf->write_multi(30, 4, $customer['postcode']); + $pdf->write_multi(50, 4, $customer['city']); + $pdf->write_multi(10, 4, $customer['country_code']); + $pdf->line_new(); + $pdf->write_cell(50, 4, $customer['company_id']); + $pdf->write_cell(50, 4, 'PEPPOL ID:'.$customer['scheme'].":".$customer['ID']); + $pdf->line_new(6); /** * note invoice */ if ( $info['info']['note'] != "") { + $pdf->SetTextColor(0,0,127); $pdf->setFont("DejaVu", "B", 12); $pdf->write_cell(60, 4, _("Notes")); - $pdf->line_new(10); + $pdf->line_new(6); + $pdf->SetTextColor(0,0,0); $pdf->setFont("DejaVu", "", 7); - $pdf->write_multi(50, 4,$info['info']['note']); + $pdf->write_multi(130, 8,$info['info']['note']); $pdf->line_new(10); } /** * ITEM */ $pdf->setFont("DejaVu", "B", 12); + $pdf->SetTextColor(0,0,127); $pdf->write_cell(60, 4, _("Articles")); - $pdf->line_new(10); + $pdf->line_new(6); + $pdf->SetTextColor(0,0,0); $pdf->setFont("DejaVu", "", 7); $result = $this->get_invoiceLine(); $pdf->write_cell(50, 4, _("Code"), border: 'B'); - $pdf->write_cell(50, 4, _("Description"), border: 'B'); - $pdf->write_cell(30, 4, _("TVA"), border: 'B', align: 'R'); - $pdf->write_cell(25, 4, _("Quantité"), border: 'B', align: 'R'); - $pdf->write_cell(25, 4, _("Montant HT"), border: 'B', align: 'R'); + $pdf->write_cell(60, 4, _("Description"), border: 'B'); + $pdf->write_cell(20, 4, _("TVA"), border: 'B', align: 'R'); + $pdf->write_cell(20, 4, _("Prix unitaire"), border: 'B', align: 'R'); + $pdf->write_cell(20, 4, _("Quantité"), border: 'B', align: 'R'); + $pdf->write_cell(20, 4, _("Montant HT"), border: 'B', align: 'R'); $pdf->line_new(); $nb_inline = count($result); for ($i = 0; $i < $nb_inline; $i++) { - $pdf->write_cell(50, 4, $result[$i]['name']); - $pdf->write_cell(50, 4, $result[$i]['description']); - $pdf->write_cell(25, 4, $result[$i]['tva_percent'], align: 'R'); - $pdf->write_cell(5, 4, $result[$i]['tva_id']); - $pdf->write_cell(25, 4, $result[$i]['quantity'], align: 'R'); - $pdf->write_cell(25, 4, nbm($result[$i]['amount']), align: 'R'); + if ( $result[$i]['description'] == '') { + $pdf->write_multi(110, 4, $result[$i]['name']); + }else { + $pdf->write_multi(50, 4, $result[$i]['name']); + $pdf->write_multi(60, 4, $result[$i]['description']); + } + $pdf->write_cell(20, 4, $result[$i]['tva_percent'], align: 'R'); + //$pdf->write_cell(5, 4, $result[$i]['tva_id']); + $pdf->write_cell(20, 4, $result[$i]['unit_price'], align: 'R'); + $pdf->write_cell(20, 4, $result[$i]['quantity'], align: 'R'); + $pdf->write_cell(20, 4, nbm($result[$i]['amount']), align: 'R'); $pdf->line_new(); } $pdf->line_new(10); - + + $pdf->SetTextColor(0,0,127); $pdf->setFont("DejaVu", "B", 12); $pdf->write_cell(60, 4, _("Totaux")); - $pdf->line_new(10); + $pdf->line_new(6); + $pdf->SetTextColor(0,0,0); $pdf->setFont("DejaVu", "", 7); $result = $this->get_amount_summary(); // @TODO DNY : Qu'est-ce que LineExtension Amount ?? @@ -535,9 +590,11 @@ abstract class XML_Reader $nb_inline = count($result); if ( !empty ($result )) { + $pdf->SetTextColor(0,0,127); $pdf->setFont("DejaVu", "B", 12); $pdf->write_cell(60, 4, _("Charge et déduction")); - $pdf->line_new(10); + $pdf->line_new(6); + $pdf->SetTextColor(0,0,0); $pdf->setFont("DejaVu", "", 7); $pdf->write_cell(20, 4, _("code"), align: 'L', border: '1'); $pdf->write_cell(20, 4, _("Type"), border: '1'); @@ -564,13 +621,15 @@ abstract class XML_Reader $pdf->line_new(); } } + $pdf->SetTextColor(0,0,127); $pdf->setFont("DejaVu", "B", 12); $pdf->write_cell(60, 4, _("TVA")); - $pdf->line_new(10); + $pdf->line_new(6); + $pdf->SetTextColor(0,0,0); $pdf->setFont("DejaVu", "", 7); $result = $this->get_taxes(); $pdf->write_cell(25, 4, _("% Taxe"), align: 'R', border: 'B'); - $pdf->write_cell(5, 4, _("Code taxe"), border: 'B'); + $pdf->write_cell(30, 4, _("Code taxe"), border: 'B'); $pdf->write_cell(50, 4, _("Base"), align: 'R', border: 'B'); $pdf->write_cell(50, 4, _("Taxe"), align: 'R', border: 'B'); $pdf->line_new(); @@ -579,7 +638,7 @@ abstract class XML_Reader { $pdf->write_cell(25, 4, $result[$i]['tax_percent'], align: 'R'); $pdf->write_cell(5, 4, $result[$i]['tax_id']); - $pdf->write_cell(25, 4, $result[$i]['vatex']); + $pdf->write_multi(25, 4, $result[$i]['vatex']); $pdf->write_cell(50, 4, nbm($result[$i]['taxable_amount']), align: 'R'); $pdf->write_cell(50, 4, nbm($result[$i]['tax']), align: 'R'); @@ -589,8 +648,11 @@ abstract class XML_Reader $pdf->setFont("DejaVu", "B", 12); + $pdf->SetTextColor(0,0,127); $pdf->write_cell(60, 4, _("Paiement")); - $pdf->line_new(10); + $pdf->line_new(6); + $pdf->SetTextColor(0,0,0); + $pdf->setFont("DejaVu", "", 7); $result = $this->get_payment_mean(); $pdf->write_cell(50, 4, _("Code")); @@ -612,6 +674,7 @@ abstract class XML_Reader $pdf->write_multi(140, 4, str_replace(["\n", "\r", "\t"], " ", $result['note'][$i])); $pdf->line_new(); } + $pdf->line_new(6); /** * display name of embedded from files * @var $result(array of Document_Reference) @@ -619,17 +682,19 @@ abstract class XML_Reader $result=$this->get_embedded_document(); if ( count($result) > 0) { + $pdf->SetTextColor(0,0,127); $pdf->setFont("DejaVu", "B", 12); $pdf->write_cell(60,4,_('Documents inclus')); $pdf->line_new(); + $pdf->SetTextColor(0,0,0); $pdf->setFont("DejaVu", "", 7); $nb_result=count($result); for ($i=0;$i< $nb_result;$i++) { $binary=$result[$i]->getBinary_object(); - $pdf->write_cell(50,4,$result[$i]->getId()); - $pdf->write_cell(50,4,$binary->filename); - $pdf->write_cell(50,4,$result[$i]->getDescription()); + $pdf->write_multi(50,4,$result[$i]->getId()); + $pdf->write_multi(50,4,$binary->filename); + $pdf->write_multi(50,4,$result[$i]->getDescription()); $pdf->line_new(); } diff --git a/include/XMLDocument/xmlcreditnote_reader.class.php b/include/XMLDocument/xmlcreditnote_reader.class.php index d2f845bab..7e20b0801 100644 --- a/include/XMLDocument/xmlcreditnote_reader.class.php +++ b/include/XMLDocument/xmlcreditnote_reader.class.php @@ -143,15 +143,14 @@ class XMLCreditNote_Reader extends XML_Reader for ($e = 0; $e < $node->length; $e++) { $row = []; - $xml = simplexml_import_dom($node->item($e)); - $row ['quantity'] = $this->get_node_value("//cbc:CreditedQuantity", $e); - $row ['amount'] = $this->get_node_value("//cbc:LineExtensionAmount", $e); - $row ['description'] = $this->get_node_value("//cac:Item/cbc:Description", $e); - $row ['name'] = $this->get_node_value("//cac:CreditNoteLine/cac:Item/cbc:Name", $e); - $row ['unit_price'] = $this->get_node_value("//cac:CreditNoteLine/cac:Price/cbc:PriceAmount", $e); - $row ['tva_id'] = $this->get_node_value("//cac:CreditNoteLine/cac:Item/cac:ClassifiedTaxCategory/cbc:ID", $e); - $row ['tva_percent'] = $this->get_node_value("//cac:CreditNoteLine/cac:Item/cac:ClassifiedTaxCategory/cbc:Percent", $e); - + $row ['quantity'] = $node->item($e)->getElementsByTagName("CreditedQuantity")->item(0)->textContent; + $row ['code_quantity'] = $node->item($e)->getElementsByTagName("CreditedQuantity")->item(0)->getAttribute('unitCode'); + $row ['amount'] = $node->item($e)->getElementsByTagName("LineExtensionAmount")->item(0)->textContent; + $row ['description'] = $node->item($e)->getElementsByTagName("Description")->item(0)?->textContent; + $row ['name'] = $node->item($e)->getElementsByTagName("Name")->item(0)->textContent; + $row ['unit_price'] = $node->item($e)->getElementsByTagName("PriceAmount")->item(0)->textContent; + $row ['tva_id'] = $node->item($e)->getElementsByTagName("ID")->item(0)->textContent; + $row ['tva_percent'] = $node->item($e)->getElementsByTagName("Percent")->item(0)->textContent; $result[] = $row; } return $result; diff --git a/include/XMLDocument/xmlinvoice.class.php b/include/XMLDocument/xmlinvoice.class.php index 52244fc32..d681f6c71 100644 --- a/include/XMLDocument/xmlinvoice.class.php +++ b/include/XMLDocument/xmlinvoice.class.php @@ -257,7 +257,7 @@ abstract class XMLInvoice extends \DOMDocument } } - $result['info']['communication']=($result['info']['communication']=="")?$result['id']:""; + $result['info']['communication']=($result['info']['communication']=="")?$result['id']:$result['info']['communication']; $result['document']=$this->fill_document($jr_id); /** diff --git a/include/XMLDocument/xmlinvoice_reader.class.php b/include/XMLDocument/xmlinvoice_reader.class.php index eb94cdb4a..b8c3518b7 100644 --- a/include/XMLDocument/xmlinvoice_reader.class.php +++ b/include/XMLDocument/xmlinvoice_reader.class.php @@ -109,17 +109,17 @@ class XMLInvoice_Reader extends XML_Reader for ($e = 0; $e < $node->length; $e++) { $row = []; - $row ['quantity'] = $this->get_node_value("//cbc:InvoicedQuantity", $e); - $row ['amount'] = $this->get_node_value("//cbc:LineExtensionAmount", $e); - $row ['description'] = $this->get_node_value("//cac:Item/cbc:Description", $e); - $row ['name'] = $this->get_node_value("//cac:InvoiceLine/cac:Item/cbc:Name", $e); - $row ['unit_price'] = $this->get_node_value("//cac:InvoiceLine/cac:Price/cbc:PriceAmount", $e); - $row ['tva_id'] = $this->get_node_value("//cac:InvoiceLine/cac:Item/cac:ClassifiedTaxCategory/cbc:ID", $e); - $row ['tva_percent'] = $this->get_node_value("//cac:InvoiceLine/cac:Item/cac:ClassifiedTaxCategory/cbc:Percent", $e); - + $row ['quantity'] = $node->item($e)->getElementsByTagName("InvoicedQuantity")->item(0)->textContent; + $row ['code_quantity'] = $node->item($e)->getElementsByTagName("InvoicedQuantity")->item(0)->getAttribute('unitCode'); + $row ['amount'] = $node->item($e)->getElementsByTagName("LineExtensionAmount")->item(0)->textContent; + $row ['description'] = $node->item($e)->getElementsByTagName("Description")->item(0)?->textContent; + $row ['name'] = $node->item($e)->getElementsByTagName("Name")->item(0)->textContent; + $row ['unit_price'] = $node->item($e)->getElementsByTagName("PriceAmount")->item(0)->textContent; + $row ['tva_id'] = $node->item($e)->getElementsByTagName("ID")->item(0)->textContent; + $row ['tva_percent'] = $node->item($e)->getElementsByTagName("Percent")->item(0)->textContent; $result[] = $row; - return $result; } + return $result; } /** * @brief return the code of the document diff --git a/include/class/acc_ledger_purchase.class.php b/include/class/acc_ledger_purchase.class.php index 2ba56b493..6dbf25fcb 100644 --- a/include/class/acc_ledger_purchase.class.php +++ b/include/class/acc_ledger_purchase.class.php @@ -1988,7 +1988,6 @@ EOF; } $r.=''; - $r.='

'; if ( $g_parameter->MY_ANALYTIC!='nu' && !$p_summary) // use of AA $r.=''; @@ -2125,6 +2124,7 @@ EOF; $file=new IFile(); $file->setAlertOnSize(true); $file->table=0; + $r.='

'._("Facture").'

'; $r.=_("Ajoutez une pièce justificative "); $r.=$file->input("pj",""); @@ -2141,11 +2141,13 @@ EOF; $r.=$doc_gen->input().'
'; } $r.='

'; + $r.='

'._("Documents supplémentaires").'

'; $r.=$this->input_supplemental_document(); $r.='

'; $obj=new IText(); + $obj->size=50; $r.=_('Numero de bon de commande : ').$obj->input('bon_comm').'
'; - $r.=_('Autre information : ').$obj->input('other_info').'
'; + $r.=_('Communication').$obj->input('other_info').'
'; $r.='

'; $r.=''; return $r; diff --git a/include/class/acc_ledger_sale.class.php b/include/class/acc_ledger_sale.class.php index 6a6a7b265..5ba62f1c4 100644 --- a/include/class/acc_ledger_sale.class.php +++ b/include/class/acc_ledger_sale.class.php @@ -1282,14 +1282,16 @@ EOF; $r.=''.td($other_tax_label).td(hb($other_tax_amount),'class="num"'); } if ( $other_tax_amount!="") {$tot=bcadd($tot,$other_tax_amount,2);} - $r.=''.td(_('Total TVAC')).td(hb($tot),'class="num"'); + $r.=''.td(_('Total TVAC')).td(hb($tot),'class="num"').''; $r.=''; } else { + $r.=''; if ( ! empty($other_tax_label) ) { $r.=''.td($other_tax_label).td(hb($other_tax_amount),'class="num"'); } if ( $other_tax_amount!="") {$tot=bcadd($tot,$other_tax_amount,2);} - $r.='
Total '.hb($tot); + $r.=''.td(_('Total ')).td(hb($tot),'class="num"'); + $r.='
'; } $r.=''; @@ -1374,13 +1376,13 @@ EOF; */ public function extra_info() { - $r = '
'; + $r = '
'; // check for upload piece $file = new IFile(); $file->table = 0; $file->setAlertOnSize(true); - $r.='

'; + $r.='

'._("Facture").'

'; // add a receipt $r.=_("Ajoutez une pièce justificative "); $r.=$file->input("pj", ""); @@ -1398,11 +1400,15 @@ EOF; " union select -2,'"._("Z - Facture PDF Standard")."' ". " order by 2"); $r.=$doc_gen->input() . '
'; + $r.='

'._("Documents supplémentaires").'

'; + // add a receipt $r.=$this->input_supplemental_document(); - $r.='
'; $obj = new IText(); + $obj->size=50; + $r.='

'; $r.=_('Numero de bon de commande') . $obj->input('bon_comm') . '
'; + $r.=_('Communication') . $obj->input('other_info') . '
'; $r.='

'; $r.='
'; diff --git a/include/class/invoice_pdf.class.php b/include/class/invoice_pdf.class.php index 3dffd3c04..9a7615999 100644 --- a/include/class/invoice_pdf.class.php +++ b/include/class/invoice_pdf.class.php @@ -263,22 +263,25 @@ class Invoice_PDF extends \PDF } $this->write_multi($col['quantity'], 4, nbm($this->data['e_quant' . $i]), '', 'R',fill:$fill); $this->write_multi($col['price'], 4, nbm($this->data['e_march' . $i . '_price']), '', 'R',fill:$fill); - $this->write_multi($col['vat_code'], 4, $this->data['e_march' . $i . '_tva_id'], '', 'C',fill:$fill); - $x = $this->data['e_march' . $i . '_tva_id']; - if (!isset($a_tva_amount[$x])) + if (isset ($this->data['e_march' . $i . '_tva_id'])) { - $a_tva_amount[$x] = 0; + $this->write_multi($col['vat_code'], 4, $this->data['e_march' . $i . '_tva_id'], '', 'C',fill:$fill); + $x = $this->data['e_march' . $i . '_tva_id']; + if (!isset($a_tva_amount[$x])) + { + $a_tva_amount[$x] = 0; + } + $a_tva_amount[$x] = bcadd($a_tva_amount[$x], $this->data["e_march" . $i . "_tva_amount"], 2); + $tot_vat = bcadd($tot_vat + , $this->data['e_march' . $i . '_tva_amount'] + , 2); } - $a_tva_amount[$x] = bcadd($a_tva_amount[$x], $this->data["e_march" . $i . "_tva_amount"], 2); $tot_amount = bcadd($tot_amount , bcmul($this->data['e_march' . $i . '_price'] , $this->data['e_quant' . $i] , 2 ) , 2); - $tot_vat = bcadd($tot_vat - , $this->data['e_march' . $i . '_tva_amount'] - , 2); $this->line_new(4); if ($this->GetY()>250) { $this->AddPage(); diff --git a/include/class/tva_rate_mtable.class.php b/include/class/tva_rate_mtable.class.php index 01fdc2d4f..0f9f3f15f 100644 --- a/include/class/tva_rate_mtable.class.php +++ b/include/class/tva_rate_mtable.class.php @@ -97,6 +97,7 @@ class Tva_Rate_MTable extends Manage_Table_SQL 'tva_peppol_code'=>_("Code TVA est utilisé pour les factures électroniques, plus d'information dans le manuel"), 'vx_code'=>_("Code exemption pour facture PEPPOL (ubl)") ); + $this->setTitle(_("Détail TVA")); } /** diff --git a/include/compta_ven.inc.php b/include/compta_ven.inc.php index b052e04c8..024052918 100644 --- a/include/compta_ven.inc.php +++ b/include/compta_ven.inc.php @@ -158,6 +158,10 @@ if ( isset($_POST['record']) ) $Ledger=new Acc_Ledger_Sale($cn,$post_jrn); try { $internal=$Ledger->insert($_POST); + + /* Save the additional information into jrn_info */ + $obj=new Acc_Ledger_Info($cn); + $obj->save_extra($Ledger->jr_id,$_POST); $Ledger->upload_supplemental_document($Ledger->jr_id); // var $receipt (string) contains the name of the file name of // the invoice (document created), if empty there @@ -290,9 +294,6 @@ if ( isset($_POST['record']) ) } - /* Save the additional information into jrn_info */ - $obj=new Acc_Ledger_Info($cn); - $obj->save_extra($Ledger->jr_id,$_POST); /* save followup */ $Ledger->save_followup($http->request("action_gestion","string","")); diff --git a/include/constant.php b/include/constant.php index 85c67c639..6c7b4da38 100644 --- a/include/constant.php +++ b/include/constant.php @@ -28,7 +28,7 @@ global $version_noalyss; define('NOALYSS_VERSION', 10000 ); // Database schema version -define("DBVERSION", 206); +define("DBVERSION", 207); // version for MONO_DATABASE define("MONO_DATABASE", 25); diff --git a/include/lib/pdf_core.class.php b/include/lib/pdf_core.class.php index 3c95170ae..5950079a7 100644 --- a/include/lib/pdf_core.class.php +++ b/include/lib/pdf_core.class.php @@ -210,7 +210,7 @@ class PDF_Core extends TFPDF * @see TFPDF::SetFontSize() * @return void */ - protected function print_row() + function print_row() { static $e=0; $e++; diff --git a/include/sql/patch/upgrade206.sql b/include/sql/patch/upgrade206.sql new file mode 100644 index 000000000..76a9a3256 --- /dev/null +++ b/include/sql/patch/upgrade206.sql @@ -0,0 +1,45 @@ +begin; + +CREATE OR REPLACE FUNCTION guess_country_code() + RETURNS void + AS +$$ +declare + country_code char(2); + x record; +begin + for x in + select + f1.jft_id + ,f1.f_id + ,( select f2.ad_value from fiche_detail f2 where f2.f_id=f1.f_id and ad_id= 13) as tva_num + ,( select f3.ad_value from fiche_detail f3 where f3.f_id=f1.f_id and ad_id= 16) as country + from + fiche_detail f1 + where + f1.ad_id=57 + and coalesce(f1.ad_value,'')='' + loop + country_code=''; + case + when substr(x.tva_num,1,2) = 'FR' or upper(x.country)='FRANCE' then country_code='FR'; + when substr(x.tva_num,1,2) = 'BE' or upper(x.country)='BELGIQUE' then country_code='BE'; + when substr(x.tva_num,1,2) = 'LU' or upper(x.country)='LUXEMBOURG' then country_code='LU'; + when substr(x.tva_num,1,2) <> '' then country_code=upper(substr(x.tva_num,1,2)); + else + country_code=''; + end case; + raise notice 'tva_num % country % country_code % jft_id %s',x.tva_num,x.country,country_code,x.jft_id; + if country_code <> '' then + update fiche_detail set ad_value=country_code where jft_id=x.jft_id; + end if; + end loop; +end; +$$ +LANGUAGE plpgsql; + + +select guess_country_code(); + +insert into version (val,v_description) values (207,'Guess country code '); +commit; \ No newline at end of file diff --git a/include/widget/invoice/invoice-display.php b/include/widget/invoice/invoice-display.php index 6870ef6a2..6a38b2f4b 100644 --- a/include/widget/invoice/invoice-display.php +++ b/include/widget/invoice/invoice-display.php @@ -49,7 +49,7 @@ foreach ($array as $item):
-
+