Qual: A lot of screen more clear

This commit is contained in:
Laurent Destailleur 2010-02-10 17:07:25 +00:00
parent 3d9e26df4f
commit 8e78f75be4
13 changed files with 337 additions and 297 deletions

View File

@ -346,15 +346,16 @@ class ChargeSociales extends CommonObject
/** \class PaiementCharge /** \class PaiementCharge
* \brief Classe permettant la gestion des paiements des charges * \brief Classe permettant la gestion des paiements des charges
*/ */
class PaiementCharge class PaiementCharge extends CommonObject
{ {
var $db; //!< To store db handler var $db; //!< To store db handler
var $error; //!< To return error code (or message) var $error; //!< To return error code (or message)
var $errors=array(); //!< To return several error codes (or messages) var $errors=array(); //!< To return several error codes (or messages)
//var $element='paiementcharge'; //!< Id that identify managed objects var $element='paiementcharge'; //!< Id that identify managed objects
//var $table_element='paiementcharge'; //!< Name of table without prefix where object is stored var $table_element='paiementcharge'; //!< Name of table without prefix where object is stored
var $id; var $id;
var $ref;
var $fk_charge; var $fk_charge;
var $datec=''; var $datec='';
@ -463,7 +464,6 @@ class PaiementCharge
global $langs; global $langs;
$sql = "SELECT"; $sql = "SELECT";
$sql.= " t.rowid,"; $sql.= " t.rowid,";
$sql.= " t.fk_charge,"; $sql.= " t.fk_charge,";
$sql.= " t.datec,"; $sql.= " t.datec,";
$sql.= " t.tms,"; $sql.= " t.tms,";
@ -475,10 +475,10 @@ class PaiementCharge
$sql.= " t.fk_bank,"; $sql.= " t.fk_bank,";
$sql.= " t.fk_user_creat,"; $sql.= " t.fk_user_creat,";
$sql.= " t.fk_user_modif,"; $sql.= " t.fk_user_modif,";
$sql.= " pt.code as type_code, pt.libelle as type_libelle,";
$sql.= " pt.code as type_code, pt.libelle as type_libelle"; $sql.= ' b.fk_account';
$sql.= " FROM (".MAIN_DB_PREFIX."paiementcharge as t, ".MAIN_DB_PREFIX."c_paiement as pt)";
$sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as t, ".MAIN_DB_PREFIX."c_paiement as pt"; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON t.fk_bank = b.rowid';
$sql.= " WHERE t.rowid = ".$id." AND t.fk_typepaiement = pt.id"; $sql.= " WHERE t.rowid = ".$id." AND t.fk_typepaiement = pt.id";
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
@ -490,6 +490,7 @@ class PaiementCharge
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->ref = $obj->rowid;
$this->fk_charge = $obj->fk_charge; $this->fk_charge = $obj->fk_charge;
$this->datec = $this->db->jdate($obj->datec); $this->datec = $this->db->jdate($obj->datec);
@ -505,6 +506,9 @@ class PaiementCharge
$this->type_code = $obj->type_code; $this->type_code = $obj->type_code;
$this->type_libelle = $obj->type_libelle; $this->type_libelle = $obj->type_libelle;
$this->bank_account = $obj->fk_account;
$this->bank_line = $obj->fk_bank;
} }
$this->db->free($resql); $this->db->free($resql);

View File

@ -23,7 +23,7 @@
/** /**
* \file htdocs/compta/bank/account.php * \file htdocs/compta/bank/account.php
* \ingroup banque * \ingroup banque
* \brief Page de d<EFBFBD>tail des transactions bancaires * \brief List of detail of bank transaction for an account
* \version $Id$ * \version $Id$
*/ */
@ -500,28 +500,18 @@ if ($account || $_GET["ref"])
$links = $acct->get_url($objp->rowid); $links = $acct->get_url($objp->rowid);
$isbanktransfert=false; // Sgow generic description
foreach($links as $key=>$val) { if ($val['type']=='banktransfert') $isbanktransfert=true; }
$issocialcontrib=false;
foreach($links as $key=>$val) { if ($val['type']=='sc') $issocialcontrib=true; }
$showlabel=true;
//if (sizeof($links) == 0) $showlabel=true;
//if ($isbanktransfert || $issocialcontrib) $showlabel=true;
if ($showlabel)
{
if (preg_match('/^\((.*)\)$/i',$objp->label,$reg)) if (preg_match('/^\((.*)\)$/i',$objp->label,$reg))
{ {
// Genereic description because between (). We show it after translating. // Generic description because between (). We show it after translating.
print $langs->trans($reg[1]); print $langs->trans($reg[1]);
} }
else else
{ {
print dol_trunc($objp->label,60); print dol_trunc($objp->label,60);
} }
}
// Add links in description field // Add links after description
foreach($links as $key=>$val) foreach($links as $key=>$val)
{ {
if ($links[$key]['type']=='payment') { if ($links[$key]['type']=='payment') {
@ -544,12 +534,11 @@ if ($account || $_GET["ref"])
else if ($links[$key]['type']=='payment_sc') else if ($links[$key]['type']=='payment_sc')
{ {
//print ' - '; //print ' - ';
/* print '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/fiche.php?id='.$links[$key]['url_id'].'">';
print '<a href="'.DOL_URL_ROOT.'/compta/sociales/xxx.php?id='.$links[$key]['url_id'].'">'; print ' '.img_object($langs->trans('ShowPayment'),'payment').' ';
//print img_object($langs->trans('ShowPayment'),'payment').' '; //print $langs->trans("SocialContributionPayment");
print $langs->trans("SocialContributionPayment");
print '</a>'; print '</a>';
*/
} }
else if ($links[$key]['type']=='payment_vat') else if ($links[$key]['type']=='payment_vat')
{ {

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Xavier DUTOIT <doli@sydesy.com> * Copyright (C) 2003 Xavier DUTOIT <doli@sydesy.com>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr> * Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -373,7 +373,7 @@ if ($result)
print '</a>'; print '</a>';
} }
else if ($links[$key]['type']=='payment_sc') { else if ($links[$key]['type']=='payment_sc') {
print '<a href="'.DOL_URL_ROOT.'/compta/sociales/xxx.php?id='.$links[$key]['url_id'].'">'; print '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/fiche.php?id='.$links[$key]['url_id'].'">';
print img_object($langs->trans('ShowPayment'),'payment').' '; print img_object($langs->trans('ShowPayment'),'payment').' ';
print $langs->trans("SocialContributionPayment"); print $langs->trans("SocialContributionPayment");
print '</a>'; print '</a>';

View File

@ -187,7 +187,9 @@ if ($resql)
// Date // Date
print '<td align="left" nowrap="nowrap">'.dol_print_date($db->jdate($objp->do),"day")." &nbsp; </td>\n"; print '<td align="left" nowrap="nowrap">'.dol_print_date($db->jdate($objp->do),"day")." &nbsp; </td>\n";
// Description
print "<td><a href=\"ligne.php?rowid=$objp->rowid&amp;account=$objp->fk_account\">"; print "<td><a href=\"ligne.php?rowid=$objp->rowid&amp;account=$objp->fk_account\">";
//print $objp->label;
$reg=array(); $reg=array();
preg_match('/\((.+)\)/i',$objp->label,$reg); // Si texte entoure de parenthee on tente recherche de traduction preg_match('/\((.+)\)/i',$objp->label,$reg); // Si texte entoure de parenthee on tente recherche de traduction
if ($reg[1] && $langs->trans($reg[1])!=$reg[1]) print $langs->trans($reg[1]); if ($reg[1] && $langs->trans($reg[1])!=$reg[1]) print $langs->trans($reg[1]);

View File

@ -280,7 +280,7 @@ if ($_GET['action'] == 'create' || $_POST['action'] == 'confirm_paiement' || $_P
print '<tr><td><span class="fieldrequired">'.$langs->trans('Date').'</span></td><td>'; print '<tr><td><span class="fieldrequired">'.$langs->trans('Date').'</span></td><td>';
$datepayment = dol_mktime(12, 0 , 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); $datepayment = dol_mktime(12, 0 , 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
$datepayment= ($datepayment == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0) : $datepayment); $datepayment= ($datepayment == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0) : $datepayment);
$html->select_date($datepayment,'','','',0,"add_paiement"); $html->select_date($datepayment,'','','',0,"add_paiement",1,1);
print '</td>'; print '</td>';
print '<td>'.$langs->trans('Comments').'</td></tr>'; print '<td>'.$langs->trans('Comments').'</td></tr>';

View File

@ -226,9 +226,10 @@ if ($resql)
print '<br><table class="noborder" width="100%">'; print '<br><table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans('Bill').'</td>'; print '<td>'.$langs->trans('Bill').'</td>';
print '<td align="center">'.$langs->trans('Status').'</td>';
print '<td>'.$langs->trans('Company').'</td>'; print '<td>'.$langs->trans('Company').'</td>';
print '<td align="right">'.$langs->trans('AmountTTC').'</td>'; print '<td align="right">'.$langs->trans('ExpectedToPay').'</td>';
print '<td align="center">'.$langs->trans('Status').'</td>';
print '<td align="right">'.$langs->trans('PayedByThisPayment').'</td>';
print "</tr>\n"; print "</tr>\n";
if ($num > 0) if ($num > 0)
@ -242,15 +243,27 @@ if ($resql)
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
// Invoice
print '<td>'; print '<td>';
$facturestatic->id=$objp->facid; $facturestatic->id=$objp->facid;
$facturestatic->ref=$objp->facnumber; $facturestatic->ref=$objp->facnumber;
$facturestatic->type=$objp->type; $facturestatic->type=$objp->type;
print $facturestatic->getNomUrl(1); print $facturestatic->getNomUrl(1);
print "</td>\n"; print "</td>\n";
print '<td align="center">'.$facturestatic->LibStatut($objp->paye,$objp->fk_statut,2,1).'</td>';
// Third party
print '<td><a href="'.DOL_URL_ROOT.'/compta/fiche.php?socid='.$objp->socid.'">'.img_object($langs->trans('ShowCompany'),'company').' '.$objp->nom.'</a></td>'; print '<td><a href="'.DOL_URL_ROOT.'/compta/fiche.php?socid='.$objp->socid.'">'.img_object($langs->trans('ShowCompany'),'company').' '.$objp->nom.'</a></td>';
// Expected to pay
print '<td align="right">'.price($objp->total_ttc).'</td>';
// Statut
print '<td align="center">'.$facturestatic->LibStatut($objp->paye,$objp->fk_statut,2,1).'</td>';
// Amount payed
print '<td align="right">'.price($objp->amount).'</td>'; print '<td align="right">'.price($objp->amount).'</td>';
print "</tr>\n"; print "</tr>\n";
if ($objp->paye == 1) // If at least one invoice is paid, disable delete if ($objp->paye == 1) // If at least one invoice is paid, disable delete
{ {

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -17,10 +17,10 @@
*/ */
/** /**
\file htdocs/compta/paiement_charge.php * \file htdocs/compta/paiement_charge.php
\ingroup compta * \ingroup tax
\brief Page de creation d'un paiement d'une charge * \brief Page to add payment of a tax
\version $Id$ * \version $Id$
*/ */
include_once("./pre.inc.php"); include_once("./pre.inc.php");
@ -110,15 +110,16 @@ if ($_POST["action"] == 'add_paiement')
$acc = new Account($db, $_POST["accountid"]); $acc = new Account($db, $_POST["accountid"]);
$bank_line_id = $acc->addline($paiement->datepaye, $paiement->paiementtype, $label, -abs($total), $paiement->num_paiement, '', $user); $bank_line_id = $acc->addline($paiement->datepaye, $paiement->paiementtype, $label, -abs($total), $paiement->num_paiement, '', $user);
// Mise a jour fk_bank dans llx_paiementcharge. On connait ainsi le paiement qui a g<>n<EFBFBD>r<EFBFBD> l'<27>criture bancaire // Mise a jour fk_bank dans llx_paiementcharge. On connait ainsi le paiement qui a genere l'ecriture bancaire
if ($bank_line_id > 0) if ($bank_line_id > 0)
{ {
$paiement->update_fk_bank($bank_line_id); $paiement->update_fk_bank($bank_line_id);
// Mise a jour liens (pour chaque charge concern<72>e par le paiement) // Mise a jour liens (pour chaque charge concernee par le paiement)
foreach ($paiement->amounts as $key => $value) foreach ($paiement->amounts as $key => $value)
{ {
$acc->add_url_line($bank_line_id, $chid, DOL_URL_ROOT.'/compta/sociales/charges.php?id=', '(socialcontribution)','sc'); //$acc->add_url_line($bank_line_id, $chid, DOL_URL_ROOT.'/compta/charges.php?id=', '(socialcontribution)','payment_sc');
$acc->add_url_line($bank_line_id, $paymentid, DOL_URL_ROOT.'/compta/payment_sc/fiche.php?id=', '(paiement)','payment_sc');
} }
$db->commit(); $db->commit();
@ -129,13 +130,13 @@ if ($_POST["action"] == 'add_paiement')
} }
else { else {
$db->rollback(); $db->rollback();
$mesg = "Echec de la cr<63>ation entr<74>e compte: ".$db->error(); $mesg = "Echec de la creation entree compte: ".$db->error();
} }
} }
else else
{ {
$db->rollback(); $db->rollback();
$mesg = "Echec de la cr<63>ation du paiement: paiement_id=$paiement_id ".$db->error(); $mesg = "Failed to create payment: paiement_id=$paiement_id ".$db->error();
} }
} }
@ -206,20 +207,20 @@ if ($_GET["action"] == 'create')
print "<input type=\"hidden\" name=\"chid\" value=\"$chid\">"; print "<input type=\"hidden\" name=\"chid\" value=\"$chid\">";
print '<tr><td>'.$langs->trans("Date").'</td><td>'; print '<tr><td class="fieldrequired">'.$langs->trans("Date").'</td><td>';
$datepayment=empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0; $datepayment=empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0;
$html->select_date($datepayment,'','','','',"add_paiement"); $html->select_date($datepayment,'','','','',"add_paiement",1,1);
print "</td>"; print "</td>";
print '<td>'.$langs->trans("Comments").'</td></tr>'; print '<td>'.$langs->trans("Comments").'</td></tr>';
print '<tr><td>'.$langs->trans("PaymentMode").'</td><td>'; print '<tr><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>';
$html->select_types_paiements($charge->paiementtype, "paiementtype"); $html->select_types_paiements($charge->paiementtype, "paiementtype");
print "</td>\n"; print "</td>\n";
print '<td rowspan="3" valign="top"><textarea name="comment" wrap="soft" cols="40" rows="'.ROWS_3.'"></textarea></td></tr>'; print '<td rowspan="3" valign="top"><textarea name="comment" wrap="soft" cols="40" rows="'.ROWS_3.'"></textarea></td></tr>';
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans('AccountToCredit').'</td>'; print '<td class="fieldrequired">'.$langs->trans('AccountToCredit').'</td>';
print '<td>'; print '<td>';
$html->select_comptes($charge->accountid, "accountid", 0, "courant=1"); // Affiche liste des comptes courant $html->select_comptes($charge->accountid, "accountid", 0, "courant=1"); // Affiche liste des comptes courant
print '</td></tr>'; print '</td></tr>';
@ -229,7 +230,7 @@ if ($_GET["action"] == 'create')
print "<td><input name=\"num_paiement\" type=\"text\"></td></tr>\n"; print "<td><input name=\"num_paiement\" type=\"text\"></td></tr>\n";
/* /*
* Autres charges impay<EFBFBD>es * Autres charges impayees
*/ */
$num = 1; $num = 1;
$i = 0; $i = 0;
@ -315,12 +316,16 @@ if ($_GET["action"] == 'create')
* *
*/ */
print '<tr><td colspan="3" align="center">'; print "</table>";
print '<br><center>';
//print '<tr><td colspan="3" align="center">';
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">'; print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
print '&nbsp; &nbsp;'; print '&nbsp; &nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">'; print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</td></tr>';
print "</table>"; print '</center>';
//print '</td></tr>';
print "</form>\n"; print "</form>\n";
// } // }
} }

View File

@ -28,7 +28,6 @@
*/ */
require('./pre.inc.php'); require('./pre.inc.php');
require_once(DOL_DOCUMENT_ROOT.'/paiement.class.php');
include_once(DOL_DOCUMENT_ROOT."/chargesociales.class.php"); include_once(DOL_DOCUMENT_ROOT."/chargesociales.class.php");
require_once(DOL_DOCUMENT_ROOT.'/facture.class.php'); require_once(DOL_DOCUMENT_ROOT.'/facture.class.php');
require_once(DOL_DOCUMENT_ROOT."/includes/modules/facture/modules_facture.php"); require_once(DOL_DOCUMENT_ROOT."/includes/modules/facture/modules_facture.php");
@ -56,7 +55,7 @@ if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes' &&
{ {
$db->begin(); $db->begin();
$paiement = new Paiement($db); $paiement = new PaiementCharge($db);
$paiement->fetch($_GET['id']); $paiement->fetch($_GET['id']);
$result = $paiement->delete(); $result = $paiement->delete();
if ($result > 0) if ($result > 0)
@ -76,7 +75,7 @@ if ($_REQUEST['action'] == 'confirm_valide' && $_REQUEST['confirm'] == 'yes' &&
{ {
$db->begin(); $db->begin();
$paiement = new Paiement($db); $paiement = new PaiementCharge($db);
$paiement->id = $_GET['id']; $paiement->id = $_GET['id'];
if ($paiement->valide() > 0) if ($paiement->valide() > 0)
{ {
@ -166,7 +165,10 @@ if ($mesg) print $mesg.'<br>';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref // Ref
print '<tr><td valign="top" width="140">'.$langs->trans('Ref').'</td><td colspan="3">'.$paiement->id.'</td></tr>'; print '<tr><td valign="top" width="140">'.$langs->trans('Ref').'</td>';
print '<td colspan="3">';
print $html->showrefnav($paiement,'id','',1,'rowid','id');
print '</td></tr>';
// Date // Date
print '<tr><td valign="top" width="120">'.$langs->trans('Date').'</td><td colspan="3">'.dol_print_date($paiement->datep,'day').'</td></tr>'; print '<tr><td valign="top" width="120">'.$langs->trans('Date').'</td><td colspan="3">'.dol_print_date($paiement->datep,'day').'</td></tr>';
@ -205,11 +207,11 @@ print '</table>';
/* /*
* List of invoices * List of social contributions payed
*/ */
$disable_delete = 0; $disable_delete = 0;
$sql = 'SELECT f.rowid as scid, f.libelle, f.paye, pf.amount, pc.libelle as sc_type'; $sql = 'SELECT f.rowid as scid, f.libelle, f.paye, f.amount as sc_amount, pf.amount, pc.libelle as sc_type';
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiementcharge as pf,'.MAIN_DB_PREFIX.'chargesociales as f, '.MAIN_DB_PREFIX.'c_chargesociales as pc'; $sql.= ' FROM '.MAIN_DB_PREFIX.'paiementcharge as pf,'.MAIN_DB_PREFIX.'chargesociales as f, '.MAIN_DB_PREFIX.'c_chargesociales as pc';
$sql.= ' WHERE pf.fk_charge = f.rowid AND pf.fk_typepaiement = pc.id'; $sql.= ' WHERE pf.fk_charge = f.rowid AND pf.fk_typepaiement = pc.id';
$sql.= ' AND f.entity = '.$conf->entity; $sql.= ' AND f.entity = '.$conf->entity;
@ -225,8 +227,9 @@ if ($resql)
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans('SocialContribution').'</td>'; print '<td>'.$langs->trans('SocialContribution').'</td>';
print '<td>'.$langs->trans('Label').'</td>'; print '<td>'.$langs->trans('Label').'</td>';
print '<td align="right">'.$langs->trans('ExpectedToPay').'</td>';
print '<td align="center">'.$langs->trans('Status').'</td>'; print '<td align="center">'.$langs->trans('Status').'</td>';
print '<td align="right">'.$langs->trans('AmountTTC').'</td>'; print '<td align="right">'.$langs->trans('PayedByThisPayment').'</td>';
print "</tr>\n"; print "</tr>\n";
if ($num > 0) if ($num > 0)
@ -247,7 +250,11 @@ if ($resql)
print $socialcontribstatic->getNomUrl(1); print $socialcontribstatic->getNomUrl(1);
print "</td>\n"; print "</td>\n";
print '<td>'.$objp->libelle.'</td>'; print '<td>'.$objp->libelle.'</td>';
// Expected to pay
print '<td align="right">'.price($objp->sc_amount).'</td>';
// Status
print '<td align="center">'.$socialcontribstatic->LibStatut($objp->fk_statut,2).'</td>'; print '<td align="center">'.$socialcontribstatic->LibStatut($objp->fk_statut,2).'</td>';
// Amount payed
print '<td align="right">'.price($objp->amount).'</td>'; print '<td align="right">'.price($objp->amount).'</td>';
print "</tr>\n"; print "</tr>\n";
if ($objp->paye == 1) // If at least one invoice is paid, disable delete if ($objp->paye == 1) // If at least one invoice is paid, disable delete

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr> * Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com> * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* *
@ -232,11 +232,11 @@ if ($action == 'create' || $action == 'add_paiement')
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans('Payment').'</td>'; print '<tr class="liste_titre"><td colspan="3">'.$langs->trans('Payment').'</td>';
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="2">'.$obj->nom.'</td></tr>'; print '<tr><td>'.$langs->trans('Company').'</td><td colspan="2">'.$obj->nom.'</td></tr>';
print '<tr><td>'.$langs->trans('Date').'</td><td>'; print '<tr><td class="fieldrequired">'.$langs->trans('Date').'</td><td>';
$html->select_date($dateinvoice,'','','','',"addpaiement"); $html->select_date($dateinvoice,'','','','',"addpaiement",1,1);
print '</td>'; print '</td>';
print '<td>'.$langs->trans('Comments').'</td></tr>'; print '<td>'.$langs->trans('Comments').'</td></tr>';
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td>'; print '<tr><td class="fieldrequired">'.$langs->trans('PaymentMode').'</td><td>';
$html->select_types_paiements(empty($_POST['paiementid'])?'':$_POST['paiementid'],'paiementid'); $html->select_types_paiements(empty($_POST['paiementid'])?'':$_POST['paiementid'],'paiementid');
print '</td>'; print '</td>';
print '<td rowspan="3" valign="top">'; print '<td rowspan="3" valign="top">';
@ -244,7 +244,7 @@ if ($action == 'create' || $action == 'add_paiement')
print '<tr><td>'.$langs->trans('Numero').'</td><td><input name="num_paiement" type="text" value="'.(empty($_POST['num_paiement'])?'':$_POST['num_paiement']).'"></td></tr>'; print '<tr><td>'.$langs->trans('Numero').'</td><td><input name="num_paiement" type="text" value="'.(empty($_POST['num_paiement'])?'':$_POST['num_paiement']).'"></td></tr>';
if ($conf->banque->enabled) if ($conf->banque->enabled)
{ {
print '<tr><td>'.$langs->trans('Account').'</td><td>'; print '<tr><td class="fieldrequired">'.$langs->trans('Account').'</td><td>';
$html->select_comptes(empty($_POST['accountid'])?'':$_POST['accountid'],'accountid',0,'',1); $html->select_comptes(empty($_POST['accountid'])?'':$_POST['accountid'],'accountid',0,'',1);
print '</td></tr>'; print '</td></tr>';
} }
@ -252,6 +252,8 @@ if ($action == 'create' || $action == 'add_paiement')
{ {
print '<tr><td colspan="2">&nbsp;</td></tr>'; print '<tr><td colspan="2">&nbsp;</td></tr>';
} }
print '</table>';
/* /*
* Autres factures impayees * Autres factures impayees
*/ */
@ -270,7 +272,8 @@ if ($action == 'create' || $action == 'add_paiement')
if ($num > 0) if ($num > 0)
{ {
$i = 0; $i = 0;
print '<tr><td colspan="3">'; print '<br>';
print $langs->trans('Invoices').'<br>'; print $langs->trans('Invoices').'<br>';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -326,7 +329,7 @@ if ($action == 'create' || $action == 'add_paiement')
print '<td align="center">&nbsp;</td>'; print '<td align="center">&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
} }
print "</table></td></tr>\n"; print "</table>\n";
} }
$db->free($resql); $db->free($resql);
} }
@ -338,8 +341,10 @@ if ($action == 'create' || $action == 'add_paiement')
/* /*
* *
*/ */
print '<tr><td colspan="3" align="center"><input type="submit" class="button" value="'.$langs->trans('Save').'"></td></tr>';
print '</table>'; print '<br>';
print '<center><input type="submit" class="button" value="'.$langs->trans('Save').'"></center>';
print '</form>'; print '</form>';
} }
} }

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com> * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -156,24 +156,6 @@ print '<table class="border" width="100%">';
print '<tr>'; print '<tr>';
print '<td valign="top" width="140" colspan="2">'.$langs->trans('Ref').'</td><td colspan="3">'.$paiement->id.'</td></tr>'; print '<td valign="top" width="140" colspan="2">'.$langs->trans('Ref').'</td><td colspan="3">'.$paiement->id.'</td></tr>';
if ($conf->banque->enabled)
{
if ($paiement->bank_account)
{
// Si compte renseign<67>, on affiche libelle
$bank=new Account($db);
$bank->fetch($paiement->bank_account);
$bankline=new AccountLine($db);
$bankline->fetch($paiement->bank_line);
print '<tr>';
print '<td valign="top" width="140" colspan="2">'.$langs->trans('BankAccount').'</td>';
print '<td><a href="'.DOL_URL_ROOT.'/compta/bank/account.php?account='.$bank->id.'">'.img_object($langs->trans('ShowAccount'),'account').' '.$bank->label.'</a></td>';
print '<td>'.$langs->trans('BankLineConciliated').'</td><td>'.yn($bankline->rappro).'</td>';
print '</tr>';
}
}
//switch through edition options for date (only available when statut is -not 1- (=validated)) //switch through edition options for date (only available when statut is -not 1- (=validated))
if (empty($_GET['action']) || $_GET['action']!='edit_date') if (empty($_GET['action']) || $_GET['action']!='edit_date')
@ -242,6 +224,25 @@ if ($conf->global->BILL_ADD_PAYMENT_VALIDATION)
print '<tr><td valign="top" colspan="2">'.$langs->trans('Status').'</td><td colspan="3">'.$paiement->getLibStatut(4).'</td></tr>'; print '<tr><td valign="top" colspan="2">'.$langs->trans('Status').'</td><td colspan="3">'.$paiement->getLibStatut(4).'</td></tr>';
} }
if ($conf->banque->enabled)
{
if ($paiement->bank_account)
{
// Si compte renseigne, on affiche libelle
$bank=new Account($db);
$bank->fetch($paiement->bank_account);
$bankline=new AccountLine($db);
$bankline->fetch($paiement->bank_line);
print '<tr>';
print '<td valign="top" width="140" colspan="2">'.$langs->trans('BankAccount').'</td>';
print '<td><a href="'.DOL_URL_ROOT.'/compta/bank/account.php?account='.$bank->id.'">'.img_object($langs->trans('ShowAccount'),'account').' '.$bank->label.'</a></td>';
print '<td>'.$langs->trans('BankLineConciliated').'</td><td>'.yn($bankline->rappro).'</td>';
print '</tr>';
}
}
print '<tr><td valign="top" colspan="2">'.$langs->trans('Note').'</td><td colspan="3">'.nl2br($paiement->note).'</td></tr>'; print '<tr><td valign="top" colspan="2">'.$langs->trans('Note').'</td><td colspan="3">'.nl2br($paiement->note).'</td></tr>';
print '</table>'; print '</table>';
@ -270,9 +271,10 @@ if ($resql)
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans('Ref').'</td>'; print '<td>'.$langs->trans('Ref').'</td>';
print '<td>'.$langs->trans('RefSupplier').'</td>'; print '<td>'.$langs->trans('RefSupplier').'</td>';
print '<td align="center">'.$langs->trans('Status').'</td>';
print '<td>'.$langs->trans('Company').'</td>'; print '<td>'.$langs->trans('Company').'</td>';
print '<td align="right">'.$langs->trans('AmountTTC').'</td>'; print '<td align="right">'.$langs->trans('ExpectedToPay').'</td>';
print '<td align="center">'.$langs->trans('Status').'</td>';
print '<td align="right">'.$langs->trans('PayedByThisPayment').'</td>';
print "</tr>\n"; print "</tr>\n";
if ($num > 0) if ($num > 0)
@ -286,12 +288,19 @@ if ($resql)
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
// Ref
print '<td><a href="'.DOL_URL_ROOT.'/fourn/facture/fiche.php?facid='.$objp->facid.'">'.img_object($langs->trans('ShowBill'),'bill').' '; print '<td><a href="'.DOL_URL_ROOT.'/fourn/facture/fiche.php?facid='.$objp->facid.'">'.img_object($langs->trans('ShowBill'),'bill').' ';
print $objp->ref; print $objp->ref;
print "</a></td>\n"; print "</a></td>\n";
// Ref supplier
print '<td>'.$objp->ref_supplier."</td>\n"; print '<td>'.$objp->ref_supplier."</td>\n";
print '<td align="center">'.$facturestatic->LibStatut($objp->paye,$objp->fk_statut,2,1).'</td>'; // Third party
print '<td><a href="'.DOL_URL_ROOT.'/fourn/fiche.php?socid='.$objp->socid.'">'.img_object($langs->trans('ShowCompany'),'company').' '.$objp->nom.'</a></td>'; print '<td><a href="'.DOL_URL_ROOT.'/fourn/fiche.php?socid='.$objp->socid.'">'.img_object($langs->trans('ShowCompany'),'company').' '.$objp->nom.'</a></td>';
// Expected to pay
print '<td align="right">'.price($objp->total_ttc).'</td>';
// Status
print '<td align="center">'.$facturestatic->LibStatut($objp->paye,$objp->fk_statut,2,1).'</td>';
// Payed
print '<td align="right">'.price($objp->amount).'</td>'; print '<td align="right">'.price($objp->amount).'</td>';
print "</tr>\n"; print "</tr>\n";
if ($objp->paye == 1) if ($objp->paye == 1)

View File

@ -354,6 +354,8 @@ Cash=Cash
Reported=Delayed Reported=Delayed
DisabledBecausePayments=Not possible since there is some payments DisabledBecausePayments=Not possible since there is some payments
CantRemovePaymentWithOneInvoicePaid=Can't remove payment since there is at least on invoice classified payed CantRemovePaymentWithOneInvoicePaid=Can't remove payment since there is at least on invoice classified payed
ExpectedToPay=Expected payment
PayedByThisPayment=Payed by this payment
##### Types de contacts ##### ##### Types de contacts #####
TypeContact_facture_internal_SALESREPFOLL=Representative following-up customer invoice TypeContact_facture_internal_SALESREPFOLL=Representative following-up customer invoice
TypeContact_facture_external_BILLING=Customer invoice contact TypeContact_facture_external_BILLING=Customer invoice contact

View File

@ -356,6 +356,8 @@ InvoiceDepositAsk=Facture d'acompte
InvoiceDepositDesc=La <b>facture d'acompte</b> est le type de facture qui fait suite à réception d'un acompte, s'il n'est pas encore possible de saisir le paiement sur une facture définitive. InvoiceDepositDesc=La <b>facture d'acompte</b> est le type de facture qui fait suite à réception d'un acompte, s'il n'est pas encore possible de saisir le paiement sur une facture définitive.
DisabledBecausePayments=Non disponible car il existe des paiements DisabledBecausePayments=Non disponible car il existe des paiements
CantRemovePaymentWithOneInvoicePaid=Suppression impossible quand il existe au moins une facture classée payée. CantRemovePaymentWithOneInvoicePaid=Suppression impossible quand il existe au moins une facture classée payée.
ExpectedToPay=Paiement attendu
PayedByThisPayment=Payé par ce paiement
##### Types de contacts ##### ##### Types de contacts #####
TypeContact_facture_internal_SALESREPFOLL=Reponsable suivi facture client TypeContact_facture_internal_SALESREPFOLL=Reponsable suivi facture client
TypeContact_facture_external_BILLING=Contact client facturation TypeContact_facture_external_BILLING=Contact client facturation

View File

@ -68,9 +68,10 @@ class Paiement
*/ */
function fetch($id) function fetch($id)
{ {
$sql = 'SELECT p.rowid, p.datep as dp, p.amount, p.statut, p.fk_bank'; $sql = 'SELECT p.rowid, p.datep as dp, p.amount, p.statut, p.fk_bank,';
$sql.= ', c.code as type_code, c.libelle as type_libelle'; $sql.= ' c.code as type_code, c.libelle as type_libelle,';
$sql.= ', p.num_paiement, p.note, b.fk_account'; $sql.= ' p.num_paiement, p.note,';
$sql.= ' b.fk_account';
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_paiement as c, '.MAIN_DB_PREFIX.'paiement as p'; $sql.= ' FROM '.MAIN_DB_PREFIX.'c_paiement as c, '.MAIN_DB_PREFIX.'paiement as p';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid '; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid ';
$sql.= ' WHERE p.fk_paiement = c.id'; $sql.= ' WHERE p.fk_paiement = c.id';
@ -89,14 +90,15 @@ class Paiement
$this->date = $this->db->jdate($obj->dp); $this->date = $this->db->jdate($obj->dp);
$this->datepaye = $this->db->jdate($obj->dp); $this->datepaye = $this->db->jdate($obj->dp);
$this->numero = $obj->num_paiement; $this->numero = $obj->num_paiement;
$this->bank_account = $obj->fk_account;
$this->bank_line = $obj->fk_bank;
$this->montant = $obj->amount; $this->montant = $obj->amount;
$this->note = $obj->note; $this->note = $obj->note;
$this->type_libelle = $obj->type_libelle; $this->type_libelle = $obj->type_libelle;
$this->type_code = $obj->type_code; $this->type_code = $obj->type_code;
$this->statut = $obj->statut; $this->statut = $obj->statut;
$this->bank_account = $obj->fk_account;
$this->bank_line = $obj->fk_bank;
$this->db->free($result); $this->db->free($result);
return 1; return 1;
} }