mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Merge pull request #15774 from aspangaro/13b3
Fix module intracommreport
This commit is contained in:
commit
e41898280d
BIN
dev/resources/intracommreport/manuelDebXml1.2.pdf
Normal file
BIN
dev/resources/intracommreport/manuelDebXml1.2.pdf
Normal file
Binary file not shown.
139
dev/resources/intracommreport/schema_deb.xsd
Normal file
139
dev/resources/intracommreport/schema_deb.xsd
Normal file
|
|
@ -0,0 +1,139 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<xsd:element name="INSTAT">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element ref="Envelope"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="Envelope">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element ref="envelopeId"/>
|
||||
<xsd:element ref="DateTime"/>
|
||||
<xsd:element ref="Party"/>
|
||||
<xsd:element ref="softwareUsed" minOccurs="0"/>
|
||||
<xsd:element ref="Declaration" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="envelopeId" type="xsd:string"/>
|
||||
<xsd:element name="DateTime">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element ref="date"/>
|
||||
<xsd:element ref="time" minOccurs="0"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="Party">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element ref="partyId"/>
|
||||
<xsd:element ref="partyName"/>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="partyType" use="required">
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:NMTOKEN">
|
||||
<xsd:enumeration value="PSI"/>
|
||||
<xsd:enumeration value="TDP"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="partyRole" use="required">
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:NMTOKEN">
|
||||
<xsd:enumeration value="sender"/>
|
||||
<xsd:enumeration value="PSI"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="partyId" type="xsd:string"/>
|
||||
<xsd:element name="partyName" type="xsd:string"/>
|
||||
<xsd:element name="softwareUsed" type="xsd:string"/>
|
||||
<xsd:element name="Declaration">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element ref="declarationId"/>
|
||||
<xsd:element ref="referencePeriod"/>
|
||||
<xsd:element ref="PSIId"/>
|
||||
<xsd:element ref="Function"/>
|
||||
<xsd:element ref="declarationTypeCode"/>
|
||||
<xsd:element ref="flowCode"/>
|
||||
<xsd:element ref="currencyCode"/>
|
||||
<xsd:element ref="Item" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="declarationId" type="xsd:string"/>
|
||||
<xsd:element name="referencePeriod" type="xsd:string"/>
|
||||
<xsd:element name="PSIId" type="xsd:string"/>
|
||||
<xsd:element name="Function">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element ref="functionCode"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="functionCode" type="xsd:string"/>
|
||||
<xsd:element name="declarationTypeCode" type="xsd:string"/>
|
||||
<xsd:element name="flowCode" type="xsd:string"/>
|
||||
<xsd:element name="currencyCode" type="xsd:string"/>
|
||||
<xsd:element name="Item">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element ref="itemNumber"/>
|
||||
<xsd:element ref="CN8" minOccurs="0"/>
|
||||
<xsd:element ref="MSConsDestCode" minOccurs="0"/>
|
||||
<xsd:element ref="countryOfOriginCode" minOccurs="0"/>
|
||||
<xsd:element ref="netMass" minOccurs="0"/>
|
||||
<xsd:element ref="quantityInSU" minOccurs="0"/>
|
||||
<xsd:element ref="invoicedAmount"/>
|
||||
<xsd:element ref="partnerId" minOccurs="0"/>
|
||||
<xsd:element ref="invoicedNumber" minOccurs="0"/>
|
||||
<xsd:element ref="statisticalProcedureCode" />
|
||||
<xsd:element ref="NatureOfTransaction" minOccurs="0"/>
|
||||
<xsd:element ref="modeOfTransportCode" minOccurs="0"/>
|
||||
<xsd:element ref="regionCode" minOccurs="0"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="itemNumber" type="xsd:integer"/>
|
||||
<xsd:element name="CN8">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element ref="CN8Code" minOccurs="0"/>
|
||||
<xsd:element ref="SUCode" minOccurs="0"/>
|
||||
<xsd:element ref="additionalGoodsCode" minOccurs="0"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="CN8Code" type="xsd:string"/>
|
||||
<xsd:element name="SUCode" type="xsd:string"/>
|
||||
<xsd:element name="additionalGoodsCode" type="xsd:string"/>
|
||||
<xsd:element name="MSConsDestCode" type="xsd:string"/>
|
||||
<xsd:element name="countryOfOriginCode" type="xsd:string"/>
|
||||
<xsd:element name="netMass" type="xsd:integer"/>
|
||||
<xsd:element name="quantityInSU" type="xsd:integer"/>
|
||||
<xsd:element name="invoicedAmount" type="xsd:integer"/>
|
||||
<xsd:element name="partnerId" type="xsd:string"/>
|
||||
<xsd:element name="invoicedNumber" type="xsd:string"/>
|
||||
<xsd:element name="statisticalProcedureCode" type="xsd:integer"/>
|
||||
<xsd:element name="NatureOfTransaction">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element ref="natureOfTransactionACode"/>
|
||||
<xsd:element ref="natureOfTransactionBCode" minOccurs="0"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="natureOfTransactionACode" type="xsd:string"/>
|
||||
<xsd:element name="natureOfTransactionBCode" type="xsd:string"/>
|
||||
<xsd:element name="modeOfTransportCode" type="xsd:string"/>
|
||||
<xsd:element name="regionCode" type="xsd:string"/>
|
||||
<xsd:element name="date" type="xsd:date"/>
|
||||
<xsd:element name="time" type="xsd:time"/>
|
||||
</xsd:schema>
|
||||
|
|
@ -62,10 +62,10 @@ class modIntracommreport extends DolibarrModules
|
|||
$this->config_page_url = array("intracommreport.php@intracommreport");
|
||||
|
||||
// Dependencies
|
||||
$this->depends = array("modFacture", "modTax"); // List of modules id that must be enabled if this module is enabled
|
||||
$this->depends = array("modFacture", "modTax", "modCategorie"); // List of modules id that must be enabled if this module is enabled
|
||||
$this->requiredby = array(); // List of modules id to disable if this one is disabled
|
||||
$this->conflictwith = array(); // List of modules id this module is in conflict with
|
||||
$this->phpmin = array(5, 5); // Minimum version of PHP required by module
|
||||
$this->phpmin = array(5, 6); // Minimum version of PHP required by module
|
||||
$this->need_dolibarr_version = array(13, 0, -5); // Minimum version of Dolibarr required by module
|
||||
$this->langfiles = array("intracommreport");
|
||||
|
||||
|
|
|
|||
|
|
@ -159,9 +159,8 @@ print "</tr>\n";
|
|||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("INTRACOMMREPORT_CATEG_FRAISDEPORT").'</td>';
|
||||
$arraychoices = array(3=>'Seuil de 460 000 €', 4=>'En dessous de 460 000 €');
|
||||
print '<td>';
|
||||
print $formother->select_categories(0, $conf->global->INTRACOMMREPORT_CATEG_FRAISDEPORT, 'INTRACOMMREPORT_CATEG_FRAISDEPORT');
|
||||
print $formother->select_categories('product', $conf->global->INTRACOMMREPORT_CATEG_FRAISDEPORT, 'INTRACOMMREPORT_CATEG_FRAISDEPORT');
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
|
@ -193,10 +192,8 @@ foreach ($list_DES as $key)
|
|||
|
||||
print '</table>';
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
print '<div class="inline-block divButAction">';
|
||||
print '<input type="submit" name="bt_save" class="butAction button-save" value="'.$langs->trans("Save").'" />';
|
||||
print '</div>';
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" name="bt_save" class="butAction button-save" value="'.$langs->trans("Update").'" />';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ class IntracommReport extends CommonObject
|
|||
$date_time->addChild('date', date('Y-m-d'));
|
||||
$date_time->addChild('time', date('H:i:s'));
|
||||
$party = $enveloppe->addChild('Party');
|
||||
$party->addAttribute('partType', $conf->global->INTRACOMMREPORT_TYPE_ACTEUR);
|
||||
$party->addAttribute('partyType', $conf->global->INTRACOMMREPORT_TYPE_ACTEUR);
|
||||
$party->addAttribute('partyRole', $conf->global->INTRACOMMREPORT_ROLE_ACTEUR);
|
||||
$party->addChild('partyId', $party_id);
|
||||
$party->addChild('partyName', $declarant);
|
||||
|
|
@ -286,13 +286,13 @@ class IntracommReport extends CommonObject
|
|||
global $mysoc, $conf;
|
||||
|
||||
if ($type == 'expedition' || $exporttype == 'des') {
|
||||
$sql = 'SELECT f.facnumber, f.total as total_ht';
|
||||
$sql = 'SELECT f.ref as refinvoice, f.total as total_ht';
|
||||
$table = 'facture';
|
||||
$table_extraf = 'facture_extrafields';
|
||||
$tabledet = 'facturedet';
|
||||
$field_link = 'fk_facture';
|
||||
} else { // Introduction
|
||||
$sql = 'SELECT f.ref_supplier as facnumber, f.total_ht';
|
||||
$sql = 'SELECT f.ref_supplier as refinvoice, f.total_ht';
|
||||
$table = 'facture_fourn';
|
||||
$table_extraf = 'facture_fourn_extrafields';
|
||||
$tabledet = 'facture_fourn_det';
|
||||
|
|
@ -330,7 +330,7 @@ class IntracommReport extends CommonObject
|
|||
public function addItemXMl(&$declaration, &$res, $i, $code_douane_spe = '')
|
||||
{
|
||||
$item = $declaration->addChild('Item');
|
||||
$item->addChild('ItemNumber', $i);
|
||||
$item->addChild('itemNumber', $i);
|
||||
$cn8 = $item->addChild('CN8');
|
||||
if (empty($code_douane_spe)) {
|
||||
$code_douane = $res->customcode;
|
||||
|
|
@ -338,14 +338,15 @@ class IntracommReport extends CommonObject
|
|||
$code_douane = $code_douane_spe;
|
||||
}
|
||||
$cn8->addChild('CN8Code', $code_douane);
|
||||
$item->addChild('MSConsDestCode', $res->code); // code iso pays client
|
||||
$item->addChild('countryOfOriginCode', substr($res->zip, 0, 2)); // code iso pays d'origine
|
||||
$item->addChild('netMass', round($res->weight * $res->qty)); // Poids du produit
|
||||
$item->addChild('quantityInSU', $res->qty); // Quantité de produit dans la ligne
|
||||
$item->addChild('invoicedAmount', round($res->total_ht)); // Montant total ht de la facture (entier attendu)
|
||||
// $item->addChild('invoicedNumber', $res->refinvoice); // Numéro facture
|
||||
if (!empty($res->tva_intra)) {
|
||||
$item->addChild('partnerId', $res->tva_intra);
|
||||
}
|
||||
$item->addChild('MSConsDestCode', $res->code); // code iso pays client
|
||||
$item->addChild('netMass', $res->weight * $res->qty); // Poids du produit
|
||||
$item->addChild('quantityInSU', $res->qty); // Quantité de produit dans la ligne
|
||||
$item->addChild('invoicedAmount', round($res->total_ht)); // Montant total ht de la facture (entier attendu)
|
||||
$item->addChild('invoicedNumber', $res->facnumber); // Numéro facture
|
||||
$item->addChild('statisticalProcedureCode', '11');
|
||||
$nature_of_transaction = $item->addChild('NatureOfTransaction');
|
||||
$nature_of_transaction->addChild('natureOfTransactionACode', 1);
|
||||
|
|
@ -389,7 +390,7 @@ class IntracommReport extends CommonObject
|
|||
$table = 'facture';
|
||||
$tabledet = 'facturedet';
|
||||
$field_link = 'fk_facture';
|
||||
$more_sql = 'f.facnumber';
|
||||
$more_sql = 'f.ref';
|
||||
} else { // Introduction
|
||||
$table = 'facture_fourn';
|
||||
$tabledet = 'facture_fourn_det';
|
||||
|
|
@ -404,14 +405,14 @@ class IntracommReport extends CommonObject
|
|||
INNER JOIN '.MAIN_DB_PREFIX.'product p ON (p.rowid = d.fk_product)
|
||||
WHERE d.fk_product IS NOT NULL
|
||||
AND f.entity = '.$conf->entity.'
|
||||
AND '.$more_sql.' = "'.$res->facnumber.'"
|
||||
AND '.$more_sql.' = "'.$res->refinvoice.'"
|
||||
AND d.total_ht =
|
||||
(
|
||||
SELECT MAX(d.total_ht)
|
||||
FROM '.MAIN_DB_PREFIX.$tabledet.' d
|
||||
INNER JOIN '.MAIN_DB_PREFIX.$table.' f ON (f.rowid = d.'.$field_link.')
|
||||
WHERE d.fk_product IS NOT NULL
|
||||
AND '.$more_sql.' = "'.$res->facnumber.'"
|
||||
AND '.$more_sql.' = "'.$res->refinvoice.'"
|
||||
AND d.fk_product NOT IN
|
||||
(
|
||||
SELECT fk_product
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user