dolibarr 25.0.0-alpha
chargesociales.class.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2016-2026 Frédéric France <frederic.france@free.fr>
5 * Copyright (C) 2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
6 * Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
7 * Copyright (C) 2024-2026 MDW <mdeweerd@users.noreply.github.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
28require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
29
30
36{
40 public $element = 'chargesociales';
41
47 public $table = 'chargesociales';
48
52 public $table_element = 'chargesociales';
53
57 public $picto = 'bill';
58
62 protected $table_ref_field = 'ref';
63
67 public $date_ech;
68
72 public $label;
73
77 public $type;
78
82 public $type_label;
83
87 public $type_code;
88
92 public $type_accountancy_code;
93
97 public $amount;
98
102 public $paye;
103
108 public $periode;
109
113 public $period;
114
119 public $lib;
120
124 public $fk_account;
125
129 public $accountid;
130
134 public $paiementtype;
135
139 public $mode_reglement_id;
140
144 public $mode_reglement_code;
145
149 public $mode_reglement;
150
154 public $fk_project;
155
159 public $fk_user;
160
164 public $total;
165
169 public $totalpaid;
170
174 const STATUS_UNPAID = 0;
175
179 const STATUS_PAID = 1;
180
181
187 public function __construct(DoliDB $db)
188 {
189 $this->db = $db;
190 }
191
199 public function fetch($id, $ref = '')
200 {
201 $sql = "SELECT cs.rowid, cs.date_ech";
202 $sql .= ", cs.libelle as label, cs.fk_type, cs.amount, cs.fk_projet as fk_project, cs.paye, cs.periode as period, cs.import_key";
203 $sql .= ", cs.fk_account, cs.fk_mode_reglement, cs.fk_user, note_public, note_private";
204 $sql .= ", c.libelle as type_label, c.code as type_code, c.accountancy_code as type_accountancy_code";
205 $sql .= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle';
206 $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as cs";
207 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as c ON cs.fk_type = c.id";
208 $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON cs.fk_mode_reglement = p.id';
209 $sql .= ' WHERE cs.entity IN ('.getEntity('tax').')';
210 if ($ref) {
211 $sql .= " AND cs.ref = '".$this->db->escape($ref)."'";
212 } else {
213 $sql .= " AND cs.rowid = ".((int) $id);
214 }
215
216 dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
217 $resql = $this->db->query($sql);
218 if ($resql) {
219 if ($this->db->num_rows($resql)) {
220 $obj = $this->db->fetch_object($resql);
221
222 $this->id = $obj->rowid;
223 $this->ref = $obj->rowid;
224 $this->date_ech = $this->db->jdate($obj->date_ech);
225 $this->lib = $obj->label;
226 $this->label = $obj->label;
227 $this->type = $obj->fk_type;
228 $this->type_label = $obj->type_label;
229 $this->type_code = $obj->type_code;
230 $this->type_accountancy_code = $obj->type_accountancy_code;
231 $this->fk_account = $obj->fk_account;
232 $this->mode_reglement_id = $obj->fk_mode_reglement;
233 $this->mode_reglement_code = $obj->mode_reglement_code;
234 $this->mode_reglement = $obj->mode_reglement_libelle;
235 $this->amount = $obj->amount;
236 $this->fk_project = $obj->fk_project;
237 $this->fk_user = $obj->fk_user;
238 $this->note_public = $obj->note_public;
239 $this->note_private = $obj->note_private;
240 $this->paye = $obj->paye;
241 $this->periode = $this->db->jdate($obj->period);
242 $this->period = $this->db->jdate($obj->period);
243 $this->import_key = $obj->import_key;
244
245 $this->db->free($resql);
246
247 return 1;
248 } else {
249 return 0;
250 }
251 } else {
252 $this->error = $this->db->lasterror();
253 return -1;
254 }
255 }
256
262 public function check()
263 {
264 $newamount = price2num($this->amount, 'MT');
265
266 // Validation of parameters
267 if ($newamount == 0 || empty($this->date_ech) || (empty($this->period) && empty($this->periode))) {
268 return false;
269 }
270
271 return true;
272 }
273
280 public function create($user)
281 {
282 global $conf;
283 $error = 0;
284
285 $now = dol_now();
286
287 // Nettoyage parameters
288 $newamount = price2num($this->amount, 'MT');
289
290 if (!$this->check()) {
291 $this->error = "ErrorBadParameter";
292 return -2;
293 }
294
295 $this->db->begin();
296
297 $sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, fk_account, fk_mode_reglement, libelle, date_ech, periode, amount, fk_projet, entity, fk_user_author, fk_user, date_creation)";
298 $sql .= " VALUES (".((int) $this->type);
299 $sql .= ", ".($this->fk_account > 0 ? ((int) $this->fk_account) : 'NULL');
300 $sql .= ", ".($this->mode_reglement_id > 0 ? ((int) $this->mode_reglement_id) : "NULL");
301 $sql .= ", '".$this->db->escape($this->label ? $this->label : $this->lib)."'";
302 $sql .= ", '".$this->db->idate($this->date_ech)."'";
303 $sql .= ", '".$this->db->idate($this->period)."'";
304 $sql .= ", '".price2num($newamount)."'";
305 $sql .= ", ".($this->fk_project > 0 ? ((int) $this->fk_project) : 'NULL');
306 $sql .= ", ".((int) $conf->entity);
307 $sql .= ", ".((int) $user->id);
308 $sql .= ", ".($this->fk_user > 0 ? ((int) $this->fk_user) : 'NULL');
309 $sql .= ", '".$this->db->idate($now)."'";
310 $sql .= ")";
311
312 dol_syslog(get_class($this)."::create", LOG_DEBUG);
313 $resql = $this->db->query($sql);
314 if ($resql) {
315 $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."chargesociales");
316
317 //dol_syslog("ChargesSociales::create this->id=".$this->id);
318 $result = $this->call_trigger('SOCIALCONTRIBUTION_CREATE', $user);
319 if ($result < 0) {
320 $error++;
321 }
322
323 if (empty($error)) {
324 $this->db->commit();
325 return $this->id;
326 } else {
327 $this->db->rollback();
328 return -1 * $error;
329 }
330 } else {
331 $this->error = $this->db->error();
332 $this->db->rollback();
333 return -1;
334 }
335 }
336
337
338 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
344 public function is_erasable()
345 {
346 // phpcs:enable
347 $totalpaid = $this->getSommePaiement();
348 if ($totalpaid < 0) {
349 return -1;
350 }
351 return (empty($totalpaid) ? 1 : 0);
352 }
353
361 public function delete($user, $notrigger = 0)
362 {
363 $error = 0;
364
365 if ($this->is_erasable() <= 0) {
366 $this->error = 'ErrorRecordHasChildren';
367 return -1;
368 }
369
370 $this->db->begin();
371
372 // Get bank transaction lines for this social contributions
373 include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
374 $account = new Account($this->db);
375 $lines_url = $account->get_url(0, $this->id, 'sc');
376
377 // Delete bank urls
378 foreach ($lines_url as $line_url) {
379 if (!$error) {
380 $accountline = new AccountLine($this->db);
381 $accountline->fetch($line_url['fk_bank']);
382 $result = $accountline->delete_urls($user);
383 if ($result < 0) {
384 $error++;
385 }
386 }
387 }
388
389 // Delete payments
390 if (!$error) {
391 $sql = "DELETE FROM ".MAIN_DB_PREFIX."paiementcharge WHERE fk_charge=".((int) $this->id);
392 dol_syslog(get_class($this)."::delete", LOG_DEBUG);
393 $resql = $this->db->query($sql);
394 if (!$resql) {
395 $error++;
396 $this->error = $this->db->lasterror();
397 }
398 }
399
400 if (!$error) {
401 $sql = "DELETE FROM ".MAIN_DB_PREFIX."chargesociales WHERE rowid=".((int) $this->id);
402 dol_syslog(get_class($this)."::delete", LOG_DEBUG);
403 $resql = $this->db->query($sql);
404 if (!$resql) {
405 $error++;
406 $this->error = $this->db->lasterror();
407 }
408 }
409
410 if (!$error && !$notrigger) {
411 // Call trigger
412 $result = $this->call_trigger('SOCIALCONTRIBUTION_DELETE', $user);
413 if ($result < 0) {
414 $error++;
415 }
416 // End call triggers
417 }
418
419 if (!$error) {
420 $this->db->commit();
421 return 1;
422 } else {
423 $this->db->rollback();
424 return -1;
425 }
426 }
427
428
436 public function update($user, $notrigger = 0)
437 {
438 $error = 0;
439 $this->db->begin();
440
441 $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales";
442 $sql .= " SET libelle = '".$this->db->escape($this->label ? $this->label : $this->lib)."'";
443 $sql .= ", date_ech = '".$this->db->idate($this->date_ech)."'";
444 $sql .= ", periode = '".$this->db->idate($this->period ? $this->period : $this->periode)."'";
445 $sql .= ", amount = ".((float) price2num($this->amount, 'MT'));
446 $sql .= ", fk_projet=".($this->fk_project > 0 ? ((int) $this->fk_project) : "NULL");
447 $sql .= ", fk_user=".($this->fk_user > 0 ? ((int) $this->fk_user) : "NULL");
448 $sql .= ", fk_user_modif=".((int) $user->id);
449 if ($this->type > 0) {
450 $sql .= ", fk_type = ".((int) $this->type);
451 }
452 $sql .= " WHERE rowid=".((int) $this->id);
453
454 dol_syslog(get_class($this)."::update", LOG_DEBUG);
455 $resql = $this->db->query($sql);
456
457 if (!$resql) {
458 $error++;
459 $this->errors[] = "Error ".$this->db->lasterror();
460 }
461
462 if (!$error) {
463 if (!$notrigger) {
464 // Call trigger
465 $result = $this->call_trigger('SOCIALCONTRIBUTION_MODIFY', $user);
466 if ($result < 0) {
467 $error++;
468 }
469 // End call triggers
470 }
471 }
472
473 // Commit or rollback
474 if ($error) {
475 foreach ($this->errors as $errmsg) {
476 dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
477 $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
478 }
479 $this->db->rollback();
480 return -1 * $error;
481 } else {
482 $this->db->commit();
483 return 1;
484 }
485 }
486
493 public function solde($year = 0)
494 {
495 global $conf;
496
497 $sql = "SELECT SUM(f.amount) as amount";
498 $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as f";
499 $sql .= " WHERE f.entity = ".((int) $conf->entity);
500 $sql .= " AND paye = 0";
501
502 if ($year) { // TODO Fix to use date function
503 $sql .= " AND f.datev >= '".((int) $year)."-01-01' AND f.datev <= '".((int) $year)."-12-31' ";
504 }
505
506 $result = $this->db->query($sql);
507 if ($result) {
508 if ($this->db->num_rows($result)) {
509 $obj = $this->db->fetch_object($result);
510 $this->db->free($result);
511 return $obj->amount;
512 } else {
513 return 0;
514 }
515 } else {
516 print $this->db->error();
517 return -1;
518 }
519 }
520
521 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
530 public function set_paid($user)
531 {
532 // phpcs:enable
533 dol_syslog(get_class($this)."::set_paid is deprecated, use setPaid instead", LOG_NOTICE);
534 return $this->setPaid($user);
535 }
536
543 public function setPaid($user)
544 {
545 $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET";
546 $sql .= " paye = 1";
547 $sql .= " WHERE rowid = ".((int) $this->id);
548
549 $return = $this->db->query($sql);
550
551 if ($return) {
552 $this->paye = 1;
553
554 return 1;
555 } else {
556 return -1;
557 }
558 }
559
560 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
569 public function set_unpaid($user)
570 {
571 // phpcs:enable
572 dol_syslog(get_class($this)."::set_unpaid is deprecated, use setUnpaid instead", LOG_NOTICE);
573 return $this->setUnpaid($user);
574 }
575
582 public function setUnpaid($user)
583 {
584 $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET";
585 $sql .= " paye = 0";
586 $sql .= " WHERE rowid = ".((int) $this->id);
587
588 $return = $this->db->query($sql);
589
590 if ($return) {
591 $this->paye = 0;
592
593 return 1;
594 } else {
595 return -1;
596 }
597 }
598
606 public function getLibStatut($mode = 0, $alreadypaid = -1)
607 {
608 return $this->LibStatut($this->paye, $mode, $alreadypaid);
609 }
610
611 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
620 public function LibStatut($status, $mode = 0, $alreadypaid = -1)
621 {
622 // phpcs:enable
623 global $langs;
624
625 // Load translation files required by the page
626 $langs->loadLangs(array("customers", "bills"));
627
628 // We reinit status array to force to redefine them because label may change according to properties values.
629 $this->labelStatus = array();
630 $this->labelStatusShort = array();
631
632 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
633 global $langs;
634 //$langs->load("mymodule");
635 $this->labelStatus[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv('Unpaid');
636 $this->labelStatus[self::STATUS_PAID] = $langs->transnoentitiesnoconv('Paid');
637 if ($status == self::STATUS_UNPAID && $alreadypaid > 0) {
638 $this->labelStatus[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv("BillStatusStarted");
639 }
640 $this->labelStatusShort[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv('Unpaid');
641 $this->labelStatusShort[self::STATUS_PAID] = $langs->transnoentitiesnoconv('Paid');
642 if ($status == self::STATUS_UNPAID && $alreadypaid > 0) {
643 $this->labelStatusShort[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv("BillStatusStarted");
644 }
645 }
646
647 $statusType = 'status1';
648 if ($status == 0 && $alreadypaid > 0) {
649 $statusType = 'status3';
650 }
651 if ($status == 1) {
652 $statusType = 'status6';
653 }
654
655 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
656 }
657
658
670 public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $short = 0, $save_lastsearch_value = -1, $addlinktonotes = 0)
671 {
672 global $langs, $conf, $user, $hookmanager;
673
674 if (!empty($conf->dol_no_mouse_hover)) {
675 $notooltip = 1; // Force disable tooltips
676 }
677
678 $result = '';
679
680 $url = DOL_URL_ROOT.'/compta/sociales/card.php?id='.$this->id;
681
682 if ($short) {
683 return $url;
684 }
685
686 if ($option !== 'nolink') {
687 // Add param to save lastsearch_values or not
688 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
689 if ($save_lastsearch_value == -1 && isset($_SERVER["PHP_SELF"]) && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
690 $add_save_lastsearch_values = 1;
691 }
692 if ($add_save_lastsearch_values) {
693 $url .= '&save_lastsearch_values=1';
694 }
695 }
696
697 if (empty($this->ref)) {
698 $this->ref = $this->label;
699 }
700
701 $label = img_picto('', $this->picto, 'class="pictofixedwidth"').'<u class="paddingrightonly">'.$langs->trans("SocialContribution").'</u>';
702 if (isset($this->paye)) {
703 $label .= ' '.$this->getLibStatut(5);
704 }
705 if (!empty($this->id)) {
706 $label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->id;
707 }
708 if (!empty($this->label)) {
709 $label .= '<br><b>'.$langs->trans('Label').':</b> '.$this->label;
710 }
711 if (!empty($this->type_label)) {
712 $label .= '<br><b>'.$langs->trans('Type').':</b> '.$this->type_label;
713 if (isModEnabled('accounting') || !empty($this->type_accountancy_code)) {
714 include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
715 $label .= ' <span class="opacitymedium">('.$langs->trans('AccountancyCode').': '.(empty($this->type_accountancy_code) ? $langs->trans("Unknown") : length_accountg($this->type_accountancy_code)).')</span>';
716 }
717 }
718
719 $linkclose = '';
720 if (empty($notooltip) && $user->hasRight("facture", "read")) {
721 if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
722 $label = $langs->trans("SocialContribution");
723 $linkclose .= ' alt="'.dolPrintHTMLForAttribute($label).'"';
724 }
725 $linkclose .= ' title="'.dolPrintHTMLForAttribute($label).'"';
726 $linkclose .= ' class="classfortooltip"';
727 }
728
729 $linkstart = '<a href="'.$url.'"';
730 $linkstart .= $linkclose.'>';
731 $linkend = '</a>';
732
733 $result .= $linkstart;
734 if ($withpicto) {
735 $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
736 }
737 if ($withpicto != 2) {
738 $result .= $this->ref;
739 }
740 $result .= $linkend;
741
742 if ($addlinktonotes) {
743 $txttoshow = ($user->socid > 0 ? $this->note_public : $this->note_private);
744 if ($txttoshow) {
745 $notetoshow = $langs->trans("ViewPrivateNote").':<br>'.$txttoshow;
746 $result .= ' <span class="note inline-block">';
747 $result .= '<a href="'.DOL_URL_ROOT.'/compta/sociales/note.php?id='.$this->id.'" class="classfortooltip" title="'.dolPrintHTMLForAttribute($notetoshow).'">';
748 $result .= img_picto('', 'note');
749 $result .= '</a>';
750 $result .= '</span>';
751 }
752 }
753
754 global $action;
755 $hookmanager->initHooks(array($this->element . 'dao'));
756 $parameters = array('id' => $this->id, 'getnomurl' => &$result);
757 $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
758 if ($reshook > 0) {
759 $result = $hookmanager->resPrint;
760 } else {
761 $result .= $hookmanager->resPrint;
762 }
763
764 return $result;
765 }
766
772 public function getSommePaiement()
773 {
774 $sql = 'SELECT sum(amount) as amount';
775 $sql .= ' FROM '.MAIN_DB_PREFIX.'paiementcharge';
776 $sql .= " WHERE fk_charge = ".((int) $this->id);
777
778 dol_syslog(get_class($this)."::getSommePaiement", LOG_DEBUG);
779 $resql = $this->db->query($sql);
780 if ($resql) {
781 $amount = 0;
782
783 $obj = $this->db->fetch_object($resql);
784 if ($obj) {
785 $amount = $obj->amount ? $obj->amount : 0;
786 }
787
788 $this->db->free($resql);
789 return $amount;
790 } else {
791 return -1;
792 }
793 }
794
801 public function info($id)
802 {
803 $sql = "SELECT e.rowid, e.tms as datem, e.date_creation as datec, e.date_valid as datev, e.import_key,";
804 $sql .= " e.fk_user_author, e.fk_user_modif, e.fk_user_valid";
805 $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as e";
806 $sql .= " WHERE e.rowid = ".((int) $id);
807
808 dol_syslog(get_class($this)."::info", LOG_DEBUG);
809 $result = $this->db->query($sql);
810 if ($result) {
811 if ($this->db->num_rows($result)) {
812 $obj = $this->db->fetch_object($result);
813
814 $this->id = $obj->rowid;
815
816 $this->user_creation_id = $obj->fk_user_author;
817 $this->user_modification_id = $obj->fk_user_modif;
818 $this->user_validation_id = $obj->fk_user_valid;
819 $this->date_creation = $this->db->jdate($obj->datec);
820 $this->date_modification = $this->db->jdate($obj->datem);
821 $this->date_validation = $this->db->jdate($obj->datev);
822 $this->import_key = $obj->import_key;
823 }
824
825 $this->db->free($result);
826 return 1;
827 } else {
828 dol_print_error($this->db);
829 return -1;
830 }
831 }
832
840 public function initAsSpecimen()
841 {
842 // Initialize parameters
843 $this->id = 0;
844 $this->ref = 'SPECIMEN';
845 $this->specimen = 1;
846 $this->paye = 0;
847 $this->date_creation = dol_now();
848 $this->date_ech = $this->date_creation + 3600 * 24 * 30;
849 $this->periode = $this->date_creation + 3600 * 24 * 30;
850 $this->period = $this->date_creation + 3600 * 24 * 30;
851 $this->amount = 100;
852 $this->label = 'Social contribution label';
853 $this->type = 1;
854 $this->type_label = 'Type of social contribution';
855
856 return 1;
857 }
858
866 public function getKanbanView($option = '', $arraydata = null)
867 {
868 global $conf, $langs;
869
870 $selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
871
872 $return = '<div class="box-flex-item box-flex-grow-zero">';
873 $return .= '<div class="info-box info-box-sm">';
874 $return .= '<span class="info-box-icon bg-infobox-action">';
875 $return .= img_picto('', $this->picto);
876 $return .= '</span>';
877 $return .= '<div class="info-box-content">';
878 $return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(0) : $this->ref).'</span>';
879 if ($selected >= 0) {
880 $return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
881 }
882 if (property_exists($this, 'label')) {
883 $return .= ' &nbsp; <div class="inline-block opacitymedium valignmiddle tdoverflowmax100">'.$this->label.'</div>';
884 }
885 if (!empty($arraydata['project']) && $arraydata['project'] instanceof Project && $arraydata['project']->id > 0) {
886 $return .= '<br><span class="info-box-label">'.$arraydata['project']->getNomUrl(1).'</span>';
887 }
888 if (property_exists($this, 'date_ech')) {
889 $return .= '<br><span class="opacitymedium">'.$langs->trans("Date").'</span> : <span class="info-box-label">'.dol_print_date($this->date_ech, 'day').'</span>';
890 }
891 if (property_exists($this, 'amount')) {
892 $return .= '<br>';
893 $return .= '<span class="info-box-label amount">'.price($this->amount, 0, $langs, 1, -1, -1, $conf->currency).'</span>';
894 }
895 if (method_exists($this, 'LibStatut')) {
896 $return .= '<br><div class="info-box-status">'.$this->getLibStatut(3, (float) $this->totalpaid).'</div>';
897 }
898 $return .= '</div>';
899 $return .= '</div>';
900 $return .= '</div>';
901 return $return;
902 }
903}
length_accountg($account)
Return General accounting account with defined length (used for product and miscellaneous)
$propal type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...
Definition propal.php:280
$object ref
Definition info.php:90
Class to manage bank accounts.
Class to manage bank transaction lines.
Class for managing the social charges.
is_erasable()
Return if a social contribution can be deleted: not once a payment exists, as for invoices.
LibStatut($status, $mode=0, $alreadypaid=-1)
Renvoi le libelle d'un statut donne.
__construct(DoliDB $db)
Constructor.
setUnpaid($user)
Remove tag paid on social contribution.
initAsSpecimen()
Initialise an instance with random values.
check()
Check if a social contribution can be created into database.
getKanbanView($option='', $arraydata=null)
Return clickable link of object (with eventually picto)
getSommePaiement()
Return amount of payments already done.
solde($year=0)
Calculate amount remaining to pay by year.
fetch($id, $ref='')
Retrouve et charge une charge sociale.
getNomUrl($withpicto=0, $option='', $notooltip=0, $short=0, $save_lastsearch_value=-1, $addlinktonotes=0)
Return a link to the object card (with optionally the picto)
update($user, $notrigger=0)
Update social or fiscal contribution.
set_unpaid($user)
Remove tag paid on social contribution.
set_paid($user)
Tag social contribution as paid completely.
info($id)
Charge l'information d'ordre info dans l'objet entrepot.
create($user)
Create a social contribution into database.
getLibStatut($mode=0, $alreadypaid=-1)
Retourne le libelle du statut d'une charge (impaye, payee)
setPaid($user)
Tag social contribution as paid completely.
Class to manage Dolibarr database access.
Class to manage projects.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
dol_now($mode='gmt')
Return date for now.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
print $langs trans('Date')." left Ref Label right Qty right Price right TotalHT right TotalTTC right right right right right right right right right centpercent right TotalHT right n right VAT right n right TotalVAT right n No sujeto a RE IRPF right TotalLT1 right n right TotalLT2 right n right TotalTTC right n takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency right TotalTTC takeposcustomercurrency right takeposcustomercurrency n right Paid right PaymentTypeShortLIQ right SELECT p pos_change as p datep as p p num_paiement as f pf amount as amount
Definition receipt.php:494