diff --git a/html/css/style-classic7.css b/html/css/style-classic7.css index 8d84feb1b..9b7d338f2 100644 --- a/html/css/style-classic7.css +++ b/html/css/style-classic7.css @@ -69,6 +69,7 @@ BODY { --font-button:'roboto light'; --font-super:'roboto regular'; --font-title:'Montserrat Regular'; + --bg-inner-box:#DCE1EF; } input{ font-family: 'OpenSansRegular'; @@ -1252,7 +1253,7 @@ box-shadow: 10px 10px 5px #888; *******************************************************************************/ div.inner_box { - background-color: #DCE1EF; + background-color: var(--bg-inner-box); font-family: Arial, Helvetica, "Liberation Sans", FreeSans, sans-serif; font-family: 'OpenSansRegular'; /*! font-family: 'var(--font-button)'; */ @@ -1271,7 +1272,7 @@ div.inner_box { left:0px ; } div.inner_box2 { - background-color: #DCE1EF; + background-color: var(--bg-inner-box); font-family: Arial, Helvetica, "Liberation Sans", FreeSans, sans-serif; font-family: 'OpenSansRegular'; /*! font-family: 'var(--font-button)'; */ @@ -2349,7 +2350,7 @@ table.vert_mtitle { } table.vert_mtitle td.first { - background-color: #DCE1EF; + background-color: var(--bg-inner-box); } table.vert_mtitle td { border : 1px solid #99B1DF; @@ -2567,7 +2568,7 @@ td.box { .smoke { text-align: center; - background-color: #DCE1EF; + background-color: var(--bg-inner-box); margin:0px; overflow:hidden; z-index:3; @@ -4072,4 +4073,20 @@ h2.h-section { margin-bottom: 0.5rem; border-radius: 5px; } - + /** + electronc invoice errors in SALE + */ +#invoice_error_popover { + background-color: var(--bg-inner-box); + position: absolute; + z-index: 1; + padding: 1rem; + left: 10%; + border:1px solid navy; +} +/** + * Button error + */ +.bt-error { + color:var(--color-red); +} \ No newline at end of file diff --git a/include/XMLDocument/InvoiceUBL21.php b/include/XMLDocument/InvoiceUBL21.php index 9b5475ec4..7183bbfb3 100644 --- a/include/XMLDocument/InvoiceUBL21.php +++ b/include/XMLDocument/InvoiceUBL21.php @@ -517,7 +517,6 @@ class InvoiceUBL21 extends XMLInvoice { @code P01 - InvoicePDF Facture PDF REF_ODT_001 - OpenDocument Fichier OpenDocument appendChild($embeddedDocument); $result->appendChild($id); - // ERROR FOR BELGIUM ! - // $documentType=$this->createElement("cbc:DocumentType",'application/pdf'); - // $result->appendChild($documentType); $result->appendChild($document_description); $result->appendChild($attachment); @@ -594,9 +589,11 @@ class InvoiceUBL21 extends XMLInvoice { $root->appendChild($this->createElement('cbc:ID',$this->data['id'])); $root->appendChild($this->createElement('cbc:IssueDate',$this->data['issue_date'])); - if ($this->data ['due_date'] != '') { - $root->appendChild($this->createElement('cbc:DueDate',$this->data['due_date'])); + if ($this->data ['due_date'] == '') + { + $this->data ['due_date']=$this->data['issue_date']; } + $root->appendChild($this->createElement('cbc:DueDate',$this->data['due_date'])); $root->appendChild($this->createElement('cbc:InvoiceTypeCode',380)); $root->appendChild($this->createElement('cbc:DocumentCurrencyCode',$this->data['currency'])); $root->appendChild($this->createElement('cbc:BuyerReference',"NOALYSS")); diff --git a/include/XMLDocument/XMLInvoice.php b/include/XMLDocument/XMLInvoice.php index c09862c87..a1ce9e0ae 100644 --- a/include/XMLDocument/XMLInvoice.php +++ b/include/XMLDocument/XMLInvoice.php @@ -57,6 +57,9 @@ namespace Noalyss\XMLDocument; ) [currency] => 0 + [info] => Array + [order] = order reference + [comment] = comment added to the invoice [operation] => Array ( [0] => Array @@ -208,7 +211,24 @@ abstract class XMLInvoice extends \DOMDocument $result['operation'][$i]['vat_reversed']=$operation->det->array[$i]['qs_vat_sided']; } - // retrieve currency + //------------------------------------------------ + // retrieve order and comment + //------------------------------------------------ + $a_row=$this->cn->get_array("select id_type,ji_value from jrn_info where jr_id=$1" + ,[$jr_id]); + $nb_row = count($a_row); + $result['info']=[]; + for($i=0;$i<$nb_row;$i++) { + switch ($a_row[$i]['id_type']) { + case 'BON_COMMANDE': + $result['info']['order']=$a_row[$i]['ji_value']; + break; + case 'OTHER': + $result['info']['comment']=$a_row[$i]['ji_value']; + break; + + } + } return $result; } diff --git a/include/class/acc_ledger_sale.class.php b/include/class/acc_ledger_sale.class.php index ab2f86256..2b929d641 100644 --- a/include/class/acc_ledger_sale.class.php +++ b/include/class/acc_ledger_sale.class.php @@ -944,7 +944,7 @@ class Acc_Ledger_Sale extends Acc_Ledger { $r.=''; $r.=''; - $r.=' ' . _('Client') . ' ' . hb($e_client . ':' . $client_name) . ''; + $r.=' ' . _('Client') . ' ' . HtmlInput::card_detail($e_client).":".hb( $client_name) . ''; $r.=''; $r.=''; $r.='
'._('Note').' '.h($p_array['jrn_note_input']).'
'; diff --git a/include/compta_ven.inc.php b/include/compta_ven.inc.php index 746a0e9d9..0672927ce 100644 --- a/include/compta_ven.inc.php +++ b/include/compta_ven.inc.php @@ -88,7 +88,6 @@ if ( isset ($_POST['view_invoice'] ) ) $xmldocument= \Noalyss\XMLDocument\XMLInvoice::build_xmlinvoice($cn); $array=[]; $array['supplier']=$xmldocument->fill_supplier(); - echo "customer ",$http->post("e_client"); $customer=Fiche::from_qcode($cn,trim($http->post("e_client"))); $array['customer']=$xmldocument->fill_customer($customer->id); @@ -169,22 +168,32 @@ if ( isset($_POST['record']) ) $receipt= HtmlInput::show_receipt_document($Ledger->jr_id ,h($file)); $acc_document=new Acc_Document($cn,$Ledger->jr_id); - //----------------------------------------------------------------- + //------------------------------------------------------- // Generate a XLM invoice // if a document has been created create the XML file - //----------------------------------------------------------------- + //------------------------------------------------------- + ///@var $flag_invoice (int) error for invoice generating. + /// 0 = nothing + /// 1 = cannot create e-invoice + /// 2 = create e-invoice requested + + $flag_invoice=0; if ($g_parameter->MY_INVOICE_FORMAT != 'BASIC' && ! empty($acc_document->d_filename )) { - + $flag_invoice=2; $xmldocument= \Noalyss\XMLDocument\XMLInvoice::build_xmlinvoice($cn); $xmldocument->build_data($Ledger->jr_id); $code_error = $xmldocument->verify() ; if ( ! empty( $code_error ) ) { - echo "Impossible de générer facture : code error "; - \Noalyss\Dbg::echo_var(1, '$code_error is '); - \Noalyss\Dbg::echo_var(1, $code_error); - // echo $xmldocument->get_message_error($code_error); + $xmldocument->display_error(); + $flag_invoice=1; } + } + //----------------------7-------------------------- + // flag_invoice == 2 , generate an e-invoice + //------------------------------------------------ + if ( $flag_invoice == 2 ) + { $pdf_filename=$acc_document->transform2pdf(); // save PDF In db @@ -213,6 +222,7 @@ if ( isset($_POST['record']) ) $receipt= HtmlInput::show_receipt_document($Ledger->jr_id,$acc_document->d_filename); } + } } @@ -235,8 +245,11 @@ if ( isset($_POST['record']) ) } /* Show button */ - echo '

Enregistrement

'; - + echo '

'._("Enregistré").'

'; + if ($flag_invoice == 1) { + echo_warning(_("Impossible de générer facture électronique") ); + $xmldocument->display_error(); + } echo $Ledger->confirm($_POST,true); /* Show link for Invoice */ if ($receipt != "") diff --git a/include/template/invoiceUBL21-display_error.php b/include/template/invoiceUBL21-display_error.php index 20e000227..d17c408fa 100644 --- a/include/template/invoiceUBL21-display_error.php +++ b/include/template/invoiceUBL21-display_error.php @@ -25,75 +25,100 @@ * @brief display errors for generating e-invoices, called from * invoiceUBL21-display-error.php */ -//var @a_error (array) contains error +///@var $a_vat_error (array) contains error for VAT +$a_vat_error=$this->check_VAT(); -if ( count($a_error) == 0) return; +///@var $total_error (int) total of errors found in e-invoice +$total_error=count ($a_error['general']) + + count($a_error['operation']) + + count($a_error['customer']) + + count($a_error['company']) + +count($a_vat_error); +if ( $total_error == 0 ) : + return; +endif; $error_message=new \Noalyss\XMLDocument\Error_Message($a_error); -var_dump($a_error); ?> -
-

-

- -

+ + \ No newline at end of file