Merge pull request #18106 from EpixFr/develop
NEW : Adding accounting export model for iSuite Expert
This commit is contained in:
commit
2e33d85b29
@ -59,6 +59,8 @@ class AccountancyExport
|
|||||||
public static $EXPORT_TYPE_LDCOMPTA10 = 120;
|
public static $EXPORT_TYPE_LDCOMPTA10 = 120;
|
||||||
public static $EXPORT_TYPE_GESTIMUMV3 = 130;
|
public static $EXPORT_TYPE_GESTIMUMV3 = 130;
|
||||||
public static $EXPORT_TYPE_GESTIMUMV5 = 135;
|
public static $EXPORT_TYPE_GESTIMUMV5 = 135;
|
||||||
|
public static $EXPORT_TYPE_ISUITEEXPERT = 200;
|
||||||
|
// Generic FEC after that
|
||||||
public static $EXPORT_TYPE_FEC = 1000;
|
public static $EXPORT_TYPE_FEC = 1000;
|
||||||
public static $EXPORT_TYPE_FEC2 = 1010;
|
public static $EXPORT_TYPE_FEC2 = 1010;
|
||||||
|
|
||||||
@ -123,6 +125,7 @@ class AccountancyExport
|
|||||||
self::$EXPORT_TYPE_GESTIMUMV5 => $langs->trans('Modelcsv_Gestinum_v5'),
|
self::$EXPORT_TYPE_GESTIMUMV5 => $langs->trans('Modelcsv_Gestinum_v5'),
|
||||||
self::$EXPORT_TYPE_FEC => $langs->trans('Modelcsv_FEC'),
|
self::$EXPORT_TYPE_FEC => $langs->trans('Modelcsv_FEC'),
|
||||||
self::$EXPORT_TYPE_FEC2 => $langs->trans('Modelcsv_FEC2'),
|
self::$EXPORT_TYPE_FEC2 => $langs->trans('Modelcsv_FEC2'),
|
||||||
|
self::$EXPORT_TYPE_ISUITEEXPERT => 'Export iSuite Expert',
|
||||||
);
|
);
|
||||||
|
|
||||||
ksort($listofexporttypes, SORT_NUMERIC);
|
ksort($listofexporttypes, SORT_NUMERIC);
|
||||||
@ -158,6 +161,7 @@ class AccountancyExport
|
|||||||
self::$EXPORT_TYPE_GESTIMUMV5 => 'gestimumv5',
|
self::$EXPORT_TYPE_GESTIMUMV5 => 'gestimumv5',
|
||||||
self::$EXPORT_TYPE_FEC => 'fec',
|
self::$EXPORT_TYPE_FEC => 'fec',
|
||||||
self::$EXPORT_TYPE_FEC2 => 'fec2',
|
self::$EXPORT_TYPE_FEC2 => 'fec2',
|
||||||
|
self::$EXPORT_TYPE_ISUITEEXPERT => 'isuiteexpert',
|
||||||
);
|
);
|
||||||
|
|
||||||
return $formatcode[$type];
|
return $formatcode[$type];
|
||||||
@ -243,6 +247,10 @@ class AccountancyExport
|
|||||||
'label' => $langs->trans('Modelcsv_FEC2'),
|
'label' => $langs->trans('Modelcsv_FEC2'),
|
||||||
'ACCOUNTING_EXPORT_FORMAT' => 'txt',
|
'ACCOUNTING_EXPORT_FORMAT' => 'txt',
|
||||||
),
|
),
|
||||||
|
self::$EXPORT_TYPE_ISUITEEXPERT => array(
|
||||||
|
'label' => 'iSuite Expert',
|
||||||
|
'ACCOUNTING_EXPORT_FORMAT' => 'csv',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
'cr'=> array(
|
'cr'=> array(
|
||||||
'1' => $langs->trans("Unix"),
|
'1' => $langs->trans("Unix"),
|
||||||
@ -334,6 +342,9 @@ class AccountancyExport
|
|||||||
case self::$EXPORT_TYPE_FEC2:
|
case self::$EXPORT_TYPE_FEC2:
|
||||||
$this->exportFEC2($TData);
|
$this->exportFEC2($TData);
|
||||||
break;
|
break;
|
||||||
|
case self::$EXPORT_TYPE_ISUITEEXPERT :
|
||||||
|
$this->exportiSuiteExpert($TData);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
$this->errors[] = $langs->trans('accountancy_error_modelnotfound');
|
$this->errors[] = $langs->trans('accountancy_error_modelnotfound');
|
||||||
break;
|
break;
|
||||||
@ -1752,6 +1763,62 @@ class AccountancyExport
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Export format : iSuite Expert
|
||||||
|
*
|
||||||
|
* by OpenSolus [https://opensolus.fr]
|
||||||
|
*
|
||||||
|
* @param array $objectLines data
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function exportiSuiteExpert($objectLines)
|
||||||
|
{
|
||||||
|
$this->separator = ';';
|
||||||
|
$this->end_line = "\r\n";
|
||||||
|
|
||||||
|
|
||||||
|
foreach ($objectLines as $line) {
|
||||||
|
$tab = array();
|
||||||
|
|
||||||
|
$date = dol_print_date($line->doc_date, '%d/%m/%Y');
|
||||||
|
|
||||||
|
$tab[] = $line->piece_num;
|
||||||
|
$tab[] = $date;
|
||||||
|
$tab[] = substr($date, 6, 4);
|
||||||
|
$tab[] = substr($date, 3, 2);
|
||||||
|
$tab[] = substr($date, 0, 2);
|
||||||
|
$tab[] = $line->doc_ref;
|
||||||
|
//Conversion de chaine UTF8 en Latin9
|
||||||
|
$tab[] = mb_convert_encoding(str_replace(' - Compte auxiliaire', '', $line->label_operation), "Windows-1252", 'UTF-8');
|
||||||
|
|
||||||
|
//Calcul de la longueur des numéros de comptes
|
||||||
|
$taille_numero = strlen(length_accountg($line->numero_compte));
|
||||||
|
|
||||||
|
//Création du numéro de client générique
|
||||||
|
$numero_cpt_client = '411';
|
||||||
|
for ($i = 1; $i <= ($taille_numero - 3); $i++) {
|
||||||
|
$numero_cpt_client .= '0';
|
||||||
|
}
|
||||||
|
|
||||||
|
//Création des comptes auxiliaire des clients
|
||||||
|
if (length_accountg($line->numero_compte) == $numero_cpt_client) {
|
||||||
|
$tab[] = rtrim(length_accounta($line->subledger_account), "0");
|
||||||
|
} else {
|
||||||
|
$tab[] = length_accountg($line->numero_compte);
|
||||||
|
}
|
||||||
|
$nom_client = explode(" - ", $line->label_operation);
|
||||||
|
$tab[] = mb_convert_encoding($nom_client[0], "Windows-1252", 'UTF-8');
|
||||||
|
$tab[] = price($line->debit);
|
||||||
|
$tab[] = price($line->credit);
|
||||||
|
$tab[] = price($line->montant);
|
||||||
|
$tab[] = $line->code_journal;
|
||||||
|
|
||||||
|
$separator = $this->separator;
|
||||||
|
print implode($separator, $tab) . $this->end_line;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* trunc
|
* trunc
|
||||||
*
|
*
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user