mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-01-06 00:53:00 +01:00
Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into oop-pdf
This commit is contained in:
@@ -338,9 +338,10 @@ class Account extends CommonObject
|
||||
/**
|
||||
* Create bank account into database
|
||||
*
|
||||
* @param User $user Object user making creation
|
||||
* @return int < 0 if KO, > 0 if OK
|
||||
*/
|
||||
function create()
|
||||
function create($user='')
|
||||
{
|
||||
global $langs,$conf;
|
||||
|
||||
@@ -665,10 +666,9 @@ class Account extends CommonObject
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
$this->db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -102,7 +102,7 @@ if ($_POST["action"] == 'add')
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$id = $account->create($user->id);
|
||||
$id = $account->create($user);
|
||||
if ($id > 0)
|
||||
{
|
||||
$_GET["id"]=$id; // Force chargement page en mode visu
|
||||
@@ -306,7 +306,7 @@ if ($action == 'create')
|
||||
$doleditor=new DolEditor('account_comment',$account->comment,'',200,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,10,70);
|
||||
$doleditor->Create();
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
@@ -510,7 +510,7 @@ else
|
||||
$account->fetch(GETPOST('id','int'));
|
||||
|
||||
print_fiche_titre($langs->trans("EditFinancialAccount"));
|
||||
|
||||
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
print "\n".'<script type="text/javascript" language="javascript">';
|
||||
@@ -614,7 +614,7 @@ else
|
||||
$doleditor=new DolEditor('account_comment',(isset($_POST["account_comment"])?$_POST["account_comment"]:$account->comment),'',200,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,10,70);
|
||||
$doleditor->Create();
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
@@ -635,7 +635,7 @@ else
|
||||
// Accountancy journal
|
||||
print '<tr><td valign="top">'.$langs->trans("AccountancyJournal").'</td>';
|
||||
print '<td colspan="3"><input type="text" name="accountancy_journal" value="'.(isset($_POST["accountancy_journal"])?$_POST["accountancy_journal"]:$account->accountancy_journal).'"></td></tr>';
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<center><br><input value="'.$langs->trans("Modify").'" type="submit" class="button">';
|
||||
|
||||
@@ -263,11 +263,13 @@ if ($resql)
|
||||
{
|
||||
print '<td align="center" class="nowrap">';
|
||||
print '<span id="datevalue_'.$objp->rowid.'">'.dol_print_date($db->jdate($objp->dv),"day")."</span>";
|
||||
print ' <span> ';
|
||||
print '  ';
|
||||
print '<span>';
|
||||
print '<a class="ajax" href="'.$_SERVER['PHP_SELF'].'?action=dvprev&account='.$acct->id.'&rowid='.$objp->rowid.'">';
|
||||
print img_edit_remove() . "</a> ";
|
||||
print '<a class="ajax" href="'.$_SERVER['PHP_SELF'].'?action=dvnext&account='.$acct->id.'&rowid='.$objp->rowid.'">';
|
||||
print img_edit_add() ."</a></span>";
|
||||
print img_edit_add() ."</a>";
|
||||
print '</span>';
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
|
||||
@@ -222,13 +222,16 @@ class Deplacement extends CommonObject
|
||||
* Load an object from database
|
||||
*
|
||||
* @param int $id Id of record to load
|
||||
* @param string $ref Ref of record
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch($id)
|
||||
function fetch($id, $ref='')
|
||||
{
|
||||
$sql = "SELECT rowid, fk_user, type, fk_statut, km, fk_soc, dated, note_private, note_public, fk_projet, extraparams";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."deplacement";
|
||||
$sql.= " WHERE rowid = ".$id;
|
||||
$sql.= " WHERE entity IN (".getEntity('deplacement').")";
|
||||
if ($ref) $sql.= " AND ref ='".$this->db->escape($ref)."'";
|
||||
else $sql.= " AND id = ".$id;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
@@ -77,7 +77,7 @@ class DeplacementStats extends Stats
|
||||
*/
|
||||
function getNbByYear()
|
||||
{
|
||||
$sql = "SELECT YEAR(datef) as dm, count(*)";
|
||||
$sql = "SELECT YEAR(dated) as dm, count(*)";
|
||||
$sql.= " FROM ".$this->from;
|
||||
$sql.= " GROUP BY dm DESC";
|
||||
$sql.= " WHERE ".$this->where;
|
||||
|
||||
@@ -88,7 +88,7 @@ if ($object->id)
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$head=trip_prepare_head($object, $user);
|
||||
$head=trip_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'documents', $langs->trans("TripCard"), 0, 'trip');
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -209,38 +209,42 @@ class Don extends CommonObject
|
||||
*/
|
||||
function check($minimum=0)
|
||||
{
|
||||
global $langs;
|
||||
$langs->load('main');
|
||||
$langs->load('companies');
|
||||
|
||||
$err = 0;
|
||||
|
||||
if (dol_strlen(trim($this->societe)) == 0)
|
||||
{
|
||||
if ((dol_strlen(trim($this->lastname)) + dol_strlen(trim($this->firstname))) == 0)
|
||||
{
|
||||
$error_string[$err] = "Vous devez saisir vos nom et prenom ou le nom de votre societe.";
|
||||
$error_string[$err] = $langs->trans('ErrorFieldRequired',$langs->trans('Company').'/'.$langs->trans('Firstname').'-'.$langs->trans('Lastname'));
|
||||
$err++;
|
||||
}
|
||||
}
|
||||
|
||||
if (dol_strlen(trim($this->address)) == 0)
|
||||
{
|
||||
$error_string[$err] = "L'adresse saisie est invalide";
|
||||
$error_string[$err] = $langs->trans('ErrorFieldRequired',$langs->trans('Address'));
|
||||
$err++;
|
||||
}
|
||||
|
||||
if (dol_strlen(trim($this->zip)) == 0)
|
||||
{
|
||||
$error_string[$err] = "Le code postal saisi est invalide";
|
||||
$error_string[$err] = $langs->trans('ErrorFieldRequired',$langs->trans('Zip'));
|
||||
$err++;
|
||||
}
|
||||
|
||||
if (dol_strlen(trim($this->town)) == 0)
|
||||
{
|
||||
$error_string[$err] = "La ville saisie est invalide";
|
||||
$error_string[$err] = $langs->trans('ErrorFieldRequired',$langs->trans('Town'));
|
||||
$err++;
|
||||
}
|
||||
|
||||
if (dol_strlen(trim($this->email)) == 0)
|
||||
{
|
||||
$error_string[$err] = "L'email saisi est invalide";
|
||||
$error_string[$err] = $langs->trans('ErrorFieldRequired',$langs->trans('EMail'));
|
||||
$err++;
|
||||
}
|
||||
|
||||
@@ -252,7 +256,7 @@ class Don extends CommonObject
|
||||
{
|
||||
if (!isset($map[substr($this->amount, $i, 1)] ))
|
||||
{
|
||||
$error_string[$err] = "Le montant du don contient un/des caractere(s) invalide(s)";
|
||||
$error_string[$err] = $langs->trans('ErrorFieldRequired',$langs->trans('Amount'));
|
||||
$err++;
|
||||
$amount_invalid = 1;
|
||||
break;
|
||||
@@ -263,14 +267,14 @@ class Don extends CommonObject
|
||||
{
|
||||
if ($this->amount == 0)
|
||||
{
|
||||
$error_string[$err] = "Le montant du don est null";
|
||||
$error_string[$err] = $langs->trans('ErrorFieldRequired',$langs->trans('Amount'));
|
||||
$err++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($this->amount < $minimum && $minimum > 0)
|
||||
{
|
||||
$error_string[$err] = "Le montant minimum du don est de $minimum";
|
||||
$error_string[$err] = $langs->trans('MinimumAmount',$langs->trans('$minimum'));
|
||||
$err++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,11 +171,12 @@ else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->fact
|
||||
}
|
||||
|
||||
// Delete line
|
||||
else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->facture->creer) {
|
||||
else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$result = $object->deleteline($_GET ['lineid'], $user);
|
||||
$result = $object->deleteline(GETPOST('lineid'));
|
||||
if ($result > 0) {
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
@@ -203,14 +204,16 @@ else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->
|
||||
}
|
||||
|
||||
// Delete link of credit note to invoice
|
||||
else if ($action == 'unlinkdiscount' && $user->rights->facture->creer) {
|
||||
else if ($action == 'unlinkdiscount' && $user->rights->facture->creer)
|
||||
{
|
||||
$discount = new DiscountAbsolute($db);
|
||||
$result = $discount->fetch($_GET ["discountid"]);
|
||||
$result = $discount->fetch(GETPOST("discountid"));
|
||||
$discount->unlink_invoice();
|
||||
}
|
||||
|
||||
// Validation
|
||||
else if ($action == 'valid' && $user->rights->facture->creer) {
|
||||
else if ($action == 'valid' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
|
||||
// On verifie signe facture
|
||||
@@ -229,7 +232,8 @@ else if ($action == 'valid' && $user->rights->facture->creer) {
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'set_thirdparty' && $user->rights->facture->creer) {
|
||||
else if ($action == 'set_thirdparty' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->setValueFrom('fk_soc', $socid);
|
||||
|
||||
@@ -237,12 +241,14 @@ else if ($action == 'set_thirdparty' && $user->rights->facture->creer) {
|
||||
exit();
|
||||
}
|
||||
|
||||
else if ($action == 'classin' && $user->rights->facture->creer) {
|
||||
else if ($action == 'classin' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->setProject($_POST['projectid']);
|
||||
}
|
||||
|
||||
else if ($action == 'setmode' && $user->rights->facture->creer) {
|
||||
else if ($action == 'setmode' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
|
||||
if ($result < 0)
|
||||
@@ -268,7 +274,8 @@ else if ($action == 'setinvoicedate' && $user->rights->facture->creer)
|
||||
if ($result < 0) dol_print_error($db, $object->error);
|
||||
}
|
||||
|
||||
else if ($action == 'setconditions' && $user->rights->facture->creer) {
|
||||
else if ($action == 'setconditions' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->cond_reglement_code = 0; // To clean property
|
||||
$object->cond_reglement_id = 0; // To clean property
|
||||
@@ -283,7 +290,8 @@ else if ($action == 'setconditions' && $user->rights->facture->creer) {
|
||||
if ($result < 0) dol_print_error($db, $object->error);
|
||||
}
|
||||
|
||||
else if ($action == 'setpaymentterm' && $user->rights->facture->creer) {
|
||||
else if ($action == 'setpaymentterm' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->date_lim_reglement = dol_mktime(12, 0, 0, $_POST['paymenttermmonth'], $_POST['paymenttermday'], $_POST['paymenttermyear']);
|
||||
if ($object->date_lim_reglement < $object->date) {
|
||||
@@ -295,7 +303,8 @@ else if ($action == 'setpaymentterm' && $user->rights->facture->creer) {
|
||||
dol_print_error($db, $object->error);
|
||||
}
|
||||
|
||||
else if ($action == 'setrevenuestamp' && $user->rights->facture->creer) {
|
||||
else if ($action == 'setrevenuestamp' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->revenuestamp = GETPOST('revenuestamp');
|
||||
$result = $object->update($user);
|
||||
@@ -305,16 +314,19 @@ else if ($action == 'setrevenuestamp' && $user->rights->facture->creer) {
|
||||
}
|
||||
|
||||
// bank account
|
||||
else if ($action == 'setbankaccount' && $user->rights->facture->creer) {
|
||||
else if ($action == 'setbankaccount' && $user->rights->facture->creer)
|
||||
{
|
||||
$result=$object->setBankAccount(GETPOST('fk_account', 'int'));
|
||||
}
|
||||
|
||||
else if ($action == 'setremisepercent' && $user->rights->facture->creer) {
|
||||
else if ($action == 'setremisepercent' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->set_remise($user, $_POST['remise_percent']);
|
||||
}
|
||||
|
||||
else if ($action == "setabsolutediscount" && $user->rights->facture->creer) {
|
||||
else if ($action == "setabsolutediscount" && $user->rights->facture->creer)
|
||||
{
|
||||
// POST[remise_id] ou POST[remise_id_for_payment]
|
||||
if (! empty($_POST["remise_id"])) {
|
||||
$ret = $object->fetch($id);
|
||||
@@ -339,7 +351,8 @@ else if ($action == "setabsolutediscount" && $user->rights->facture->creer) {
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'set_ref_client' && $user->rights->facture->creer) {
|
||||
else if ($action == 'set_ref_client' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->set_ref_client($_POST['ref_client']);
|
||||
}
|
||||
@@ -359,7 +372,8 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu
|
||||
{
|
||||
$idprof_mandatory = 'SOCIETE_IDPROF' . ($i) . '_INVOICE_MANDATORY';
|
||||
$idprof = 'idprof' . $i;
|
||||
if (! $object->thirdparty->$idprof && ! empty($conf->global->$idprof_mandatory)) {
|
||||
if (! $object->thirdparty->$idprof && ! empty($conf->global->$idprof_mandatory))
|
||||
{
|
||||
if (! $error)
|
||||
$langs->load("errors");
|
||||
$error ++;
|
||||
@@ -376,7 +390,8 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu
|
||||
}
|
||||
|
||||
// Check for warehouse
|
||||
if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change) {
|
||||
if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change)
|
||||
{
|
||||
if (! $idwarehouse || $idwarehouse == - 1) {
|
||||
$error ++;
|
||||
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")), 'errors');
|
||||
@@ -412,7 +427,8 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu
|
||||
}
|
||||
|
||||
// Go back to draft status (unvalidate)
|
||||
else if ($action == 'confirm_modif' && ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->facture->valider) || $user->rights->facture->invoice_advance->unvalidate)) {
|
||||
else if ($action == 'confirm_modif' && ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->facture->valider) || $user->rights->facture->invoice_advance->unvalidate))
|
||||
{
|
||||
$idwarehouse = GETPOST('idwarehouse');
|
||||
|
||||
$object->fetch($id);
|
||||
@@ -426,7 +442,8 @@ else if ($action == 'confirm_modif' && ((empty($conf->global->MAIN_USE_ADVANCED_
|
||||
}
|
||||
|
||||
// Check parameters
|
||||
if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change) {
|
||||
if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change)
|
||||
{
|
||||
if (! $idwarehouse || $idwarehouse == - 1) {
|
||||
$error ++;
|
||||
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")), 'errors');
|
||||
@@ -460,7 +477,8 @@ else if ($action == 'confirm_modif' && ((empty($conf->global->MAIN_USE_ADVANCED_
|
||||
$ventilExportCompta = $object->getVentilExportCompta();
|
||||
|
||||
// On verifie si aucun paiement n'a ete effectue
|
||||
if ($resteapayer == $object->total_ttc && $object->paye == 0 && $ventilExportCompta == 0) {
|
||||
if ($resteapayer == $object->total_ttc && $object->paye == 0 && $ventilExportCompta == 0)
|
||||
{
|
||||
$result=$object->set_draft($user, $idwarehouse);
|
||||
if ($result<0) setEventMessage($object->error,'errors');
|
||||
|
||||
@@ -484,12 +502,14 @@ else if ($action == 'confirm_modif' && ((empty($conf->global->MAIN_USE_ADVANCED_
|
||||
}
|
||||
|
||||
// Classify "paid"
|
||||
else if ($action == 'confirm_paid' && $confirm == 'yes' && $user->rights->facture->paiement) {
|
||||
else if ($action == 'confirm_paid' && $confirm == 'yes' && $user->rights->facture->paiement)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->set_paid($user);
|
||||
if ($result<0) setEventMessage($object->error,'errors');
|
||||
} // Classif "paid partialy"
|
||||
else if ($action == 'confirm_paid_partially' && $confirm == 'yes' && $user->rights->facture->paiement) {
|
||||
else if ($action == 'confirm_paid_partially' && $confirm == 'yes' && $user->rights->facture->paiement)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$close_code = $_POST["close_code"];
|
||||
$close_note = $_POST["close_note"];
|
||||
|
||||
@@ -484,7 +484,7 @@ class Facture extends CommonInvoice
|
||||
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('BILL_CREATE',$user);
|
||||
if ($result < 0) $error++;
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
|
||||
if (! $error)
|
||||
@@ -593,8 +593,8 @@ class Facture extends CommonInvoice
|
||||
|
||||
// Load source object
|
||||
$objFrom = dol_clone($this);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Change socid if needed
|
||||
if (! empty($socid) && $socid != $this->socid)
|
||||
@@ -637,7 +637,7 @@ class Facture extends CommonInvoice
|
||||
unset($this->products[$i]); // Tant que products encore utilise
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Create clone
|
||||
$result=$this->create($user);
|
||||
if ($result < 0) $error++;
|
||||
@@ -645,7 +645,7 @@ class Facture extends CommonInvoice
|
||||
// copy internal contacts
|
||||
if ($this->copy_linked_contact($objFrom, 'internal') < 0)
|
||||
$error++;
|
||||
|
||||
|
||||
// copy external contacts if same company
|
||||
elseif ($objFrom->socid == $this->socid)
|
||||
{
|
||||
@@ -667,7 +667,7 @@ class Facture extends CommonInvoice
|
||||
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('BILL_CLONE',$user);
|
||||
if ($result < 0) $error++;
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
@@ -1108,7 +1108,7 @@ class Facture extends CommonInvoice
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('BILL_MODIFY',$user);
|
||||
if ($result < 0) $error++;
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
}
|
||||
}
|
||||
@@ -1266,7 +1266,7 @@ class Facture extends CommonInvoice
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('BILL_DELETE',$user);
|
||||
if ($result < 0) $error++;
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
@@ -1438,7 +1438,7 @@ class Facture extends CommonInvoice
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('BILL_PAYED',$user);
|
||||
if ($result < 0) $error++;
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
}
|
||||
else
|
||||
@@ -1490,7 +1490,7 @@ class Facture extends CommonInvoice
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('BILL_UNPAYED',$user);
|
||||
if ($result < 0) $error++;
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
}
|
||||
else
|
||||
@@ -1554,7 +1554,7 @@ class Facture extends CommonInvoice
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('BILL_CANCEL',$user);
|
||||
if ($result < 0)
|
||||
{
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@@ -1768,11 +1768,11 @@ class Facture extends CommonInvoice
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('BILL_VALIDATE',$user);
|
||||
if ($result < 0) $error++;
|
||||
//TODO: Restoring ref, facnumber, statut, brouillon to previous value if trigger fail
|
||||
if ($result < 0) $error++;
|
||||
//TODO: Restoring ref, facnumber, statut, brouillon to previous value if trigger fail
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
|
||||
// Set new ref and define current statut
|
||||
if (! $error)
|
||||
{
|
||||
@@ -1856,7 +1856,7 @@ class Facture extends CommonInvoice
|
||||
$this->statut = 0;
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('BILL_UNVALIDATE',$user);
|
||||
if ($result < 0)
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
$this->statut=$old_statut;
|
||||
@@ -3164,7 +3164,7 @@ class Facture extends CommonInvoice
|
||||
$sql.= ' p.ref as product_ref, p.fk_product_type, p.label as product_label,';
|
||||
$sql.= ' p.description as product_desc';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facturedet as l';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product p ON l.fk_product=p.rowid';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product=p.rowid';
|
||||
$sql.= ' WHERE l.fk_facture = '.$this->id;
|
||||
$sql.= ' ORDER BY l.rang ASC, l.rowid';
|
||||
|
||||
@@ -3659,7 +3659,7 @@ class FactureLigne extends CommonInvoiceLine
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('LINEBILL_INSERT',$user);
|
||||
if ($result < 0)
|
||||
{
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
@@ -3770,7 +3770,7 @@ class FactureLigne extends CommonInvoiceLine
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('LINEBILL_UPDATE',$user);
|
||||
if ($result < 0)
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
@@ -3800,7 +3800,7 @@ class FactureLigne extends CommonInvoiceLine
|
||||
$error=0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('LINEBILL_DELETE',$user);
|
||||
if ($result < 0)
|
||||
@@ -3809,7 +3809,7 @@ class FactureLigne extends CommonInvoiceLine
|
||||
return -1;
|
||||
}
|
||||
// End call triggers
|
||||
|
||||
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet WHERE rowid = ".$this->rowid;
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
|
||||
@@ -372,6 +372,17 @@ $search_montant_ht = GETPOST("search_montant_ht");
|
||||
$search_montant_ttc = GETPOST("search_montant_ttc");
|
||||
$late = GETPOST("late");
|
||||
|
||||
// Do we click on purge search criteria ?
|
||||
if (GETPOST("button_removefilter_x"))
|
||||
{
|
||||
$search_ref='';
|
||||
$search_refcustomer='';
|
||||
$search_societe='';
|
||||
$search_paymentmode='';
|
||||
$search_montant_ht='';
|
||||
$search_montant_ttc='';
|
||||
}
|
||||
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
@@ -571,6 +582,7 @@ if ($resql)
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print '</td>';
|
||||
if (empty($mode))
|
||||
{
|
||||
|
||||
@@ -327,6 +327,7 @@ if ($resql)
|
||||
print '<td class="liste_titre" align="right"><input class="flat" type="text" size="10" name="search_montant_ttc" value="'.$search_montant_ttc.'"></td>';
|
||||
print '<td class="liste_titre" align="right"> </td>';
|
||||
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
if ($num > 0)
|
||||
|
||||
@@ -104,11 +104,11 @@ $sql.= " fd.total_ttc, fd.tva_tx, fd.total_ht, fd.tva as total_tva, fd.product_t
|
||||
$sql.= " s.rowid as socid, s.nom as name, s.code_compta_fournisseur,";
|
||||
$sql.= " p.rowid as pid, p.ref as ref, p.accountancy_code_buy,";
|
||||
$sql.= " ct.accountancy_code_buy as account_tva, ct.recuperableonly";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn_det fd";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND fd.info_bits = ct.recuperableonly AND ct.fk_pays = '".$idpays."'";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product p ON p.rowid = fd.fk_product";
|
||||
$sql.= " JOIN ".MAIN_DB_PREFIX."facture_fourn f ON f.rowid = fd.fk_facture_fourn";
|
||||
$sql.= " JOIN ".MAIN_DB_PREFIX."societe s ON s.rowid = f.fk_soc" ;
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as fd";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva as ct ON fd.tva_tx = ct.taux AND fd.info_bits = ct.recuperableonly AND ct.fk_pays = '".$idpays."'";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product";
|
||||
$sql.= " JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON f.rowid = fd.fk_facture_fourn";
|
||||
$sql.= " JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc" ;
|
||||
$sql.= " WHERE f.fk_statut > 0 AND f.entity = ".$conf->entity;
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2)";
|
||||
else $sql.= " AND f.type IN (0,1,2,3)";
|
||||
|
||||
@@ -105,10 +105,10 @@ $sql.= " fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc, fd
|
||||
$sql.= " s.rowid as socid, s.nom as name, s.code_compta, s.client,";
|
||||
$sql.= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell,";
|
||||
$sql.= " ct.accountancy_code_sell as account_tva, ct.recuperableonly";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facturedet fd";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product p ON p.rowid = fd.fk_product";
|
||||
$sql.= " JOIN ".MAIN_DB_PREFIX."facture f ON f.rowid = fd.fk_facture";
|
||||
$sql.= " JOIN ".MAIN_DB_PREFIX."societe s ON s.rowid = f.fk_soc";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product";
|
||||
$sql.= " JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture";
|
||||
$sql.= " JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND fd.info_bits = ct.recuperableonly AND ct.fk_pays = '".$idpays."'";
|
||||
$sql.= " WHERE f.entity = ".$conf->entity;
|
||||
$sql.= " AND f.fk_statut > 0";
|
||||
|
||||
@@ -109,8 +109,8 @@ if ($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm=='ye
|
||||
if ($datepaye && ($datepaye < $tmpinvoice->date))
|
||||
{
|
||||
$langs->load("errors");
|
||||
$error++;
|
||||
setEventMessage($langs->transnoentities("ErrorPaymentDateLowerThanInvoiceDate", dol_print_date($datepaye,'day'), dol_print_date($tmpinvoice->date, 'day'), $tmpinvoice->ref), 'errors');
|
||||
//$error++;
|
||||
setEventMessage($langs->transnoentities("WarningPaymentDateLowerThanInvoiceDate", dol_print_date($datepaye,'day'), dol_print_date($tmpinvoice->date, 'day'), $tmpinvoice->ref), 'warnings');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2007-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -20,12 +21,14 @@
|
||||
/**
|
||||
* \file htdocs/compta/paiement/cheque/liste.php
|
||||
* \ingroup compta
|
||||
* \brief Page liste des bordereau de remise de cheque
|
||||
* \brief Page list of cheque deposits
|
||||
*/
|
||||
|
||||
require('../../../main.inc.php');
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
$langs->load("banks");
|
||||
$langs->load("categories");
|
||||
@@ -44,12 +47,16 @@ $pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
$limit = $conf->liste_limit;
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
if (! $sortfield) $sortfield="bc.number";
|
||||
if (! $sortfield) $sortfield="dp";
|
||||
|
||||
$year=GETPOST("year");
|
||||
$month=GETPOST("month");
|
||||
|
||||
$form=new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
$checkdepositstatic=new RemiseCheque($db);
|
||||
$accountstatic=new Account($db);
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@@ -63,10 +70,25 @@ $sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
$sql.= " WHERE bc.fk_bank_account = ba.rowid";
|
||||
$sql.= " AND bc.entity = ".$conf->entity;
|
||||
if (GETPOST('search_montant'))
|
||||
|
||||
// Search criteria
|
||||
if (GETPOST("search_ref")) $sql.=" AND bc.number=".GETPOST("search_ref",'int');
|
||||
if (GETPOST("search_account") > 0) $sql.=" AND bc.fk_bank_account=".GETPOST("search_account",'int');
|
||||
if (GETPOST("search_amount")) $sql.=" AND bc.amount=".price2num(GETPOST("search_amount"));
|
||||
if ($month > 0)
|
||||
{
|
||||
$sql.=" AND bc.amount=".price2num(GETPOST('search_montant'));
|
||||
if ($year > 0 && empty($day))
|
||||
$sql.= " AND bc.date_bordereau BETWEEN '".$db->idate(dol_get_first_day($year,$month,false))."' AND '".$db->idate(dol_get_last_day($year,$month,false))."'";
|
||||
else if ($year > 0 && ! empty($day))
|
||||
$sql.= " AND bc.date_bordereau BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."'";
|
||||
else
|
||||
$sql.= " AND date_format(bc.date_bordereau, '%m') = '".$month."'";
|
||||
}
|
||||
else if ($year > 0)
|
||||
{
|
||||
$sql.= " AND bc.date_bordereau BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
|
||||
}
|
||||
|
||||
$sql.= " ORDER BY $sortfield $sortorder";
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
//print "$sql";
|
||||
@@ -79,27 +101,35 @@ if ($resql)
|
||||
$i = 0;
|
||||
$params='';
|
||||
|
||||
print_barre_liste($langs->trans("MenuChequeDeposits"), $page, 'liste.php', $params, $sortfield, $sortorder, '', $num);
|
||||
print_barre_liste($langs->trans("MenuChequeDeposits"), $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num);
|
||||
|
||||
print '<form method="get" action="liste.php">';
|
||||
print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<table class="liste" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Ref"),"liste.php","bc.number","",$params,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Date"),"liste.php","dp","",$params,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Account"),"liste.php","ba.label","",$params,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("NbOfCheques"),"liste.php","bc.nbcheque","",$params,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Amount"),"liste.php","bc.amount","",$params,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),"liste.php","bc.statut","",$params,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"bc.number","",$params,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"dp","",$params,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$params,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("NbOfCheques"),$_SERVER["PHP_SELF"],"bc.nbcheque","",$params,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"bc.amount","",$params,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"bc.statut","",$params,'align="right"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
// Lignes des champs de filtre
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="fat" type="text" size="4" name="search_ref" value="'.GETPOST('search_ref').'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.$day.'">';
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
|
||||
$formother->select_year($year?$year:-1,'year',1, 20, 5);
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$form->select_comptes($_REQUEST["search_account"],'search_account',0,'',1);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input class="fat" type="text" size="6" name="search_montant" value="'.GETPOST('search_montant').'">';
|
||||
print '<input class="fat" type="text" size="6" name="search_amount" value="'.GETPOST('search_amount').'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
@@ -124,16 +154,16 @@ if ($resql)
|
||||
// Date
|
||||
print '<td align="center">'.dol_print_date($db->jdate($objp->dp),'day').'</td>';
|
||||
|
||||
// Banque
|
||||
// Bank
|
||||
print '<td>';
|
||||
if ($objp->bid) print '<a href="'.DOL_URL_ROOT.'/compta/bank/account.php?account='.$objp->bid.'">'.img_object($langs->trans("ShowAccount"),'account').' '.$objp->label.'</a>';
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
|
||||
// Nb of cheques
|
||||
// Number of cheques
|
||||
print '<td align="right">'.$objp->nbcheque.'</td>';
|
||||
|
||||
// Montant
|
||||
// Amount
|
||||
print '<td align="right">'.price($objp->amount).'</td>';
|
||||
|
||||
// Statut
|
||||
|
||||
@@ -31,6 +31,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||
$langs->load("bills");
|
||||
$langs->load("companies");
|
||||
|
||||
$id=GETPOST('id');
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@@ -39,8 +41,8 @@ $langs->load("companies");
|
||||
llxHeader();
|
||||
|
||||
$paiement = new Paiement($db);
|
||||
$paiement->fetch($_GET["id"], $user);
|
||||
$paiement->info($_GET["id"]);
|
||||
$paiement->fetch($id);
|
||||
$paiement->info($id);
|
||||
|
||||
$head = payment_prepare_head($paiement);
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -33,6 +34,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
|
||||
$langs->load("bills");
|
||||
$langs->load("donation");
|
||||
$langs->load("salaries");
|
||||
|
||||
$date_startmonth=GETPOST('date_startmonth');
|
||||
$date_startday=GETPOST('date_startday');
|
||||
@@ -555,7 +558,7 @@ if (! empty($date_start) && ! empty($date_end))
|
||||
$sql.= " GROUP BY u.rowid, u.firstname, u.lastname, p.fk_user, p.label, dm";
|
||||
$sql.= " ORDER BY u.firstname";
|
||||
|
||||
dol_syslog("get payment salaries sql=".$sql);
|
||||
dol_syslog("get payment salaries");
|
||||
$result=$db->query($sql);
|
||||
$subtotal_ht = 0;
|
||||
$subtotal_ttc = 0;
|
||||
@@ -598,6 +601,64 @@ else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
/*
|
||||
* Dunning
|
||||
*/
|
||||
|
||||
print '<tr><td colspan="4">'.$langs->trans("Donation").'</td></tr>';
|
||||
$sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."don as p";
|
||||
$sql.= " WHERE p.entity = ".$conf->entity;
|
||||
$sql.= " AND fk_statut=2";
|
||||
if (! empty($date_start) && ! empty($date_end))
|
||||
$sql.= " AND p.datedon >= '".$db->idate($date_start)."' AND p.datedon <= '".$db->idate($date_end)."'";
|
||||
$sql.= " GROUP BY p.societe, p.firstname, p.lastname";
|
||||
$sql.= " ORDER BY p.societe, p.firstname, p.lastname";
|
||||
|
||||
dol_syslog("get dunning");
|
||||
$result=$db->query($sql);
|
||||
$subtotal_ht = 0;
|
||||
$subtotal_ttc = 0;
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$var=true;
|
||||
$i = 0;
|
||||
if ($num)
|
||||
{
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$total_ht += $obj->amount;
|
||||
$total_ttc += $obj->amount;
|
||||
$subtotal_ht -= $obj->amount;
|
||||
$subtotal_ttc -= $obj->amount;
|
||||
|
||||
$var = !$var;
|
||||
print "<tr ".$bc[$var]."><td> </td>";
|
||||
|
||||
print "<td>".$langs->trans("Donation")." <a href=\"".DOL_URL_ROOT."/compta/dons/liste.php?search_company=".$obj->nom."&search_name=".$obj->firstname." ".$obj->lastname."\">".$obj->nom. " ".$obj->firstname." ".$obj->lastname."</a></td>\n";
|
||||
|
||||
if ($modecompta == 'CREANCES-DETTES') print '<td align="right">'.price($obj->amount).'</td>';
|
||||
print '<td align="right">'.price($obj->amount).'</td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$var = !$var;
|
||||
print "<tr ".$bc[$var]."><td> </td>";
|
||||
print '<td colspan="3">'.$langs->trans("None").'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
print '<tr class="liste_total">';
|
||||
if ($modecompta == 'CREANCES-DETTES')
|
||||
print '<td colspan="3" align="right">'.price(-$subtotal_ht).'</td>';
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -480,7 +481,7 @@ $sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
|
||||
$sql.= " WHERE p.entity = ".$conf->entity;
|
||||
$sql.= " GROUP BY p.label, dm";
|
||||
|
||||
dol_syslog("get social salaries payments sql=".$sql);
|
||||
dol_syslog("get social salaries payments");
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@@ -508,6 +509,45 @@ else
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
/*
|
||||
* get dunning paiement
|
||||
*/
|
||||
$subtotal_ht = 0;
|
||||
$subtotal_ttc = 0;
|
||||
$sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."don as p";
|
||||
$sql.= " WHERE p.entity = ".$conf->entity;
|
||||
$sql.= " AND fk_statut=2";
|
||||
$sql.= " GROUP BY p.societe, p.firstname, p.lastname, dm";
|
||||
|
||||
dol_syslog("get social salaries payments");
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$var=false;
|
||||
$i = 0;
|
||||
if ($num)
|
||||
{
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
if (! isset($encaiss[$obj->dm])) $encaiss[$obj->dm]=0;
|
||||
$encaiss[$obj->dm] += $obj->amount;
|
||||
|
||||
if (! isset($encaiss_ttc[$obj->dm])) $encaiss_ttc[$obj->dm]=0;
|
||||
$encaiss_ttc[$obj->dm] += $obj->amount;
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
/*
|
||||
* Show result array
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user