WIP Work on deposit for other payment mode than CHQ.
This commit is contained in:
parent
83c8eae00d
commit
16fc7d512b
@ -42,6 +42,11 @@ $ref = GETPOST('ref', 'alpha');
|
|||||||
$action = GETPOST('action', 'aZ09');
|
$action = GETPOST('action', 'aZ09');
|
||||||
$confirm = GETPOST('confirm', 'alpha');
|
$confirm = GETPOST('confirm', 'alpha');
|
||||||
|
|
||||||
|
$type = GETPOST('type');
|
||||||
|
if (empty($type)) {
|
||||||
|
$type = 'CHQ';
|
||||||
|
}
|
||||||
|
|
||||||
$object = new RemiseCheque($db);
|
$object = new RemiseCheque($db);
|
||||||
|
|
||||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||||
@ -60,6 +65,7 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
|||||||
$offset = $limit * $page;
|
$offset = $limit * $page;
|
||||||
|
|
||||||
$upload_dir = $conf->bank->multidir_output[$object->entity ? $object->entity : $conf->entity]."/checkdeposits";
|
$upload_dir = $conf->bank->multidir_output[$object->entity ? $object->entity : $conf->entity]."/checkdeposits";
|
||||||
|
|
||||||
// filter by dates from / to
|
// filter by dates from / to
|
||||||
$search_date_start_day = GETPOST('search_date_start_day', 'int');
|
$search_date_start_day = GETPOST('search_date_start_day', 'int');
|
||||||
$search_date_start_month = GETPOST('search_date_start_month', 'int');
|
$search_date_start_month = GETPOST('search_date_start_month', 'int');
|
||||||
@ -132,8 +138,8 @@ if ($action == 'setref' && $user->rights->banque->cheque) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'create' && GETPOST("accountid", "int") > 0 && $user->rights->banque->cheque) {
|
if ($action == 'create' && GETPOST("accountid", "int") > 0 && $user->rights->banque->cheque) {
|
||||||
if (is_array(GETPOST('toRemise'))) {
|
if (GETPOSTISARRAY('toRemise')) {
|
||||||
$result = $object->create($user, GETPOST("accountid", "int"), 0, GETPOST('toRemise'));
|
$result = $object->create($user, GETPOST("accountid", "int"), 0, GETPOST('toRemise', 'array:int'));
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
if ($object->statut == 1) { // If statut is validated, we build doc
|
if ($object->statut == 1) { // If statut is validated, we build doc
|
||||||
$object->fetch($object->id); // To force to reload all properties in correct property name
|
$object->fetch($object->id); // To force to reload all properties in correct property name
|
||||||
@ -286,7 +292,12 @@ if (GETPOST('removefilter')) {
|
|||||||
$filteraccountid = 0;
|
$filteraccountid = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$title = $langs->trans("Cheques")." - ".$langs->trans("Card");
|
if ($type == 'CHQ') {
|
||||||
|
$title = $langs->trans("Cheques");
|
||||||
|
} else {
|
||||||
|
$title = $type;
|
||||||
|
}
|
||||||
|
|
||||||
$helpurl = "";
|
$helpurl = "";
|
||||||
llxHeader("", $title, $helpurl);
|
llxHeader("", $title, $helpurl);
|
||||||
|
|
||||||
@ -302,7 +313,7 @@ if ($action == 'new') {
|
|||||||
$hselected = $h;
|
$hselected = $h;
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("Cheques"), '', 'bank_account');
|
print load_fiche_titre($title, '', 'bank_account');
|
||||||
} else {
|
} else {
|
||||||
$result = $object->fetch($id, $ref);
|
$result = $object->fetch($id, $ref);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
@ -357,18 +368,29 @@ if ($action == 'new') {
|
|||||||
|
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
print '<span class="opacitymedium">'.$langs->trans("SelectChequeTransactionAndGenerate").'</span><br><br>'."\n";
|
if ($type == 'CHQ') {
|
||||||
|
print '<span class="opacitymedium">'.$langs->trans("SelectChequeTransactionAndGenerate").'</span><br><br>'."\n";
|
||||||
|
} else {
|
||||||
|
print '<span class="opacitymedium">'.$langs->trans("SelectPaymentTransactionAndGenerate", $type).'</span><br><br>'."\n";
|
||||||
|
}
|
||||||
|
|
||||||
print '<form class="nocellnopadd" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
print '<form class="nocellnopadd" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
print '<input type="hidden" name="action" value="new">';
|
print '<input type="hidden" name="action" value="new">';
|
||||||
|
print '<input type="hidden" name="type" value="'.$type.'">';
|
||||||
|
|
||||||
print dol_get_fiche_head();
|
print dol_get_fiche_head();
|
||||||
|
|
||||||
print '<table class="border centpercent">';
|
print '<table class="border centpercent">';
|
||||||
//print '<tr><td width="30%">'.$langs->trans('Date').'</td><td width="70%">'.dol_print_date($now,'day').'</td></tr>';
|
//print '<tr><td width="30%">'.$langs->trans('Date').'</td><td width="70%">'.dol_print_date($now,'day').'</td></tr>';
|
||||||
// Filter
|
// Filter
|
||||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("DateChequeReceived").'</td><td>';
|
print '<tr><td class="titlefieldcreate">';
|
||||||
|
if ($type == 'CHQ') {
|
||||||
|
print $langs->trans("DateChequeReceived");
|
||||||
|
} else {
|
||||||
|
print $langs->trans("DatePaymentForDeposit");
|
||||||
|
}
|
||||||
|
print '</td><td>';
|
||||||
// filter by dates from / to
|
// filter by dates from / to
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
print $form->selectDate($search_date_start, 'search_date_start_', 0, 0, 1, '', 1, 1, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
print $form->selectDate($search_date_start, 'search_date_start_', 0, 0, 1, '', 1, 1, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
||||||
@ -402,7 +424,7 @@ if ($action == 'new') {
|
|||||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
|
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement as p ON p.fk_bank = b.rowid";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement as p ON p.fk_bank = b.rowid";
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON (b.fk_account = ba.rowid)";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON (b.fk_account = ba.rowid)";
|
||||||
$sql .= " WHERE b.fk_type = 'CHQ'";
|
$sql .= " WHERE b.fk_type = '".$db->escape($type)."'";
|
||||||
$sql .= " AND ba.entity IN (".getEntity('bank_account').")";
|
$sql .= " AND ba.entity IN (".getEntity('bank_account').")";
|
||||||
$sql .= " AND b.fk_bordereau = 0";
|
$sql .= " AND b.fk_bordereau = 0";
|
||||||
$sql .= " AND b.amount > 0";
|
$sql .= " AND b.amount > 0";
|
||||||
@ -437,7 +459,11 @@ if ($action == 'new') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($i == 0) {
|
if ($i == 0) {
|
||||||
print '<div class="opacitymedium">'.$langs->trans("NoWaitingChecks").'</div><br>';
|
if ($type == 'CHQ') {
|
||||||
|
print '<div class="opacitymedium">'.$langs->trans("NoWaitingChecks").'</div><br>';
|
||||||
|
} else {
|
||||||
|
print '<div class="opacitymedium">'.$langs->trans("NoWaitingPaymentForDeposit", $type).'</div><br>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -462,6 +488,7 @@ if ($action == 'new') {
|
|||||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
print '<input type="hidden" name="action" value="create">';
|
print '<input type="hidden" name="action" value="create">';
|
||||||
|
print '<input type="hidden" name="type" value="'.$type.'">';
|
||||||
print '<input type="hidden" name="accountid" value="'.$bid.'">';
|
print '<input type="hidden" name="accountid" value="'.$bid.'">';
|
||||||
|
|
||||||
$moreforfilter = '';
|
$moreforfilter = '';
|
||||||
@ -469,11 +496,17 @@ if ($action == 'new') {
|
|||||||
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("DateChequeReceived").'</td>'."\n";
|
print '<td>';
|
||||||
|
if ($type == 'CHQ') {
|
||||||
|
print $langs->trans("DateChequeReceived");
|
||||||
|
} else {
|
||||||
|
print $langs->trans("DatePaymentForDepositReceived", $type);
|
||||||
|
}
|
||||||
|
print '</td>'."\n";
|
||||||
print '<td>'.$langs->trans("ChequeNumber")."</td>\n";
|
print '<td>'.$langs->trans("ChequeNumber")."</td>\n";
|
||||||
print '<td>'.$langs->trans("CheckTransmitter")."</td>\n";
|
print '<td>'.$langs->trans("CheckTransmitter")."</td>\n";
|
||||||
print '<td>'.$langs->trans("Bank")."</td>\n";
|
print '<td>'.$langs->trans("Bank")."</td>\n";
|
||||||
print '<td>'.$langs->trans("Amount")."</td>\n";
|
print '<td class="right">'.$langs->trans("Amount")."</td>\n";
|
||||||
print '<td class="center">'.$langs->trans("Payment")."</td>\n";
|
print '<td class="center">'.$langs->trans("Payment")."</td>\n";
|
||||||
print '<td class="center">'.$langs->trans("LineRecord")."</td>\n";
|
print '<td class="center">'.$langs->trans("LineRecord")."</td>\n";
|
||||||
print '<td class="center">'.$langs->trans("Select")."<br>";
|
print '<td class="center">'.$langs->trans("Select")."<br>";
|
||||||
@ -632,7 +665,7 @@ if ($action == 'new') {
|
|||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON (b.fk_account = ba.rowid)";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON (b.fk_account = ba.rowid)";
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement as p ON p.fk_bank = b.rowid";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement as p ON p.fk_bank = b.rowid";
|
||||||
$sql .= " WHERE ba.entity IN (".getEntity('bank_account').")";
|
$sql .= " WHERE ba.entity IN (".getEntity('bank_account').")";
|
||||||
$sql .= " AND b.fk_type= 'CHQ'";
|
$sql .= " AND b.fk_type= '".$db->escape($type)."'";
|
||||||
$sql .= " AND b.fk_bordereau = ".((int) $object->id);
|
$sql .= " AND b.fk_bordereau = ".((int) $object->id);
|
||||||
$sql .= $db->order($sortfield, $sortorder);
|
$sql .= $db->order($sortfield, $sortorder);
|
||||||
|
|
||||||
|
|||||||
@ -53,6 +53,8 @@ class RemiseCheque extends CommonObject
|
|||||||
//! Numero d'erreur Plage 1024-1279
|
//! Numero d'erreur Plage 1024-1279
|
||||||
public $errno;
|
public $errno;
|
||||||
|
|
||||||
|
public $type = 'CHQ'; // 'CHQ', 'TRA', ...
|
||||||
|
|
||||||
public $amount;
|
public $amount;
|
||||||
public $date_bordereau;
|
public $date_bordereau;
|
||||||
public $account_id;
|
public $account_id;
|
||||||
@ -92,9 +94,9 @@ class RemiseCheque extends CommonObject
|
|||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$sql = "SELECT bc.rowid, bc.datec, bc.fk_user_author, bc.fk_bank_account, bc.amount, bc.ref, bc.statut, bc.nbcheque, bc.ref_ext";
|
$sql = "SELECT bc.rowid, bc.datec, bc.fk_user_author, bc.fk_bank_account, bc.amount, bc.ref, bc.statut, bc.nbcheque, bc.ref_ext,";
|
||||||
$sql .= ", bc.date_bordereau as date_bordereau";
|
$sql .= " bc.date_bordereau as date_bordereau, bc.type,";
|
||||||
$sql .= ", ba.label as account_label";
|
$sql .= " ba.label as account_label";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc";
|
$sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc";
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON bc.fk_bank_account = ba.rowid";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON bc.fk_bank_account = ba.rowid";
|
||||||
$sql .= " WHERE bc.entity = ".$conf->entity;
|
$sql .= " WHERE bc.entity = ".$conf->entity;
|
||||||
@ -118,6 +120,7 @@ class RemiseCheque extends CommonObject
|
|||||||
$this->nbcheque = $obj->nbcheque;
|
$this->nbcheque = $obj->nbcheque;
|
||||||
$this->statut = $obj->statut;
|
$this->statut = $obj->statut;
|
||||||
$this->ref_ext = $obj->ref_ext;
|
$this->ref_ext = $obj->ref_ext;
|
||||||
|
$this->type = $obj->type;
|
||||||
|
|
||||||
if ($this->statut == 0) {
|
if ($this->statut == 0) {
|
||||||
$this->ref = "(PROV".$this->id.")";
|
$this->ref = "(PROV".$this->id.")";
|
||||||
@ -154,6 +157,11 @@ class RemiseCheque extends CommonObject
|
|||||||
|
|
||||||
dol_syslog("RemiseCheque::Create start", LOG_DEBUG);
|
dol_syslog("RemiseCheque::Create start", LOG_DEBUG);
|
||||||
|
|
||||||
|
// Clean parameters
|
||||||
|
if (empty($this->type)) {
|
||||||
|
$this->type = 'CHQ';
|
||||||
|
}
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bordereau_cheque (";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bordereau_cheque (";
|
||||||
@ -167,6 +175,7 @@ class RemiseCheque extends CommonObject
|
|||||||
$sql .= ", entity";
|
$sql .= ", entity";
|
||||||
$sql .= ", nbcheque";
|
$sql .= ", nbcheque";
|
||||||
$sql .= ", ref_ext";
|
$sql .= ", ref_ext";
|
||||||
|
$sql .= ", type";
|
||||||
$sql .= ") VALUES (";
|
$sql .= ") VALUES (";
|
||||||
$sql .= "'".$this->db->idate($now)."'";
|
$sql .= "'".$this->db->idate($now)."'";
|
||||||
$sql .= ", '".$this->db->idate($now)."'";
|
$sql .= ", '".$this->db->idate($now)."'";
|
||||||
@ -178,6 +187,7 @@ class RemiseCheque extends CommonObject
|
|||||||
$sql .= ", ".((int) $conf->entity);
|
$sql .= ", ".((int) $conf->entity);
|
||||||
$sql .= ", 0";
|
$sql .= ", 0";
|
||||||
$sql .= ", ''";
|
$sql .= ", ''";
|
||||||
|
$sql .= ", '".$this->db->escape($this->type)."'";
|
||||||
$sql .= ")";
|
$sql .= ")";
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
@ -278,9 +288,9 @@ class RemiseCheque extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Supprime la remise en base
|
* Delete deposit from database
|
||||||
*
|
*
|
||||||
* @param User $user Utilisateur qui effectue l'operation
|
* @param User $user User that delete
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function delete($user = '')
|
public function delete($user = '')
|
||||||
@ -464,10 +474,11 @@ class RemiseCheque extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
|
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
|
||||||
*
|
*
|
||||||
* @param User $user Objet user
|
* @param User $user Objet user
|
||||||
|
* @param string $type Type of payment mode deposit ('CHQ', 'TRA', ...)
|
||||||
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
|
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
|
||||||
*/
|
*/
|
||||||
public function load_board($user)
|
public function load_board($user, $type = 'CHQ')
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
@ -481,7 +492,7 @@ class RemiseCheque extends CommonObject
|
|||||||
$sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
$sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
||||||
$sql .= " WHERE b.fk_account = ba.rowid";
|
$sql .= " WHERE b.fk_account = ba.rowid";
|
||||||
$sql .= " AND ba.entity IN (".getEntity('bank_account').")";
|
$sql .= " AND ba.entity IN (".getEntity('bank_account').")";
|
||||||
$sql .= " AND b.fk_type = 'CHQ'";
|
$sql .= " AND b.fk_type = '".$this->db->escape($type)."'";
|
||||||
$sql .= " AND b.fk_bordereau = 0";
|
$sql .= " AND b.fk_bordereau = 0";
|
||||||
$sql .= " AND b.amount > 0";
|
$sql .= " AND b.amount > 0";
|
||||||
|
|
||||||
@ -518,9 +529,10 @@ class RemiseCheque extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Charge indicateurs this->nb de tableau de bord
|
* Charge indicateurs this->nb de tableau de bord
|
||||||
*
|
*
|
||||||
* @return int <0 if ko, >0 if ok
|
* @param string $type Type of payment mode deposit ('CHQ', 'TRA', ...)
|
||||||
|
* @return int <0 if ko, >0 if ok
|
||||||
*/
|
*/
|
||||||
public function load_state_board()
|
public function load_state_board($type = 'CHQ')
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $user;
|
global $user;
|
||||||
@ -534,7 +546,7 @@ class RemiseCheque extends CommonObject
|
|||||||
$sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
$sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
||||||
$sql .= " WHERE b.fk_account = ba.rowid";
|
$sql .= " WHERE b.fk_account = ba.rowid";
|
||||||
$sql .= " AND ba.entity IN (".getEntity('bank_account').")";
|
$sql .= " AND ba.entity IN (".getEntity('bank_account').")";
|
||||||
$sql .= " AND b.fk_type = 'CHQ'";
|
$sql .= " AND b.fk_type = '".$this->db->escape($type)."'";
|
||||||
$sql .= " AND b.amount > 0";
|
$sql .= " AND b.amount > 0";
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
@ -615,7 +627,7 @@ class RemiseCheque extends CommonObject
|
|||||||
|
|
||||||
// We save charset_output to restore it because write_file can change it if needed for
|
// We save charset_output to restore it because write_file can change it if needed for
|
||||||
// output format that does not support UTF8.
|
// output format that does not support UTF8.
|
||||||
$sav_charseSupprimert_output = $outputlangs->charset_output;
|
$sav_charset_output = $outputlangs->charset_output;
|
||||||
|
|
||||||
$result = $docmodel->write_file($this, $conf->bank->dir_output.'/checkdeposits', $this->ref, $outputlangs);
|
$result = $docmodel->write_file($this, $conf->bank->dir_output.'/checkdeposits', $this->ref, $outputlangs);
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
@ -664,7 +676,7 @@ class RemiseCheque extends CommonObject
|
|||||||
$sql .= " SET amount = ".price2num($total);
|
$sql .= " SET amount = ".price2num($total);
|
||||||
$sql .= ", nbcheque = ".((int) $nb);
|
$sql .= ", nbcheque = ".((int) $nb);
|
||||||
$sql .= " WHERE rowid = ".((int) $this->id);
|
$sql .= " WHERE rowid = ".((int) $this->id);
|
||||||
$sql .= " AND entity = ".$conf->entity;
|
$sql .= " AND entity = ".((int) $conf->entity);
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql) {
|
if (!$resql) {
|
||||||
@ -813,7 +825,7 @@ class RemiseCheque extends CommonObject
|
|||||||
|
|
||||||
$sql = "SELECT MAX(rowid)";
|
$sql = "SELECT MAX(rowid)";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque";
|
$sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque";
|
||||||
$sql .= " WHERE rowid < ".$this->id;
|
$sql .= " WHERE rowid < ".((int) $this->id);
|
||||||
$sql .= " AND entity = ".$conf->entity;
|
$sql .= " AND entity = ".$conf->entity;
|
||||||
|
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
@ -825,7 +837,7 @@ class RemiseCheque extends CommonObject
|
|||||||
|
|
||||||
$sql = "SELECT MIN(rowid)";
|
$sql = "SELECT MIN(rowid)";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque";
|
$sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque";
|
||||||
$sql .= " WHERE rowid > ".$this->id;
|
$sql .= " WHERE rowid > ".((int) $this->id);
|
||||||
$sql .= " AND entity = ".$conf->entity;
|
$sql .= " AND entity = ".$conf->entity;
|
||||||
|
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
|
|||||||
@ -66,16 +66,11 @@ print load_fiche_titre($langs->trans("ChequesArea"), $newcardbutton, $checkdepos
|
|||||||
|
|
||||||
print '<div class="fichecenter"><div class="fichethirdleft">';
|
print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||||
|
|
||||||
$sql = "SELECT count(b.rowid) as nb";
|
// List of payment mode to support
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
|
// Example: BANK_PAYMENT_MODES_FOR_DEPOSIT_MANAGEMENT = 'CHQ','TRA'
|
||||||
$sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
$conf->global->BANK_PAYMENT_MODES_FOR_DEPOSIT_MANAGEMENT = 'CHQ,TRA';
|
||||||
$sql .= " WHERE ba.rowid = b.fk_account";
|
$arrayofpaymentmodetomanage = explode(',', getDolGlobalString('BANK_PAYMENT_MODES_FOR_DEPOSIT_MANAGEMENT', 'CHQ'));
|
||||||
$sql .= " AND ba.entity IN (".getEntity('bank_account').")";
|
|
||||||
$sql .= " AND b.fk_type = 'CHQ'";
|
|
||||||
$sql .= " AND b.fk_bordereau = 0";
|
|
||||||
$sql .= " AND b.amount > 0";
|
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
|
||||||
|
|
||||||
print '<div class="div-table-responsive-no-min">';
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder centpercent">';
|
print '<table class="noborder centpercent">';
|
||||||
@ -83,19 +78,38 @@ print '<tr class="liste_titre">';
|
|||||||
print '<th colspan="2">'.$langs->trans("BankChecks")."</th>\n";
|
print '<th colspan="2">'.$langs->trans("BankChecks")."</th>\n";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
if ($resql) {
|
foreach ($arrayofpaymentmodetomanage as $val) {
|
||||||
$num = '';
|
$sql = "SELECT count(b.rowid) as nb";
|
||||||
if ($obj = $db->fetch_object($resql)) {
|
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||||
$num = $obj->nb;
|
$sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
||||||
|
$sql .= " WHERE ba.rowid = b.fk_account";
|
||||||
|
$sql .= " AND ba.entity IN (".getEntity('bank_account').")";
|
||||||
|
$sql .= " AND b.fk_type = '".$db->escape($val)."'";
|
||||||
|
$sql .= " AND b.fk_bordereau = 0";
|
||||||
|
$sql .= " AND b.amount > 0";
|
||||||
|
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if ($resql) {
|
||||||
|
$num = '';
|
||||||
|
if ($obj = $db->fetch_object($resql)) {
|
||||||
|
$num = $obj->nb;
|
||||||
|
}
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
print '<td>';
|
||||||
|
if ($val == 'CHQ') {
|
||||||
|
print $langs->trans("BankChecksToReceipt");
|
||||||
|
} else {
|
||||||
|
print $val;
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
print '<td class="right">';
|
||||||
|
print '<a class="badge badge-info" href="'.DOL_URL_ROOT.'/compta/paiement/cheque/card.php?leftmenu=customers_bills_checks&action=new&type='.urlencode($val).'">'.dol_escape_htmltag($num).'</a>';
|
||||||
|
print '</td></tr>';
|
||||||
|
} else {
|
||||||
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
print '<tr class="oddeven">';
|
|
||||||
print '<td>'.$langs->trans("BankChecksToReceipt").'</td>';
|
|
||||||
print '<td class="right">';
|
|
||||||
print '<a class="badge badge-info" href="'.DOL_URL_ROOT.'/compta/paiement/cheque/card.php?leftmenu=customers_bills_checks&action=new">'.$num.'</a>';
|
|
||||||
print '</td></tr>';
|
|
||||||
} else {
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</table></div>\n";
|
print "</table></div>\n";
|
||||||
|
|
||||||
|
|
||||||
@ -103,64 +117,78 @@ print '</div><div class="fichetwothirdright">';
|
|||||||
|
|
||||||
$max = 10;
|
$max = 10;
|
||||||
|
|
||||||
$sql = "SELECT bc.rowid, bc.date_bordereau as db, bc.amount, bc.ref as ref,";
|
foreach ($arrayofpaymentmodetomanage as $val) {
|
||||||
$sql .= " bc.statut, bc.nbcheque,";
|
$sql = "SELECT bc.rowid, bc.date_bordereau as db, bc.amount, bc.ref as ref,";
|
||||||
$sql .= " ba.ref as bref, ba.label, ba.rowid as bid, ba.number, ba.currency_code, ba.account_number, ba.fk_accountancy_journal,";
|
$sql .= " bc.statut, bc.nbcheque, bc.type,";
|
||||||
$sql .= " aj.code";
|
$sql .= " ba.ref as bref, ba.label, ba.rowid as bid, ba.number, ba.currency_code, ba.account_number, ba.fk_accountancy_journal,";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc, ".MAIN_DB_PREFIX."bank_account as ba";
|
$sql .= " aj.code";
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_journal as aj ON aj.rowid = ba.fk_accountancy_journal";
|
$sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc, ".MAIN_DB_PREFIX."bank_account as ba";
|
||||||
$sql .= " WHERE ba.rowid = bc.fk_bank_account";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_journal as aj ON aj.rowid = ba.fk_accountancy_journal";
|
||||||
$sql .= " AND bc.entity = ".$conf->entity;
|
$sql .= " WHERE ba.rowid = bc.fk_bank_account";
|
||||||
$sql .= " ORDER BY bc.date_bordereau DESC, rowid DESC";
|
$sql .= " AND bc.entity = ".((int) $conf->entity);
|
||||||
$sql .= $db->plimit($max);
|
$sql .= " AND bc.type = '".$db->escape($type)."'";
|
||||||
|
$sql .= " ORDER BY bc.date_bordereau DESC, rowid DESC";
|
||||||
|
$sql .= $db->plimit($max);
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||||
print '<table class="noborder centpercent">';
|
print '<table class="noborder centpercent">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<th>'.$langs->trans("LastCheckReceiptShort", $max).'</th>';
|
print '<th>';
|
||||||
print '<th>'.$langs->trans("Date")."</th>";
|
if ($val == 'CHQ') {
|
||||||
print '<th>'.$langs->trans("Account").'</th>';
|
print $langs->trans("LastCheckReceiptShort", $max);
|
||||||
print '<th class="right">'.$langs->trans("NbOfCheques").'</th>';
|
} else {
|
||||||
print '<th class="right">'.$langs->trans("Amount").'</th>';
|
print $langs->trans("LastPaymentForDepositShort", $max, $val);
|
||||||
print '<th class="right">'.$langs->trans("Status").'</th>';
|
}
|
||||||
print "</tr>\n";
|
print '</th>';
|
||||||
|
print '<th>'.$langs->trans("Date")."</th>";
|
||||||
|
print '<th>'.$langs->trans("Account").'</th>';
|
||||||
|
print '<th class="right">'.$langs->trans("NbOfCheques").'</th>';
|
||||||
|
print '<th class="right">'.$langs->trans("Amount").'</th>';
|
||||||
|
print '<th class="right">'.$langs->trans("Status").'</th>';
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
while ($objp = $db->fetch_object($resql)) {
|
$i = 0;
|
||||||
$checkdepositstatic->id = $objp->rowid;
|
while ($objp = $db->fetch_object($resql)) {
|
||||||
$checkdepositstatic->ref = ($objp->ref ? $objp->ref : $objp->rowid);
|
$i++;
|
||||||
$checkdepositstatic->statut = $objp->statut;
|
|
||||||
|
|
||||||
$accountstatic->id = $objp->bid;
|
$checkdepositstatic->id = $objp->rowid;
|
||||||
$accountstatic->ref = $objp->bref;
|
$checkdepositstatic->ref = ($objp->ref ? $objp->ref : $objp->rowid);
|
||||||
$accountstatic->label = $objp->label;
|
$checkdepositstatic->statut = $objp->statut;
|
||||||
$accountstatic->number = $objp->number;
|
|
||||||
$accountstatic->currency_code = $objp->currency_code;
|
|
||||||
$accountstatic->account_number = $objp->account_number;
|
|
||||||
$accountstatic->accountancy_journal = $objp->code;
|
|
||||||
$accountstatic->fk_accountancy_journal = $objp->fk_accountancy_journal;
|
|
||||||
|
|
||||||
print '<tr class="oddeven">'."\n";
|
$accountstatic->id = $objp->bid;
|
||||||
|
$accountstatic->ref = $objp->bref;
|
||||||
|
$accountstatic->label = $objp->label;
|
||||||
|
$accountstatic->number = $objp->number;
|
||||||
|
$accountstatic->currency_code = $objp->currency_code;
|
||||||
|
$accountstatic->account_number = $objp->account_number;
|
||||||
|
$accountstatic->accountancy_journal = $objp->code;
|
||||||
|
$accountstatic->fk_accountancy_journal = $objp->fk_accountancy_journal;
|
||||||
|
|
||||||
print '<td class="nowraponall">'.$checkdepositstatic->getNomUrl(1).'</td>';
|
print '<tr class="oddeven">'."\n";
|
||||||
print '<td>'.dol_print_date($db->jdate($objp->db), 'day').'</td>';
|
|
||||||
print '<td class="nowraponall">'.$accountstatic->getNomUrl(1).'</td>';
|
|
||||||
print '<td class="right">'.$objp->nbcheque.'</td>';
|
|
||||||
print '<td class="right"><span class="amount">'.price($objp->amount).'</span></td>';
|
|
||||||
print '<td class="right">'.$checkdepositstatic->LibStatut($objp->statut, 3).'</td>';
|
|
||||||
|
|
||||||
print '</tr>';
|
print '<td class="nowraponall">'.$checkdepositstatic->getNomUrl(1).'</td>';
|
||||||
|
print '<td>'.dol_print_date($db->jdate($objp->db), 'day').'</td>';
|
||||||
|
print '<td class="nowraponall">'.$accountstatic->getNomUrl(1).'</td>';
|
||||||
|
print '<td class="right">'.$objp->nbcheque.'</td>';
|
||||||
|
print '<td class="right"><span class="amount">'.price($objp->amount).'</span></td>';
|
||||||
|
print '<td class="right">'.$checkdepositstatic->LibStatut($objp->statut, 3).'</td>';
|
||||||
|
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
if ($i == 0) {
|
||||||
|
print '<tr><td colspan="6"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
|
||||||
|
}
|
||||||
|
print "</table>";
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
$db->free($resql);
|
||||||
|
} else {
|
||||||
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
print "</table>";
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
$db->free($resql);
|
|
||||||
} else {
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
print '</div></div>';
|
print '</div></div>';
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
|
|||||||
@ -98,3 +98,5 @@ UPDATE llx_prelevement_demande SET type = 'ban' WHERE ext_payment_id IS NULL AND
|
|||||||
|
|
||||||
ALTER TABLE llx_recruitment_recruitmentcandidature ADD COLUMN fk_user integer;
|
ALTER TABLE llx_recruitment_recruitmentcandidature ADD COLUMN fk_user integer;
|
||||||
|
|
||||||
|
ALTER TABLE llx_bordereau_cheque ADD COLUMN type VARCHAR(6) DEFAULT 'CHQ';
|
||||||
|
|
||||||
|
|||||||
@ -26,6 +26,7 @@ create table llx_bordereau_cheque
|
|||||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
ref varchar(30) NOT NULL, -- ref
|
ref varchar(30) NOT NULL, -- ref
|
||||||
ref_ext varchar(255), -- ref_ext
|
ref_ext varchar(255), -- ref_ext
|
||||||
|
type varchar(6) DEFAULT 'CHQ', -- 'CHQ', 'TRA', ...
|
||||||
datec datetime NOT NULL,
|
datec datetime NOT NULL,
|
||||||
date_bordereau date,
|
date_bordereau date,
|
||||||
amount double(24,8) NOT NULL,
|
amount double(24,8) NOT NULL,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user