diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index a4deeb51b90..e3293718784 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -90,6 +90,10 @@ $usercandelete = $user->rights->banque->cheque; $permissiontodelete = $user->rights->banque->cheque; +// List of payment mode to support +// Example: BANK_PAYMENT_MODES_FOR_DEPOSIT_MANAGEMENT = 'CHQ','TRA' +$arrayofpaymentmodetomanage = explode(',', getDolGlobalString('BANK_PAYMENT_MODES_FOR_DEPOSIT_MANAGEMENT', 'CHQ')); + /* * Actions @@ -139,6 +143,10 @@ if ($action == 'setref' && $user->rights->banque->cheque) { if ($action == 'create' && GETPOST("accountid", "int") > 0 && $user->rights->banque->cheque) { if (GETPOSTISARRAY('toRemise')) { + $object->type = $type; + $arrayofid = GETPOST('toRemise', 'array:int'); + var_dump($arrayofid); + $result = $object->create($user, GETPOST("accountid", "int"), 0, GETPOST('toRemise', 'array:int')); if ($result > 0) { if ($object->statut == 1) { // If statut is validated, we build doc @@ -292,10 +300,14 @@ if (GETPOST('removefilter')) { $filteraccountid = 0; } -if ($type == 'CHQ') { - $title = $langs->trans("Cheques"); +if ($action == 'new') { + $title = $langs->trans("NewChequeDeposit"); } else { - $title = $type; + if ($type == 'CHQ') { + $title = $langs->trans("Cheques"); + } else { + $title = ($langs->trans("PaymentType".$type) != "PaymentType".$type ? $langs->trans("PaymentType".$type) : $langs->trans("PaymentMode").' '.$type); + } } $helpurl = ""; @@ -368,27 +380,40 @@ if ($action == 'new') { $now = dol_now(); + $labeltype = ($langs->trans("PaymentType".$type) != "PaymentType".$type ? $langs->trans("PaymentType".$type) : $type); if ($type == 'CHQ') { print ''.$langs->trans("SelectChequeTransactionAndGenerate").'

'."\n"; } else { - print ''.$langs->trans("SelectPaymentTransactionAndGenerate", $type).'

'."\n"; + print ''.$langs->trans("SelectPaymentTransactionAndGenerate", $labeltype).'

'."\n"; } print '
'; print ''; print ''; - print ''; print dol_get_fiche_head(); print ''; - //print ''; - // Filter + + if (count($arrayofpaymentmodetomanage) > 1) { + $arrayoflabels = array(); + foreach ($arrayofpaymentmodetomanage as $key => $val) { + $labelval = ($langs->trans("PaymentType".$val) != "PaymentType".$val ? $langs->trans("PaymentType".$val) : $val); + $arrayoflabels[$key] = $labelval; + } + // Type + print ''; + } + // Date print ''; + print ''; } print "
'.$langs->trans('Date').''.dol_print_date($now,'day').'
'; + print $langs->trans("Type"); + print ''; + print $form->selectarray('type', $arrayoflabels, $type); + print '
'; if ($type == 'CHQ') { print $langs->trans("DateChequeReceived"); } else { - print $langs->trans("DatePaymentForDeposit"); + print $langs->trans("DatePaymentReceived"); } print ''; // filter by dates from / to @@ -462,7 +487,7 @@ if ($action == 'new') { if ($type == 'CHQ') { print '
'.$langs->trans("NoWaitingChecks").'

'; } else { - print '
'.$langs->trans("NoWaitingPaymentForDeposit", $type).'

'; + print '
'.$langs->trans("NoWaitingPaymentForDeposit", $labeltype).'

'; } } } @@ -485,6 +510,7 @@ if ($action == 'new') { '; $num = $db->num_rows($resql); + print ''; print ''; print ''; @@ -574,7 +600,13 @@ if ($action == 'new') { $linkback = ''.$langs->trans("BackToList").''; $morehtmlref = ''; - dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + $morehtmlleft = ''; + $moreghtmlright = ''; + + $labelval = ($langs->trans("PaymentType".$object->type) != "PaymentType".$object->type ? $langs->trans("PaymentType".$object->type) : $object->type); + $morehtmlref = '
'.$langs->trans("Type").' : '.$labelval.'
'; + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, $morehtmlleft, '', 0, $moreghtmlright); print '
'; @@ -665,7 +697,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."paiement as p ON p.fk_bank = b.rowid"; $sql .= " WHERE ba.entity IN (".getEntity('bank_account').")"; - $sql .= " AND b.fk_type= '".$db->escape($type)."'"; + $sql .= " AND b.fk_type= '".$db->escape($object->type)."'"; $sql .= " AND b.fk_bordereau = ".((int) $object->id); $sql .= $db->order($sortfield, $sortorder); @@ -739,9 +771,9 @@ if ($action == 'new') { $i++; } } else { - print '
'; + print ''; print $langs->trans("None"); - print '
"; diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index ceed5a98a61..e84b0004564 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -215,7 +215,7 @@ class RemiseCheque extends CommonObject if ($this->id > 0 && $this->errno == 0) { $sql = "SELECT b.rowid"; $sql .= " FROM ".MAIN_DB_PREFIX."bank as b"; - $sql .= " WHERE b.fk_type = 'CHQ'"; + $sql .= " WHERE b.fk_type = '".$this->db->escape($this->type)."'"; $sql .= " AND b.amount > 0"; $sql .= " AND b.fk_bordereau = 0"; $sql .= " AND b.fk_account = ".((int) $account_id); diff --git a/htdocs/compta/paiement/cheque/index.php b/htdocs/compta/paiement/cheque/index.php index 5e1b69f655d..5acdf8f5401 100644 --- a/htdocs/compta/paiement/cheque/index.php +++ b/htdocs/compta/paiement/cheque/index.php @@ -43,6 +43,10 @@ $result = restrictedArea($user, 'banque', '', ''); $usercancreate = $user->hasRight('banque', 'cheque'); +// List of payment mode to support +// Example: BANK_PAYMENT_MODES_FOR_DEPOSIT_MANAGEMENT = 'CHQ','TRA' +$arrayofpaymentmodetomanage = explode(',', getDolGlobalString('BANK_PAYMENT_MODES_FOR_DEPOSIT_MANAGEMENT', 'CHQ')); + /* * Actions @@ -55,27 +59,27 @@ $usercancreate = $user->hasRight('banque', 'cheque'); * View */ -llxHeader('', $langs->trans("ChequesArea")); +if (getDolGlobalString('BANK_PAYMENT_MODES_FOR_DEPOSIT_MANAGEMENT', 'CHQ') == 'CHQ') { + $title = $langs->trans("ChequesArea"); +} else { + $title = $langs->trans("DocumentsDepositArea"); +} + +llxHeader('', $title); $newcardbutton = ''; if ($usercancreate) { $newcardbutton .= dolGetButtonTitle($langs->trans('NewDeposit'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/paiement/cheque/card.php?action=new'); } -print load_fiche_titre($langs->trans("ChequesArea"), $newcardbutton, $checkdepositstatic->picto); +print load_fiche_titre($title, $newcardbutton, $checkdepositstatic->picto); print '
'; -// List of payment mode to support -// Example: BANK_PAYMENT_MODES_FOR_DEPOSIT_MANAGEMENT = 'CHQ','TRA' -$conf->global->BANK_PAYMENT_MODES_FOR_DEPOSIT_MANAGEMENT = 'CHQ,TRA'; -$arrayofpaymentmodetomanage = explode(',', getDolGlobalString('BANK_PAYMENT_MODES_FOR_DEPOSIT_MANAGEMENT', 'CHQ')); - - print '
'; print ''; print ''; -print '\n"; +print '\n"; print "\n"; foreach ($arrayofpaymentmodetomanage as $val) { @@ -97,9 +101,9 @@ foreach ($arrayofpaymentmodetomanage as $val) { print ''; print ''; print '"; diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index 3c617a2db0c..11748c5c870 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -73,6 +73,16 @@ $formother = new FormOther($db); $checkdepositstatic = new RemiseCheque($db); $accountstatic = new Account($db); +// List of payment mode to support +// Example: BANK_PAYMENT_MODES_FOR_DEPOSIT_MANAGEMENT = 'CHQ','TRA' +$arrayofpaymentmodetomanage = explode(',', getDolGlobalString('BANK_PAYMENT_MODES_FOR_DEPOSIT_MANAGEMENT', 'CHQ')); + +$arrayoflabels = array(); +foreach ($arrayofpaymentmodetomanage as $key => $val) { + $labelval = ($langs->trans("PaymentType".$val) != "PaymentType".$val ? $langs->trans("PaymentType".$val) : $val); + $arrayoflabels[$key] = $labelval; +} + /* * Actions @@ -93,10 +103,10 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' * View */ -llxHeader('', $langs->trans("ChequesReceipts")); +llxHeader('', $langs->trans("ChequeDeposits")); $sql = "SELECT bc.rowid, bc.ref, bc.date_bordereau,"; -$sql .= " bc.nbcheque, bc.amount, bc.statut,"; +$sql .= " bc.nbcheque, bc.amount, bc.statut, bc.type,"; $sql .= " ba.rowid as bid, ba.label"; $sqlfields = $sql; // $sql fields to remove for count total @@ -104,7 +114,7 @@ $sqlfields = $sql; // $sql fields to remove for count total $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; +$sql .= " AND bc.entity = ".((int) $conf->entity); // Search criteria if ($search_ref) { @@ -191,10 +201,13 @@ if ($resql) { // Fields title search print ''; - print ''; - print ''; + print ''; print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "bc.ref", "", $param, "", $sortfield, $sortorder); + print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "bc.type", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("DateCreation", $_SERVER["PHP_SELF"], "bc.date_bordereau", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("NbOfCheques", $_SERVER["PHP_SELF"], "bc.nbcheque", "", $param, 'class="right"', $sortfield, $sortorder); @@ -236,6 +250,7 @@ if ($resql) { $checkdepositstatic->nbcheque = $objp->nbcheque; $checkdepositstatic->amount = $objp->amount; $checkdepositstatic->date_bordereau = $objp->date_bordereau; + $checkdepositstatic->type = $objp->type; $account = new Account($db); $account->fetch($objp->bid); @@ -257,12 +272,15 @@ if ($resql) { // Num ref cheque print ''; + // Type + $labelpaymentmode = ($langs->transnoentitiesnoconv("PaymentType".$checkdepositstatic->type) != "PaymentType".$checkdepositstatic->type ? $langs->transnoentitiesnoconv("PaymentType".$checkdepositstatic->type) : $checkdepositstatic->type); + print ''; + // Date - print ''; // TODO Use date hour + print ''; // Bank print '
'.$langs->trans("BankChecks")."'.$langs->trans("DocumentsForDeposit")."
'; if ($val == 'CHQ') { - print $langs->trans("BankChecksToReceipt"); + print $langs->trans("BankChecks"); } else { - print $val; + print ($langs->trans("PaymentType".$val) != "PaymentType".$val ? $langs->trans("PaymentType".$val) : $langs->trans("PaymentMode").' '.$val); } print ''; @@ -139,7 +143,8 @@ foreach ($arrayofpaymentmodetomanage as $val) { if ($val == 'CHQ') { print $langs->trans("LastCheckReceiptShort", $max); } else { - print $langs->trans("LastPaymentForDepositShort", $max, $val); + $labelpaymentmode = ($langs->trans("PaymentType".$val) != "PaymentType".$val ? $langs->trans("PaymentType".$val) : $val); + print $langs->trans("LastPaymentForDepositShort", $max, $labelpaymentmode); } print ''; print ''.$langs->trans("Date")."
'; + print ''; print ''; print ''; + // Type + print ''; + print ''; if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { print ''; } @@ -217,6 +230,7 @@ if ($resql) { print '
'; - print $checkdepositstatic->getNomUrl(1); print ''.dol_escape_htmltag($labelpaymentmode).''.dol_print_date($db->jdate($objp->date_bordereau), 'day').''.dol_print_date($db->jdate($objp->date_bordereau), 'dayhour', 'tzuser').''; diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index 7be02da2c27..2c895b48034 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -120,6 +120,7 @@ ValidateCheckReceipt=Validate this check receipt? ConfirmValidateCheckReceipt=Are you sure that you want to submit this check receipt for validation? No changes will be possible once validated. DeleteCheckReceipt=Delete this check receipt? ConfirmDeleteCheckReceipt=Are you sure you want to delete this check receipt? +DocumentsForDeposit=Documents to deposit at the bank BankChecks=Bank checks BankChecksToReceipt=Checks awaiting deposit BankChecksToReceiptShort=Checks awaiting deposit @@ -145,6 +146,7 @@ BackToAccount=Back to account ShowAllAccounts=Show for all accounts FutureTransaction=Future transaction. Unable to reconcile. SelectChequeTransactionAndGenerate=Select/filter the checks which are to be included in the check deposit receipt. Then, click on "Create". +SelectPaymentTransactionAndGenerate=Select/filter the documents which are to be included in the %s deposit receipt. Then, click on "Create". InputReceiptNumber=Choose the bank statement related with the conciliation. Use a sortable numeric value: YYYYMM or YYYYMMDD EventualyAddCategory=Eventually, specify a category in which to classify the records ToConciliate=To reconcile? diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 7ad897ab0e2..798ba129288 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -509,13 +509,14 @@ UseLine=Apply UseDiscount=Use discount UseCredit=Use credit UseCreditNoteInInvoicePayment=Reduce amount to pay with this credit -MenuChequeDeposits=Check Deposits +MenuChequeDeposits=Deposits slips MenuCheques=Checks -MenuChequesReceipts=Check receipts -NewChequeDeposit=New deposit -ChequesReceipts=Check receipts -ChequesArea=Check deposits area -ChequeDeposits=Check deposits +MenuChequesReceipts=Deposit slips +NewChequeDeposit=New deposit slip +ChequesReceipts=Cheque deposit slips +DocumentsDepositArea=Deposit slip area +ChequesArea=Deposit slips area +ChequeDeposits=Deposit slips Cheques=Checks DepositId=Id deposit NbCheque=Number of checks diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index b3d5f675830..0d286fb3104 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -130,14 +130,17 @@ SalesTurnoverMinimum=Minimum turnover ByExpenseIncome=By expenses & incomes ByThirdParties=By third parties ByUserAuthorOfInvoice=By invoice author -CheckReceipt=Check deposit -CheckReceiptShort=Check deposit -LastCheckReceiptShort=Latest %s check receipts +CheckReceipt=Deposit slip +CheckReceiptShort=Deposit slip +LastCheckReceiptShort=Latest %s deposit slips +LastPaymentForDepositShort=Latest %s %s deposit slips NewCheckReceipt=New discount -NewCheckDeposit=New check deposit +NewCheckDeposit=New deposit slip NewCheckDepositOn=Create receipt for deposit on account: %s NoWaitingChecks=No checks awaiting deposit. +NoWaitingPaymentForDeposit=No %s payment awaiting deposit. DateChequeReceived=Check receiving date +DatePaymentReceived=Date of document reception NbOfCheques=No. of checks PaySocialContribution=Pay a social/fiscal tax PayVAT=Pay a VAT declaration