Commit 60b72b8460f9c202c03ec77bdc14dc04d9a40bc1

Authored by aspangaro
1 parent 878568cd
Exists in 3.5 and in 1 other branch 3.6

Presentation code

Showing 1 changed file with 100 additions and 89 deletions   Show diff stats
accountingex/journal/sellsjournal.php
... ... @@ -23,9 +23,9 @@
23 23 */
24 24  
25 25 /**
26   - * \file accountingex/journal/sellsjournal.php
27   - * \ingroup Accounting Expert
28   - * \brief Page with sells journal
  26 + * \file accountingex/journal/sellsjournal.php
  27 + * \ingroup Accounting Expert
  28 + * \brief Page with sells journal
29 29 */
30 30  
31 31 // Dolibarr environment
... ... @@ -292,129 +292,140 @@ if ($action == 'export_csv') {
292 292  
293 293 $companystatic = new Client($db);
294 294  
295   - // Tiers
296   -
297   - foreach ( $tabfac as $key => $val ) {
298   - $companystatic->id = $tabcompany[$key]['id'];
299   - $companystatic->name = $tabcompany[$key]['name'];
300   - $companystatic->client = $tabcompany[$key]['code_client'];
  295 + foreach ( $tabfac as $key => $val )
  296 + {
  297 + $companystatic->id = $tabcompany[$key]['id'];
  298 + $companystatic->name = $tabcompany[$key]['name'];
  299 + $companystatic->client = $tabcompany[$key]['code_client'];
301 300  
302   - $date = dol_print_date($db->jdate($val["date"]), $conf->global->ACCOUNTINGEX_EXP_DATE);
  301 + $date = dol_print_date($db->jdate($val["date"]), $conf->global->ACCOUNTINGEX_EXP_DATE);
303 302  
304   - print $date . $sep;
305   - print $conf->global->ACCOUNTINGEX_SELL_JOURNAL . $sep;
  303 + print $date . $sep;
  304 + print $conf->global->ACCOUNTINGEX_SELL_JOURNAL . $sep;
306 305  
307   - if ($conf->global->ACCOUNTINGEX_EXP_GLOBAL_ACCOUNT == 1)
308   - {
  306 + if ($conf->global->ACCOUNTINGEX_EXP_GLOBAL_ACCOUNT == 1)
  307 + {
309 308 print length_accountg($conf->global->COMPTA_ACCOUNT_CUSTOMER) . $sep;
310   - }
311   - foreach ( $tabttc[$key] as $k => $mt ) {
312   - print length_accounta(html_entity_decode($k)) . $sep;
313   -
314   - if ($conf->global->ACCOUNTINGEX_EXP_AMOUNT == 1)
315   - {
  309 + }
  310 +
  311 + // Thirdparty
  312 + foreach ( $tabttc[$key] as $k => $mt ) {
  313 + print length_accounta(html_entity_decode($k)) . $sep;
  314 +
  315 + if ($conf->global->ACCOUNTINGEX_EXP_AMOUNT == 1)
  316 + {
316 317 print ($mt < 0 ? 'C' : 'D') . $sep;
317 318 print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
318   - }else {
  319 + }
  320 + else
  321 + {
319 322 print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
320 323 print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
321   - }
322   -
323   -
324   -
325   - print utf8_decode($companystatic->name) . $sep;
326 324 }
327   - print $val["ref"];
328   - print "\n";
  325 +
  326 + print utf8_decode($companystatic->name) . $sep;
  327 + }
329 328  
330   - // Product / Service
  329 + print $val["ref"];
  330 + print "\n";
331 331  
  332 + // Product / Service
332 333 foreach ( $tabht[$key] as $k => $mt ) {
333   - $date = dol_print_date($db->jdate($val["date"]), $conf->global->ACCOUNTINGEX_EXP_DATE);
  334 + $date = dol_print_date($db->jdate($val["date"]), $conf->global->ACCOUNTINGEX_EXP_DATE);
334 335  
335   - if (is_array($mt) && count($mt)>0 && empty($conf->global->ACCOUNTINGEX_GROUPBYACCOUNT)) {
336   - foreach($mt as $lineid=>$amountline) {
337   - if ($amountline) {
338   - print $date . $sep;
339   - print $conf->global->ACCOUNTINGEX_SELL_JOURNAL . $sep;
340   - if ($conf->global->ACCOUNTINGEX_EXP_GLOBAL_ACCOUNT == 1)
341   - {
342   - print $sep;
343   - }
344   - print length_accountg(html_entity_decode($k)) . $sep;
345   - print $sep;
346   -
347   - if ($conf->global->ACCOUNTINGEX_EXP_AMOUNT == 1)
348   - {
349   - print ($amountline < 0 ? 'D' : 'C') . $sep;
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   -
358   - print dol_trunc($val["description"][$lineid], 32) . $sep;
359   - print $val["ref"];
360   - print "\n";
361   - }
362   - }
363   - } else {
364   - if ($mt) {
  336 + if (is_array($mt) && count($mt)>0 && empty($conf->global->ACCOUNTINGEX_GROUPBYACCOUNT)) {
  337 +
  338 + foreach($mt as $lineid=>$amountline) {
  339 + if ($amountline) {
365 340 print $date . $sep;
366 341 print $conf->global->ACCOUNTINGEX_SELL_JOURNAL . $sep;
367 342 if ($conf->global->ACCOUNTINGEX_EXP_GLOBAL_ACCOUNT == 1)
368   - {
369   - print $sep;
370   - }
  343 + {
  344 + print $sep;
  345 + }
  346 +
371 347 print length_accountg(html_entity_decode($k)) . $sep;
372 348 print $sep;
373   -
374   -
  349 +
375 350 if ($conf->global->ACCOUNTINGEX_EXP_AMOUNT == 1)
376   - {
377   - print ($mt < 0 ? 'D' : 'C') . $sep;
378   - print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
379   - }else {
380   - print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
381   - print '"' . ($mt >= 0 ? price($mt) : '') . '"';
  351 + {
  352 + print ($amountline < 0 ? 'D' : 'C') . $sep;
  353 + print ($amountline <= 0 ? price(- $amountline) : $amountline) . $sep;
382 354 }
383   -
384   - print dol_trunc($val["description"], 32) . $sep;
  355 + else
  356 + {
  357 + print '"' . ($amountline < 0 ? price(- $amountline) : '') . '"' . $sep;
  358 + print '"' . ($amountline >= 0 ? price($amountline) : '') . '"';
  359 + }
  360 +
  361 + print dol_trunc($val["description"][$lineid], 32) . $sep;
385 362 print $val["ref"];
386 363 print "\n";
387 364 }
388 365 }
389   - }
390   -
391   - // TVA
392   - foreach ( $tabtva[$key] as $k => $mt ) {
393   - $date = dol_print_date($db->jdate($val["date"]), $conf->global->ACCOUNTINGEX_EXP_DATE);
  366 + }
  367 + else
  368 + {
394 369 if ($mt) {
395 370 print $date . $sep;
396 371 print $conf->global->ACCOUNTINGEX_SELL_JOURNAL . $sep;
  372 +
397 373 if ($conf->global->ACCOUNTINGEX_EXP_GLOBAL_ACCOUNT == 1)
398   - {
399   - print $sep;
400   - }
  374 + {
  375 + print $sep;
  376 + }
  377 +
401 378 print length_accountg(html_entity_decode($k)) . $sep;
402 379 print $sep;
403   -
  380 +
404 381 if ($conf->global->ACCOUNTINGEX_EXP_AMOUNT == 1)
  382 + {
  383 + print ($mt < 0 ? 'D' : 'C') . $sep;
  384 + print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
  385 + }
  386 + else
  387 + {
  388 + print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
  389 + print '"' . ($mt >= 0 ? price($mt) : '') . '"';
  390 + }
  391 +
  392 + print dol_trunc($val["description"], 32) . $sep;
  393 + print $val["ref"];
  394 + print "\n";
  395 + }
  396 + }
  397 + }
  398 +
  399 + // TVA
  400 + foreach ( $tabtva[$key] as $k => $mt ) {
  401 + $date = dol_print_date($db->jdate($val["date"]), $conf->global->ACCOUNTINGEX_EXP_DATE);
  402 + if ($mt) {
  403 + print $date . $sep;
  404 + print $conf->global->ACCOUNTINGEX_SELL_JOURNAL . $sep;
  405 + if ($conf->global->ACCOUNTINGEX_EXP_GLOBAL_ACCOUNT == 1)
  406 + {
  407 + print $sep;
  408 + }
  409 +
  410 + print length_accountg(html_entity_decode($k)) . $sep;
  411 + print $sep;
  412 +
  413 + if ($conf->global->ACCOUNTINGEX_EXP_AMOUNT == 1)
405 414 {
406 415 print ($mt < 0 ? 'D' : 'C') . $sep;
407 416 print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
408   - }else {
  417 + }
  418 + else
  419 + {
409 420 print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
410 421 print '"' . ($mt >= 0 ? price($mt) : '') . '"';
411   - }
412   -
413   - print $langs->trans("VAT") . $sep;
414   - print $val["ref"];
415   - print "\n";
416 422 }
417   - }
  423 +
  424 + print $langs->trans("VAT") . $sep;
  425 + print $val["ref"];
  426 + print "\n";
  427 + }
  428 + }
418 429 }
419 430 } else {
420 431  
... ...