Commit 07dedf983c67d61d9f2ab6c281537749e095a405

Authored by Darkjeff
1 parent 3ba75f18
Exists in 3.5 and in 1 other branch 3.6

sales journal beta export

accountingex/journal/sellsjournal.php
... ... @@ -71,7 +71,7 @@ if (! $user->rights->accountingex->access)
71 71 $action = GETPOST('action');
72 72  
73 73 /*
74   - * View
  74 + * View sql
75 75 */
76 76  
77 77 $year_current = strftime("%Y", dol_now());
... ... @@ -156,7 +156,7 @@ if ($result) {
156 156 $resultcompte=$compte->fetch($obj->fk_compte);
157 157  
158 158 if ($resultcompte) {
159   - $tabfac[$obj->rowid]["description"] = $compte->label;
  159 + $tabfac[$obj->rowid]["description"] = $obj->label_compte;
160 160 }
161 161 } else {
162 162 $tabfac[$obj->rowid]["description"][$obj->fdid]= $obj->description;
... ... @@ -292,38 +292,69 @@ if ($action == 'export_csv') {
292 292  
293 293 $companystatic = new Client($db);
294 294  
295   - if ($conf->global->ACCOUNTINGEX_MODELCSV == 2) // Modèle Export Cegid Expert
296   - {
297   - foreach ( $tabfac as $key => $val ) {
  295 + // Tiers
  296 +
  297 + foreach ( $tabfac as $key => $val ) {
298 298 $companystatic->id = $tabcompany[$key]['id'];
299 299 $companystatic->name = $tabcompany[$key]['name'];
300 300 $companystatic->client = $tabcompany[$key]['code_client'];
301 301  
302 302 $date = dol_print_date($db->jdate($val["date"]), $conf->global->ACCOUNTINGEX_EXP_DATE);
303   -
304   - print $date . $sep;
  303 +
  304 + print $date . $sep;
305 305 print $conf->global->ACCOUNTINGEX_SELL_JOURNAL . $sep;
  306 +
  307 + if ($conf->global->ACCOUNTINGEX_EXP_GLOBAL_ACCOUNT == 1)
  308 + {
306 309 print length_accountg($conf->global->COMPTA_ACCOUNT_CUSTOMER) . $sep;
  310 + }
307 311 foreach ( $tabttc[$key] as $k => $mt ) {
308 312 print length_accounta(html_entity_decode($k)) . $sep;
  313 +
  314 + if ($conf->global->ACCOUNTINGEX_EXP_AMOUNT == 1)
  315 + {
309 316 print ($mt < 0 ? 'C' : 'D') . $sep;
310 317 print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
  318 + }else {
  319 + print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
  320 + print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
  321 + }
  322 +
  323 +
  324 +
311 325 print utf8_decode($companystatic->name) . $sep;
312 326 }
313 327 print $val["ref"];
314 328 print "\n";
315 329  
316   - // Product / Service
317   - foreach ( $tabht[$key] as $k => $mt ) {
  330 + // Product / Service
  331 +
  332 + foreach ( $tabht[$key] as $k => $mt ) {
  333 + $date = dol_print_date($db->jdate($val["date"]), $conf->global->ACCOUNTINGEX_EXP_DATE);
  334 +
318 335 if (is_array($mt) && count($mt)>0 && empty($conf->global->ACCOUNTINGEX_GROUPBYACCOUNT)) {
319 336 foreach($mt as $lineid=>$amountline) {
320 337 if ($amountline) {
321 338 print $date . $sep;
322 339 print $conf->global->ACCOUNTINGEX_SELL_JOURNAL . $sep;
  340 + if ($conf->global->ACCOUNTINGEX_EXP_GLOBAL_ACCOUNT == 1)
  341 + {
  342 + print $sep;
  343 + }
323 344 print length_accountg(html_entity_decode($k)) . $sep;
324 345 print $sep;
  346 +
  347 + if ($conf->global->ACCOUNTINGEX_EXP_AMOUNT == 1)
  348 + {
325 349 print ($amountline < 0 ? 'D' : 'C') . $sep;
326 350 print ($amountline <= 0 ? price(- $amountline) : $amountline) . $sep;
  351 + }else {
  352 + print '"' . ($amountline < 0 ? price(- $amountline) : '') . '"' . $sep;
  353 + print '"' . ($amountline >= 0 ? price($amountline) : '') . '"';
  354 + }
  355 +
  356 +
  357 +
327 358 print dol_trunc($val["description"][$lineid], 32) . $sep;
328 359 print $val["ref"];
329 360 print "\n";
... ... @@ -333,90 +364,57 @@ if ($action == &#39;export_csv&#39;) {
333 364 if ($mt) {
334 365 print $date . $sep;
335 366 print $conf->global->ACCOUNTINGEX_SELL_JOURNAL . $sep;
  367 + if ($conf->global->ACCOUNTINGEX_EXP_GLOBAL_ACCOUNT == 1)
  368 + {
  369 + print $sep;
  370 + }
336 371 print length_accountg(html_entity_decode($k)) . $sep;
337 372 print $sep;
  373 +
  374 +
  375 + if ($conf->global->ACCOUNTINGEX_EXP_AMOUNT == 1)
  376 + {
338 377 print ($mt < 0 ? 'D' : 'C') . $sep;
339 378 print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
  379 + }else {
  380 + print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
  381 + print '"' . ($mt >= 0 ? price($mt) : '') . '"';
  382 + }
  383 +
340 384 print dol_trunc($val["description"], 32) . $sep;
341 385 print $val["ref"];
342 386 print "\n";
343 387 }
344 388 }
345   - }
  389 + }
  390 +
346 391 // TVA
347 392 foreach ( $tabtva[$key] as $k => $mt ) {
  393 + $date = dol_print_date($db->jdate($val["date"]), $conf->global->ACCOUNTINGEX_EXP_DATE);
348 394 if ($mt) {
349 395 print $date . $sep;
350 396 print $conf->global->ACCOUNTINGEX_SELL_JOURNAL . $sep;
  397 + if ($conf->global->ACCOUNTINGEX_EXP_GLOBAL_ACCOUNT == 1)
  398 + {
  399 + print $sep;
  400 + }
351 401 print length_accountg(html_entity_decode($k)) . $sep;
352 402 print $sep;
  403 +
  404 + if ($conf->global->ACCOUNTINGEX_EXP_AMOUNT == 1)
  405 + {
353 406 print ($mt < 0 ? 'D' : 'C') . $sep;
354 407 print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
355   - print $langs->trans("VAT") . $sep;
356   - print $val["ref"];
357   - print "\n";
358   - }
359   - }
360   - }
361   - } else // Modèle Export Classique
362   - {
363   - foreach ( $tabfac as $key => $val ) {
364   - $companystatic->id = $tabcompany[$key]['id'];
365   - $companystatic->name = $tabcompany[$key]['name'];
366   - $companystatic->client = $tabcompany[$key]['code_client'];
367   -
368   - $date = dol_print_date($db->jdate($val["date"]), 'day');
369   - print '"' . $date . '"' . $sep;
370   - print '"' . $val["ref"] . '"' . $sep;
371   - foreach ( $tabttc[$key] as $k => $mt ) {
372   - print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
373   - print '"' . utf8_decode($companystatic->name) . '"' . $sep;
374   - print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
375   - print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
376   - }
377   - print "\n";
378   -
379   - // Product / Service
380   - foreach ( $tabht[$key] as $k => $mt ) {
381   - if (is_array($mt) && count($mt)>0 && empty($conf->global->ACCOUNTINGEX_GROUPBYACCOUNT)) {
382   - foreach($mt as $lineid=>$amountline) {
383   - if ($amountline) {
384   - print '"' . $date . '"' . $sep;
385   - print '"' . $val["ref"] . '"' . $sep;
386   - print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
387   - print '"' . dol_trunc($val["description"][$lineid], 32) . '"' . $sep;
388   - print '"' . ($amountline < 0 ? price(- $amountline) : '') . '"' . $sep;
389   - print '"' . ($amountline >= 0 ? price($amountline) : '') . '"';
390   - print "\n";
391   - }
392   - }
393   - } else {
394   - if ($mt) {
395   - print '"' . $date . '"' . $sep;
396   - print '"' . $val["ref"] . '"' . $sep;
397   - print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
398   - print '"' . dol_trunc($val["description"], 32) . '"' . $sep;
399   - print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
400   - print '"' . ($mt >= 0 ? price($mt) : '') . '"';
401   - print "\n";
402   - }
403   - }
404   - }
405   -
406   - // VAT
407   - // var_dump($tabtva);
408   - foreach ( $tabtva[$key] as $k => $mt ) {
409   - if ($mt) {
410   - print '"' . $date . '"' . $sep;
411   - print '"' . $val["ref"] . '"' . $sep;
412   - print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
413   - print '"' . $langs->trans("VAT") . '"' . $sep;
  408 + }else {
414 409 print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
415 410 print '"' . ($mt >= 0 ? price($mt) : '') . '"';
  411 + }
  412 +
  413 + print $langs->trans("VAT") . $sep;
  414 + print $val["ref"];
416 415 print "\n";
417 416 }
418   - }
419   - }
  417 + }
420 418 }
421 419 } else {
422 420  
... ...
accountingex/langs/en_US/accountingex.lang
... ... @@ -173,4 +173,8 @@ customer_invoice=Customer invoice
173 173 supplier_invoice=Supplier invoice
174 174 GroupByAccount=Group invoice record
175 175  
176   -ACCOUNTINGEX_EXP_DATE=Format export date
177 176 \ No newline at end of file
  177 +ACCOUNTINGEX_EXP_DATE=Format export date
  178 +ACCOUNTINGEX_EXP_GLOBAL_ACCOUNT=Collect account
  179 +ACCOUNTINGEX_EXP_LABEL=Choose description
  180 +ACCOUNTINGEX_EXP_AMOUNT=Show amount/sens ou debit/credit
  181 +ACCOUNTINGEXP_EXP_DEVISE=Show devise
178 182 \ No newline at end of file
... ...
accountingex/langs/fr_FR/accountingex.lang
1   -# Dolibarr language file - fr_FR - Accounting Expert
  1 +# Dolibarr language file - fr_FR - Accounting Expert
2 2 CHARSET=UTF-8
3 3  
4 4 Module150000Name=Comptabilité Expert
... ... @@ -173,4 +173,8 @@ customer_invoice=Facture client
173 173 supplier_invoice=Facture fournisseur
174 174 GroupByAccount=Grouper les écritures de compte
175 175  
176   -ACCOUNTINGEX_EXP_DATE=Format de la date d'export
177 176 \ No newline at end of file
  177 +ACCOUNTINGEX_EXP_DATE=Format de la date d'export
  178 +ACCOUNTINGEX_EXP_GLOBAL_ACCOUNT=Afficher un compte collectif
  179 +ACCOUNTINGEX_EXP_LABEL=Choisir la description
  180 +ACCOUNTINGEX_EXP_AMOUNT=Afficher montant/sens ou debit/credit
  181 +ACCOUNTINGEXP_EXP_DEVISE=Afficher devise
178 182 \ No newline at end of file
... ...