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
45 public $table_element = 'chargesociales';
46
50 public $picto = 'bill';
51
55 protected $table_ref_field = 'ref';
56
60 public $date_ech;
61
65 public $label;
66
70 public $type;
71
75 public $type_label;
76
80 public $type_code;
81
85 public $type_accountancy_code;
86
90 public $amount;
91
95 public $paye;
96
101 public $periode;
102
106 public $period;
107
112 public $lib;
113
117 public $fk_account;
118
122 public $accountid;
123
127 public $paiementtype;
128
132 public $mode_reglement_id;
133
137 public $mode_reglement_code;
138
142 public $mode_reglement;
143
147 public $fk_project;
148
152 public $fk_user;
153
157 public $total;
158
162 public $totalpaid;
163
167 const STATUS_UNPAID = 0;
168
172 const STATUS_PAID = 1;
173
174
180 public function __construct(DoliDB $db)
181 {
182 $this->db = $db;
183 }
184
192 public function fetch($id, $ref = '')
193 {
194 $sql = "SELECT cs.rowid, cs.date_ech";
195 $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";
196 $sql .= ", cs.fk_account, cs.fk_mode_reglement, cs.fk_user, note_public, note_private";
197 $sql .= ", c.libelle as type_label, c.code as type_code, c.accountancy_code as type_accountancy_code";
198 $sql .= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle';
199 $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as cs";
200 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as c ON cs.fk_type = c.id";
201 $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON cs.fk_mode_reglement = p.id';
202 $sql .= ' WHERE cs.entity IN ('.getEntity('tax').')';
203 if ($ref) {
204 $sql .= " AND cs.ref = '".$this->db->escape($ref)."'";
205 } else {
206 $sql .= " AND cs.rowid = ".((int) $id);
207 }
208
209 dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
210 $resql = $this->db->query($sql);
211 if ($resql) {
212 if ($this->db->num_rows($resql)) {
213 $obj = $this->db->fetch_object($resql);
214
215 $this->id = $obj->rowid;
216 $this->ref = $obj->rowid;
217 $this->date_ech = $this->db->jdate($obj->date_ech);
218 $this->lib = $obj->label;
219 $this->label = $obj->label;
220 $this->type = $obj->fk_type;
221 $this->type_label = $obj->type_label;
222 $this->type_code = $obj->type_code;
223 $this->type_accountancy_code = $obj->type_accountancy_code;
224 $this->fk_account = $obj->fk_account;
225 $this->mode_reglement_id = $obj->fk_mode_reglement;
226 $this->mode_reglement_code = $obj->mode_reglement_code;
227 $this->mode_reglement = $obj->mode_reglement_libelle;
228 $this->amount = $obj->amount;
229 $this->fk_project = $obj->fk_project;
230 $this->fk_user = $obj->fk_user;
231 $this->note_public = $obj->note_public;
232 $this->note_private = $obj->note_private;
233 $this->paye = $obj->paye;
234 $this->periode = $this->db->jdate($obj->period);
235 $this->period = $this->db->jdate($obj->period);
236 $this->import_key = $obj->import_key;
237
238 $this->db->free($resql);
239
240 return 1;
241 } else {
242 return 0;
243 }
244 } else {
245 $this->error = $this->db->lasterror();
246 return -1;
247 }
248 }
249
255 public function check()
256 {
257 $newamount = price2num($this->amount, 'MT');
258
259 // Validation of parameters
260 if ($newamount == 0 || empty($this->date_ech) || (empty($this->period) && empty($this->periode))) {
261 return false;
262 }
263
264 return true;
265 }
266
273 public function create($user)
274 {
275 global $conf;
276 $error = 0;
277
278 $now = dol_now();
279
280 // Nettoyage parameters
281 $newamount = price2num($this->amount, 'MT');
282
283 if (!$this->check()) {
284 $this->error = "ErrorBadParameter";
285 return -2;
286 }
287
288 $this->db->begin();
289
290 $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)";
291 $sql .= " VALUES (".((int) $this->type);
292 $sql .= ", ".($this->fk_account > 0 ? ((int) $this->fk_account) : 'NULL');
293 $sql .= ", ".($this->mode_reglement_id > 0 ? ((int) $this->mode_reglement_id) : "NULL");
294 $sql .= ", '".$this->db->escape($this->label ? $this->label : $this->lib)."'";
295 $sql .= ", '".$this->db->idate($this->date_ech)."'";
296 $sql .= ", '".$this->db->idate($this->period)."'"; // Will be '2026-10-31' for example because $this->period was done with dol_mktime(0,0,0,lastday) so value is GMT date when 00:00 in timezone server and idate reconvert GMT date into 00:00.
297 $sql .= ", '".price2num($newamount)."'";
298 $sql .= ", ".($this->fk_project > 0 ? ((int) $this->fk_project) : 'NULL');
299 $sql .= ", ".((int) $conf->entity);
300 $sql .= ", ".((int) $user->id);
301 $sql .= ", ".($this->fk_user > 0 ? ((int) $this->fk_user) : 'NULL');
302 $sql .= ", '".$this->db->idate($now)."'";
303 $sql .= ")";
304
305 dol_syslog(get_class($this)."::create", LOG_DEBUG);
306 $resql = $this->db->query($sql);
307 if ($resql) {
308 $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."chargesociales");
309
310 //dol_syslog("ChargesSociales::create this->id=".$this->id);
311 $result = $this->call_trigger('SOCIALCONTRIBUTION_CREATE', $user);
312 if ($result < 0) {
313 $error++;
314 }
315
316 if (empty($error)) {
317 $this->db->commit();
318 return $this->id;
319 } else {
320 $this->db->rollback();
321 return -1 * $error;
322 }
323 } else {
324 $this->error = $this->db->error();
325 $this->db->rollback();
326 return -1;
327 }
328 }
329
330
331 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
337 public function is_erasable()
338 {
339 // phpcs:enable
340 $totalpaid = $this->getSommePaiement();
341 if ($totalpaid < 0) {
342 return -1;
343 }
344 return (empty($totalpaid) ? 1 : 0);
345 }
346
354 public function delete($user, $notrigger = 0)
355 {
356 $error = 0;
357
358 if ($this->is_erasable() <= 0) {
359 $this->error = 'ErrorRecordHasChildren';
360 return -1;
361 }
362
363 $this->db->begin();
364
365 // Get bank transaction lines for this social contributions
366 include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
367 $account = new Account($this->db);
368 $lines_url = $account->get_url(0, $this->id, 'sc');
369
370 // Delete bank urls
371 foreach ($lines_url as $line_url) {
372 if (!$error) {
373 $accountline = new AccountLine($this->db);
374 $accountline->fetch($line_url['fk_bank']);
375 $result = $accountline->delete_urls($user);
376 if ($result < 0) {
377 $error++;
378 }
379 }
380 }
381
382 // Delete payments
383 if (!$error) {
384 $sql = "DELETE FROM ".MAIN_DB_PREFIX."paiementcharge WHERE fk_charge=".((int) $this->id);
385 dol_syslog(get_class($this)."::delete", LOG_DEBUG);
386 $resql = $this->db->query($sql);
387 if (!$resql) {
388 $error++;
389 $this->error = $this->db->lasterror();
390 }
391 }
392
393 if (!$error) {
394 $sql = "DELETE FROM ".MAIN_DB_PREFIX."chargesociales WHERE rowid=".((int) $this->id);
395 dol_syslog(get_class($this)."::delete", LOG_DEBUG);
396 $resql = $this->db->query($sql);
397 if (!$resql) {
398 $error++;
399 $this->error = $this->db->lasterror();
400 }
401 }
402
403 if (!$error && !$notrigger) {
404 // Call trigger
405 $result = $this->call_trigger('SOCIALCONTRIBUTION_DELETE', $user);
406 if ($result < 0) {
407 $error++;
408 }
409 // End call triggers
410 }
411
412 if (!$error) {
413 $this->db->commit();
414 return 1;
415 } else {
416 $this->db->rollback();
417 return -1;
418 }
419 }
420
421
429 public function update($user, $notrigger = 0)
430 {
431 $error = 0;
432 $this->db->begin();
433
434 $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales";
435 $sql .= " SET libelle = '".$this->db->escape($this->label ? $this->label : $this->lib)."'";
436 $sql .= ", date_ech = '".$this->db->idate($this->date_ech)."'";
437 $sql .= ", periode = '".$this->db->idate($this->period ? $this->period : $this->periode)."'";
438 $sql .= ", amount = ".((float) price2num($this->amount, 'MT'));
439 $sql .= ", fk_projet=".($this->fk_project > 0 ? ((int) $this->fk_project) : "NULL");
440 $sql .= ", fk_user=".($this->fk_user > 0 ? ((int) $this->fk_user) : "NULL");
441 $sql .= ", fk_user_modif=".((int) $user->id);
442 if ($this->type > 0) {
443 $sql .= ", fk_type = ".((int) $this->type);
444 }
445 $sql .= " WHERE rowid=".((int) $this->id);
446
447 dol_syslog(get_class($this)."::update", LOG_DEBUG);
448 $resql = $this->db->query($sql);
449
450 if (!$resql) {
451 $error++;
452 $this->errors[] = "Error ".$this->db->lasterror();
453 }
454
455 if (!$error) {
456 if (!$notrigger) {
457 // Call trigger
458 $result = $this->call_trigger('SOCIALCONTRIBUTION_MODIFY', $user);
459 if ($result < 0) {
460 $error++;
461 }
462 // End call triggers
463 }
464 }
465
466 // Commit or rollback
467 if ($error) {
468 foreach ($this->errors as $errmsg) {
469 dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
470 $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
471 }
472 $this->db->rollback();
473 return -1 * $error;
474 } else {
475 $this->db->commit();
476 return 1;
477 }
478 }
479
486 public function solde($year = 0)
487 {
488 global $conf;
489
490 $sql = "SELECT SUM(f.amount) as amount";
491 $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as f";
492 $sql .= " WHERE f.entity = ".((int) $conf->entity);
493 $sql .= " AND paye = 0";
494
495 if ($year) { // TODO Fix to use date function
496 $sql .= " AND f.datev >= '".((int) $year)."-01-01' AND f.datev <= '".((int) $year)."-12-31' ";
497 }
498
499 $result = $this->db->query($sql);
500 if ($result) {
501 if ($this->db->num_rows($result)) {
502 $obj = $this->db->fetch_object($result);
503 $this->db->free($result);
504 return $obj->amount;
505 } else {
506 return 0;
507 }
508 } else {
509 print $this->db->error();
510 return -1;
511 }
512 }
513
514 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
523 public function set_paid($user)
524 {
525 // phpcs:enable
526 dol_syslog(get_class($this)."::set_paid is deprecated, use setPaid instead", LOG_NOTICE);
527 return $this->setPaid($user);
528 }
529
536 public function setPaid($user)
537 {
538 $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET";
539 $sql .= " paye = 1";
540 $sql .= " WHERE rowid = ".((int) $this->id);
541
542 $return = $this->db->query($sql);
543
544 if ($return) {
545 $this->paye = 1;
546
547 return 1;
548 } else {
549 return -1;
550 }
551 }
552
553 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
562 public function set_unpaid($user)
563 {
564 // phpcs:enable
565 dol_syslog(get_class($this)."::set_unpaid is deprecated, use setUnpaid instead", LOG_NOTICE);
566 return $this->setUnpaid($user);
567 }
568
575 public function setUnpaid($user)
576 {
577 $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET";
578 $sql .= " paye = 0";
579 $sql .= " WHERE rowid = ".((int) $this->id);
580
581 $return = $this->db->query($sql);
582
583 if ($return) {
584 $this->paye = 0;
585
586 return 1;
587 } else {
588 return -1;
589 }
590 }
591
599 public function getLibStatut($mode = 0, $alreadypaid = -1)
600 {
601 return $this->LibStatut($this->paye, $mode, $alreadypaid);
602 }
603
604 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
613 public function LibStatut($status, $mode = 0, $alreadypaid = -1)
614 {
615 // phpcs:enable
616 global $langs;
617
618 // Load translation files required by the page
619 $langs->loadLangs(array("customers", "bills"));
620
621 // We reinit status array to force to redefine them because label may change according to properties values.
622 $this->labelStatus = array();
623 $this->labelStatusShort = array();
624
625 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
626 global $langs;
627 //$langs->load("mymodule");
628 $this->labelStatus[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv('Unpaid');
629 $this->labelStatus[self::STATUS_PAID] = $langs->transnoentitiesnoconv('Paid');
630 if ($status == self::STATUS_UNPAID && $alreadypaid > 0) {
631 $this->labelStatus[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv("BillStatusStarted");
632 }
633 $this->labelStatusShort[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv('Unpaid');
634 $this->labelStatusShort[self::STATUS_PAID] = $langs->transnoentitiesnoconv('Paid');
635 if ($status == self::STATUS_UNPAID && $alreadypaid > 0) {
636 $this->labelStatusShort[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv("BillStatusStarted");
637 }
638 }
639
640 $statusType = 'status1';
641 if ($status == 0 && $alreadypaid > 0) {
642 $statusType = 'status3';
643 }
644 if ($status == 1) {
645 $statusType = 'status6';
646 }
647
648 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
649 }
650
651
663 public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $short = 0, $save_lastsearch_value = -1, $addlinktonotes = 0)
664 {
665 global $langs, $conf, $user, $hookmanager;
666
667 if (!empty($conf->dol_no_mouse_hover)) {
668 $notooltip = 1; // Force disable tooltips
669 }
670
671 $result = '';
672
673 $url = DOL_URL_ROOT.'/compta/sociales/card.php?id='.$this->id;
674
675 if ($short) {
676 return $url;
677 }
678
679 if ($option !== 'nolink') {
680 // Add param to save lastsearch_values or not
681 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
682 if ($save_lastsearch_value == -1 && isset($_SERVER["PHP_SELF"]) && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
683 $add_save_lastsearch_values = 1;
684 }
685 if ($add_save_lastsearch_values) {
686 $url .= '&save_lastsearch_values=1';
687 }
688 }
689
690 if (empty($this->ref)) {
691 $this->ref = $this->label;
692 }
693
694 $label = img_picto('', $this->picto, 'class="pictofixedwidth"').'<u class="paddingrightonly">'.$langs->trans("SocialContribution").'</u>';
695 if (isset($this->paye)) {
696 $label .= ' '.$this->getLibStatut(5);
697 }
698 if (!empty($this->id)) {
699 $label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->id;
700 }
701 if (!empty($this->label)) {
702 $label .= '<br><b>'.$langs->trans('Label').':</b> '.$this->label;
703 }
704 if (!empty($this->type_label)) {
705 $label .= '<br><b>'.$langs->trans('Type').':</b> '.$this->type_label;
706 if (isModEnabled('accounting') || !empty($this->type_accountancy_code)) {
707 include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
708 $label .= ' <span class="opacitymedium">('.$langs->trans('AccountancyCode').': '.(empty($this->type_accountancy_code) ? $langs->trans("Unknown") : length_accountg($this->type_accountancy_code)).')</span>';
709 }
710 }
711
712 $linkclose = '';
713 if (empty($notooltip) && $user->hasRight("facture", "read")) {
714 if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
715 $label = $langs->trans("SocialContribution");
716 $linkclose .= ' alt="'.dolPrintHTMLForAttribute($label).'"';
717 }
718 $linkclose .= ' title="'.dolPrintHTMLForAttribute($label).'"';
719 $linkclose .= ' class="classfortooltip"';
720 }
721
722 $linkstart = '<a href="'.$url.'"';
723 $linkstart .= $linkclose.'>';
724 $linkend = '</a>';
725
726 $result .= $linkstart;
727 if ($withpicto) {
728 $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);
729 }
730 if ($withpicto != 2) {
731 $result .= $this->ref;
732 }
733 $result .= $linkend;
734
735 if ($addlinktonotes) {
736 $txttoshow = ($user->socid > 0 ? $this->note_public : $this->note_private);
737 if ($txttoshow) {
738 $notetoshow = $langs->trans("ViewPrivateNote").':<br>'.$txttoshow;
739 $result .= ' <span class="note inline-block">';
740 $result .= '<a href="'.DOL_URL_ROOT.'/compta/sociales/note.php?id='.$this->id.'" class="classfortooltip" title="'.dolPrintHTMLForAttribute($notetoshow).'">';
741 $result .= img_picto('', 'note');
742 $result .= '</a>';
743 $result .= '</span>';
744 }
745 }
746
747 global $action;
748 $hookmanager->initHooks(array($this->element . 'dao'));
749 $parameters = array('id' => $this->id, 'getnomurl' => &$result);
750 $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
751 if ($reshook > 0) {
752 $result = $hookmanager->resPrint;
753 } else {
754 $result .= $hookmanager->resPrint;
755 }
756
757 return $result;
758 }
759
765 public function getSommePaiement()
766 {
767 $sql = 'SELECT sum(amount) as amount';
768 $sql .= ' FROM '.MAIN_DB_PREFIX.'paiementcharge';
769 $sql .= " WHERE fk_charge = ".((int) $this->id);
770
771 dol_syslog(get_class($this)."::getSommePaiement", LOG_DEBUG);
772 $resql = $this->db->query($sql);
773 if ($resql) {
774 $amount = 0;
775
776 $obj = $this->db->fetch_object($resql);
777 if ($obj) {
778 $amount = $obj->amount ? $obj->amount : 0;
779 }
780
781 $this->db->free($resql);
782 return $amount;
783 } else {
784 return -1;
785 }
786 }
787
794 public function info($id)
795 {
796 $sql = "SELECT e.rowid, e.tms as datem, e.date_creation as datec, e.date_valid as datev, e.import_key,";
797 $sql .= " e.fk_user_author, e.fk_user_modif, e.fk_user_valid";
798 $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as e";
799 $sql .= " WHERE e.rowid = ".((int) $id);
800
801 dol_syslog(get_class($this)."::info", LOG_DEBUG);
802 $result = $this->db->query($sql);
803 if ($result) {
804 if ($this->db->num_rows($result)) {
805 $obj = $this->db->fetch_object($result);
806
807 $this->id = $obj->rowid;
808
809 $this->user_creation_id = $obj->fk_user_author;
810 $this->user_modification_id = $obj->fk_user_modif;
811 $this->user_validation_id = $obj->fk_user_valid;
812 $this->date_creation = $this->db->jdate($obj->datec);
813 $this->date_modification = $this->db->jdate($obj->datem);
814 $this->date_validation = $this->db->jdate($obj->datev);
815 $this->import_key = $obj->import_key;
816 }
817
818 $this->db->free($result);
819 return 1;
820 } else {
821 dol_print_error($this->db);
822 return -1;
823 }
824 }
825
833 public function initAsSpecimen()
834 {
835 // Initialize parameters
836 $this->id = 0;
837 $this->ref = 'SPECIMEN';
838 $this->specimen = 1;
839 $this->paye = 0;
840 $this->date_creation = dol_now();
841 $this->date_ech = $this->date_creation + 3600 * 24 * 30;
842 $this->periode = $this->date_creation + 3600 * 24 * 30;
843 $this->period = $this->date_creation + 3600 * 24 * 30;
844 $this->amount = 100;
845 $this->label = 'Social contribution label';
846 $this->type = 1;
847 $this->type_label = 'Type of social contribution';
848
849 return 1;
850 }
851
859 public function getKanbanView($option = '', $arraydata = null)
860 {
861 global $conf, $langs;
862
863 $selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
864
865 $return = '<div class="box-flex-item box-flex-grow-zero">';
866 $return .= '<div class="info-box info-box-sm">';
867 $return .= '<span class="info-box-icon bg-infobox-action">';
868 $return .= img_picto('', $this->picto);
869 $return .= '</span>';
870 $return .= '<div class="info-box-content">';
871 $return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(0) : $this->ref).'</span>';
872 if ($selected >= 0) {
873 $return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
874 }
875 if (property_exists($this, 'label')) {
876 $return .= ' &nbsp; <div class="inline-block opacitymedium valignmiddle tdoverflowmax100">'.$this->label.'</div>';
877 }
878 if (!empty($arraydata['project']) && $arraydata['project'] instanceof Project && $arraydata['project']->id > 0) {
879 $return .= '<br><span class="info-box-label">'.$arraydata['project']->getNomUrl(1).'</span>';
880 }
881 if (property_exists($this, 'date_ech')) {
882 $return .= '<br><span class="opacitymedium">'.$langs->trans("Date").'</span> : <span class="info-box-label">'.dol_print_date($this->date_ech, 'day').'</span>';
883 }
884 if (property_exists($this, 'amount')) {
885 $return .= '<br>';
886 $return .= '<span class="info-box-label amount">'.price($this->amount, 0, $langs, 1, -1, -1, $conf->currency).'</span>';
887 }
888 if (method_exists($this, 'LibStatut')) {
889 $return .= '<br><div class="info-box-status">'.$this->getLibStatut(3, (float) $this->totalpaid).'</div>';
890 }
891 $return .= '</div>';
892 $return .= '</div>';
893 $return .= '</div>';
894 return $return;
895 }
896}
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:281
$object ref
Definition info.php:90
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
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.
dol_now($mode='gmt')
Return date for now.
price2num($amount, $rounding='', $option=0, $currencycode='')
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