diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index f5d17d686f3..26534fa212a 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -196,6 +196,7 @@ if ($user->societe_id > 0) llxHeader(); $html=new Form($db); +$facturestatic=new Facture($db); if ($fiche_erreur_message) { @@ -205,33 +206,28 @@ if ($fiche_erreur_message) if ($_GET['action'] == 'create' || $_POST['action'] == 'add_paiement') { $facture = new Facture($db); - $facture->fetch($facid); - - $sql = 'SELECT s.nom,s.idp, f.amount, f.total_ttc as total, f.facnumber'; - $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'facture as f WHERE f.fk_soc = s.idp'; - $sql .= ' AND f.rowid = '.$facid; - $resql = $db->query($sql); - if ($resql) + $result=$facture->fetch($facid); + + if ($result >= 0) { - $num = $db->num_rows($resql); - if ($num) - { - $obj = $db->fetch_object($resql); + $facture->fetch_client(); + + $total = $facture->total_ttc; - $total = $obj->total; - - print_titre($langs->trans('DoPayment')); + $title=''; + if ($facture->type != 2) $title.=$langs->trans("EnterPaymentReceivedFromCustomer"); + if ($facture->type == 2) $title.=$langs->trans("EnterPaymentDueToCustomer"); + print_fiche_titre($title); print '
'; print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print ''; - print '\n"; + print '\n"; print '\n"; print ''; + print ''; print ''; + print ''; if ($conf->banque->enabled) { - print ''; + if ($facture->type == 2) print ''; + print '\n"; + print ''; } else { - print ''; + print ''; } + print "\n"; /* * Autres factures impayées */ - $sql = 'SELECT f.rowid as facid,f.facnumber,f.total_ttc,'.$db->pdate('f.datef').' as df'; - $sql .= ', sum(pf.amount) as am'; - $sql .= ' FROM '.MAIN_DB_PREFIX.'facture as f'; - $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = f.rowid'; - $sql .= ' WHERE f.fk_soc = '.$facture->socid; - $sql .= ' AND f.paye = 0'; - $sql .= ' AND f.fk_statut = 1'; // Statut=0 => non validée, Statut=2 => annulée + $sql = 'SELECT f.rowid as facid, f.facnumber, f.total_ttc, f.type, '; + $sql.= $db->pdate('f.datef').' as df, '; + $sql.= ' sum(pf.amount) as am'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = f.rowid'; + $sql.= ' WHERE f.fk_soc = '.$facture->socid; + $sql.= ' AND f.paye = 0'; + $sql.= ' AND f.fk_statut = 1'; // Statut=0 => non validée, Statut=2 => annulée + if ($facture->type != 2) + { + $sql .= ' AND type in (0,1)'; // Facture standard ou de remplacement + } + else + { + $sql .= ' AND type = 2'; + } $sql .= ' GROUP BY f.facnumber'; $resql = $db->query($sql); if ($resql) @@ -283,7 +292,8 @@ if ($_GET['action'] == 'create' || $_POST['action'] == 'add_paiement') print '
'.$langs->trans('Company').''.img_object($langs->trans("ShowCompany"),'company').' '.$obj->nom."
'.$langs->trans('Company').''.$facture->client->getNomUrl(4)."
'.$langs->trans('Date').''; if (!empty($_POST['remonth']) && !empty($_POST['reday']) && !empty($_POST['reyear'])) @@ -247,31 +243,44 @@ if ($_GET['action'] == 'create' || $_POST['action'] == 'add_paiement') print "'; - print '
'.$langs->trans('Numero').'
Numéro du chèque / virement
'.$langs->trans('AccountToCredit').''; + if ($facture->type != 2) print ''.$langs->trans('AccountToCredit').''.$langs->trans('AccountToDebit').''; $html->select_comptes(empty($_POST['accountid'])?'':$_POST['accountid'],'accountid',0,'',1); - print "
 
 
'; print ''; print ''; - print ''; + print ''; + print ''; print ''; print ''; print ''; @@ -301,7 +311,11 @@ if ($_GET['action'] == 'create' || $_POST['action'] == 'add_paiement') print ''; - print '\n"; if ($objp->df > 0 ) @@ -354,7 +368,7 @@ if ($_GET['action'] == 'create' || $_POST['action'] == 'add_paiement') print ''; print '
'.$langs->trans('Bill').''.$langs->trans('Date').''.$langs->trans('Invoice').''.$langs->trans('Date').''.$langs->trans('AmountTTC').''.$langs->trans('Received').''.$langs->trans('RemainderToPay').'
'.img_object($langs->trans('ShowBill'),'bill').' '.$objp->facnumber; + print ''; + $facturestatic->ref=$objp->facnumber; + $facturestatic->id=$objp->rowid; + $facturestatic->type=$objp->type; + print $facturestatic->getNomUrl(1,''); print "
'; print "\n"; - } + } } @@ -419,5 +433,5 @@ if (! $_GET['action'] && ! $_POST['action']) $db->close(); -llxFooter('Dernière modification $Date$ révision $Revision$'); +llxFooter('$Date$ - $Revision$'); ?> diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index 5b03953bd95..15c60550d20 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -73,6 +73,7 @@ ConciliationForAccount=Conciliate this account IncludeClosedAccount=Include closed accounts OnlyOpenedAccount=Only opened accounts AccountToCredit=Account to credit +AccountToDebit=Account to debit DisableConciliation=Disable conciliation feature for this account ConciliationDisabled=Conciliation feature disabled StatusAccountOpened=Opened diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 8f83d440464..f69bd2b17ba 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -60,6 +60,8 @@ SendByMail=EMail SendRemindByMail=EMail reminder DoPaiement=Do payment DoPayment=Do payment +EnterPaymentReceivedFromCustomer=Enter payment received from customer +EnterPaymentDueToCustomer=Make payment due to customer VAT=VAT VATRate=VAT Rate Amount=Amount diff --git a/htdocs/langs/fr_FR/banks.lang b/htdocs/langs/fr_FR/banks.lang index fc7bc118b9e..025841aeee0 100644 --- a/htdocs/langs/fr_FR/banks.lang +++ b/htdocs/langs/fr_FR/banks.lang @@ -73,6 +73,7 @@ ConciliationForAccount=Rapprochements sur ce compte IncludeClosedAccount=Inclure comptes fermés OnlyOpenedAccount=Uniquement comptes ouverts AccountToCredit=Compte à créditer +AccountToDebit=Compte à débiter DisableConciliation=Désactiver la fonction de rapprochement pour ce compte ConciliationDisabled=Fonction rapprochement désactivée StatusAccountOpened=Ouvert diff --git a/htdocs/langs/fr_FR/bills.lang b/htdocs/langs/fr_FR/bills.lang index f3c5df54fa2..bad1b472889 100644 --- a/htdocs/langs/fr_FR/bills.lang +++ b/htdocs/langs/fr_FR/bills.lang @@ -60,6 +60,8 @@ SendByMail=Envoyer SendRemindByMail=Envoyer rappel DoPaiement=Émettre paiement DoPayment=Émettre paiement +EnterPaymentReceivedFromCustomer=Saisie d'un paiement reçu du client +EnterPaymentDueToCustomer=Réaliser paiement d'avoirs dus au client VAT=TVA VATRate=Taux TVA Amount=Montant