Changes to support deposit invoices

This commit is contained in:
Laurent Destailleur 2009-02-24 02:41:21 +00:00
parent 5071f101d6
commit 4333e8cb2a
7 changed files with 114 additions and 68 deletions

View File

@ -1,8 +1,8 @@
<?PHP
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
*
*
* 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
* the Free Software Foundation; either version 2 of the License, or
@ -21,7 +21,7 @@
/**
* \file htdocs/comm/remx.php
* \ingroup commercial, invoice
* \brief Onglet de définition des avoirs
* \brief Page to edit absolute discounts for a customer
* \version $Id$
*/
@ -35,7 +35,7 @@ $langs->load("companies");
// Sécurité si un client essaye d'accéder à une autre fiche que la sienne
$_socid = $_GET["id"];
if ($user->societe_id > 0)
if ($user->societe_id > 0)
{
$_socid = $user->societe_id;
}
@ -49,7 +49,7 @@ if ($_POST["action"] == 'setremise')
{
if (price2num($_POST["amount_ht"]) > 0)
{
if (! $_POST["desc"])
if (! $_POST["desc"])
{
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("ReasonDiscount")).'</div>';
}
@ -57,7 +57,7 @@ if ($_POST["action"] == 'setremise')
$soc = new Societe($db);
$soc->fetch($_GET["id"]);
$soc->set_remise_except($_POST["amount_ht"],$user,$_POST["desc"],$_POST["tva_tx"]);
if ($result > 0)
{
Header("Location: remx.php?id=".$_GET["id"]);
@ -77,7 +77,7 @@ if ($_POST["action"] == 'setremise')
if ($_GET["action"] == 'remove')
{
$db->begin();
$soc = new Societe($db);
$soc->fetch($_GET["id"]);
$result=$soc->del_remise_except($_GET["remid"]);
@ -100,18 +100,18 @@ if ($_GET["action"] == 'remove')
$form=new Form($db);
$facturestatic=new Facture($db);
llxHeader();
if ($_socid > 0)
{
if ($mesg) print $mesg."<br>";
// On recupere les donnees societes par l'objet
$objsoc = new Societe($db);
$objsoc->id=$_socid;
$objsoc->fetch($_socid,$to);
/*
* Affichage onglets
*/
@ -151,7 +151,7 @@ if ($_socid > 0)
print '<td>'.$remise_user.'&nbsp;'.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
print "</table>";
print '<br>';
print '<table class="border" width="100%">';
print '<tr><td width="38%">'.$langs->trans("NewGlobalDiscount").'</td>';
print '<td><input type="text" size="5" name="amount_ht" value="'.$_POST["amount_ht"].'">&nbsp;'.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
@ -161,14 +161,14 @@ if ($_socid > 0)
print '</td></tr>';
print '<tr><td>'.$langs->trans("NoteReason").'</td>';
print '<td><input type="text" size="60" name="desc" value="'.$_POST["desc"].'"></td></tr>';
print '<tr><td align="center" colspan="2"><input type="submit" class="button" value="'.$langs->trans("AddGlobalDiscount").'"></td></tr>';
print "</table></form>";
print "</div>\n";
print "</div>\n";
print '<br>';
print '<br>';
/*
@ -217,6 +217,13 @@ if ($_socid > 0)
$facturestatic->type=$obj->type;
print $langs->trans("CreditNote").' '.$facturestatic->getNomURl(1);
}
elseif ($obj->description == '(DEPOSIT)')
{
$facturestatic->id=$obj->fk_facture_source;
$facturestatic->ref=$obj->ref;
$facturestatic->type=$obj->type;
print $langs->trans("InvoiceDeposit").' '.$facturestatic->getNomURl(1);
}
else
{
print $obj->description;
@ -278,14 +285,14 @@ if ($_socid > 0)
$sql2.= " WHERE rc.fk_soc =". $objsoc->id;
$sql2.= " AND rc.fk_facture = f.rowid";
$sql2.= " AND rc.fk_user = u.rowid";
$sql2.= " ORDER BY dc DESC";
$resql=$db->query($sql);
$resql2=null;
if ($resql) $resql2=$db->query($sql2);
if ($resql2)
{
{
print_titre($langs->trans("DiscountAlreadyCounted"));
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="120">'.$langs->trans("Date").'</td>';
@ -308,8 +315,8 @@ if ($_socid > 0)
$tab_sqlobj[] = $sqlobj;
$tab_sqlobjOrder[]=$sqlobj->dc;
}
$db->free($resql);
$db->free($resql);
$num = $db->num_rows($resql2);
for ($i = 0;$i < $num;$i++)
{
@ -319,7 +326,7 @@ if ($_socid > 0)
}
$db->free($resql2);
array_multisort ($tab_sqlobjOrder,SORT_DESC,$tab_sqlobj);
$num = sizeOf($tab_sqlobj);
$i = 0 ;
while ($i < $num )

View File

@ -429,9 +429,14 @@ if ($_POST['action'] == 'confirm_converttoreduc' && $_POST['confirm'] == 'yes' &
$i++;
}
// Insère une remise par famille de taux tva
// Insert one discount by VAT rate category
$discount = new DiscountAbsolute($db);
$discount->desc='(CREDIT_NOTE)';
if ($fac->type == 2) $discount->desc='(CREDIT_NOTE)';
elseif ($fac->type == 3) $discount->desc='(DEPOSIT)';
else {
$this->error="CantConvertToReducAnInvoiceOfThisType";
return -1;
}
$discount->tva_tx=abs($fac->total_ttc);
$discount->fk_soc=$fac->socid;
$discount->fk_facture_source=$fac->id;
@ -1849,6 +1854,12 @@ if ($_GET['action'] == 'create')
$discount->fetch($objp->fk_remise_except);
print $langs->transnoentities("DiscountFromCreditNote",$discount->getNomUrl(0));
}
elseif ($obj->description == '(DEPOSIT)')
{
$discount=new DiscountAbsolute($db);
$discount->fetch($objp->fk_remise_except);
print $langs->transnoentities("DiscountFromDeposit",$discount->getNomUrl(0));
}
else
{
print dol_trunc($objp->description,60);
@ -2612,6 +2623,12 @@ else
$discount->fetch($objp->fk_remise_except);
print ' - '.$langs->transnoentities("DiscountFromCreditNote",$discount->getNomUrl(0));
}
elseif ($objp->description == '(DEPOSIT)')
{
$discount=new DiscountAbsolute($db);
$discount->fetch($objp->fk_remise_except);
print ' - '.$langs->transnoentities("DiscountFromDeposit",$discount->getNomUrl(0));
}
else
{
print ' - '.nl2br($objp->description);

View File

@ -23,7 +23,8 @@
* \file htdocs/document.php
* \brief Wrapper to download data files
* \version $Id$
* \remarks L'appel est document.php?file=pathrelatifdufichier&modulepart=repfichierconcerne
* \remarks Call of this wrapper is mad with URL:
* document.php?modulepart=repfichierconcerne&file=pathrelatifdufichier
*/
$original_file = urldecode($_GET["file"]);
@ -32,6 +33,7 @@ $type = isset($_GET["type"]) ? urldecode($_GET["type"]) : '';
// Define if we need master or master+main
$needmasteronly=false;
if ($modulepart == 'bittorrent') $needmasteronly=true;
//if ($modulepart == 'webcal') $needmasteronly=true;
//if ($modulepart == 'agenda') $needmasteronly=true;
@ -391,6 +393,14 @@ if ($modulepart)
$original_file=DOL_DATA_ROOT.'/admin/temp/'.$original_file;
$sqlprotectagainstexternals = '';
}
// Wrapping pour BitTorrent
if ($modulepart == 'bittorrent')
{
$accessallowed=1;
$original_file=DOL_DATA_ROOT.'/bittorrent/files/'.$original_file;
$sqlprotectagainstexternals = '';
}
}
// Basic protection (against external users only)

View File

@ -1997,6 +1997,7 @@ class Facture extends CommonObject
global $langs;
$langs->load('bills');
//print "$paye,$statut,$mode,$alreadypayed,$type";
if ($mode == 0)
{
$prefix='';

View File

@ -229,6 +229,7 @@ GlobalDiscount=Global discount
CreditNote=Credit note
CreditNotes=Credit notes
DiscountFromCreditNote=Discount from credit note %s
DiscountFromDeposit=Payments from deposit invoice %s
NewGlobalDiscount=New discount
NoteReason=Note/Reason
ReasonDiscount=Reason
@ -324,7 +325,7 @@ ChequesReceipts=Cheques receipts
ChequesArea=Cheques deposits area
ChequeDeposits=Cheques deposits
Cheques=Cheques
CreditNoteConvertedIntoDiscount=This credit note has been converted into %s
CreditNoteConvertedIntoDiscount=This credit note or deposit invoice has been converted into %s
UsBillingContactAsIncoiveRecipientIfExist=Use customer billing contact address instead of third party address as recipient for invoices
PaymentInvoiceRef=Payment invoice %s
# oursin PDF model

View File

@ -228,6 +228,7 @@ GlobalDiscount=Remise fixe
CreditNote=Avoir
CreditNotes=Avoirs
DiscountFromCreditNote=Remise issue de l'avoir %s
DiscountFromDeposit=Paiements issue de l'accompte %s
NewGlobalDiscount=Nouvelle remise fixe
NoteReason=Note/Motif
ReasonDiscount=Motif
@ -325,7 +326,7 @@ ChequesReceipts=Bordereaux de remise de chèques
ChequesArea=Espace remises de chèques
ChequeDeposits=Dépots de chèques
Cheques=Chèques
CreditNoteConvertedIntoDiscount=Cet avoir a été converti en %s
CreditNoteConvertedIntoDiscount=Cet avoir ou accompte a été converti en %s
UsBillingContactAsIncoiveRecipientIfExist=Utiliser l'adresse du contact facturation client de la facture plutot que l'adresse du tiers comme destinataire des factures
ShowUnpayedAll=Afficher tous les impayés
ShowUnpayedLateOnly=Afficher impayés en retard uniquement

View File

@ -834,17 +834,61 @@ function top_menu($head, $title='', $target='')
* \brief Affiche barre de menu gauche
* \param menu_array Tableau des entrees de menu
* \param helppagename Url pour le lien aide ('' par defaut)
* \param form_search Formulaire de recherche permanant supplementaire
* \param moresearchform Formulaire de recherche permanant supplementaire
*/
function left_menu($menu_array, $helppagename='', $form_search='')
function left_menu($menu_array, $helppagename='', $moresearchform='')
{
global $user, $conf, $langs, $db;
$searchform='';
$bookmarks='';
// print '<div class="vmenuplusfiche">'."\n";
print '<table width="100%" class="notopnoleftnoright"><tr><td class="vmenu" valign="top">';
print "\n";
// Define $searchform
if ($conf->societe->enabled && $conf->global->MAIN_SEARCHFORM_SOCIETE && $user->rights->societe->lire)
{
$langs->load("companies");
$searchform.=printSearchForm(DOL_URL_ROOT.'/societe.php', DOL_URL_ROOT.'/societe.php',
img_object($langs->trans("List"),'company').' '.$langs->trans("Companies"), 'soc', 'socname');
}
if ($conf->societe->enabled && $conf->global->MAIN_SEARCHFORM_CONTACT && $user->rights->societe->lire)
{
$langs->load("companies");
$searchform.=printSearchForm(DOL_URL_ROOT.'/contact/index.php', DOL_URL_ROOT.'/contact/index.php',
img_object($langs->trans("List"),'contact').' '.$langs->trans("Contacts"), 'contact', 'contactname');
}
if (($conf->produit->enabled || $conf->service->enabled) && $conf->global->MAIN_SEARCHFORM_PRODUITSERVICE && $user->rights->produit->lire)
{
$langs->load("products");
$searchform.=printSearchForm(DOL_URL_ROOT.'/product/liste.php', DOL_URL_ROOT.'/product/index.php',
img_object($langs->trans("List"),'product').' '.$langs->trans("Products")."/".$langs->trans("Services"), 'products', 'sall');
}
if ($conf->adherent->enabled && $conf->global->MAIN_SEARCHFORM_ADHERENT && $user->rights->adherent->lire)
{
$langs->load("members");
$searchform.=printSearchForm(DOL_URL_ROOT.'/adherents/liste.php', DOL_URL_ROOT.'/adherents/liste.php',
img_object($langs->trans("List"),'user').' '.$langs->trans("Members"), 'member', 'sall');
}
// Define $bookmarks
if ($conf->bookmark->enabled && $user->rights->bookmark->lire)
{
include_once (DOL_DOCUMENT_ROOT.'/bookmarks/bookmarks.lib.php');
$langs->load("bookmarks");
$bookmarks=printBookmarksList($db, $langs);
}
// Colonne de gauche
print '<!-- Begin left vertical menu -->'."\n";
print '<div class="vmenu">'."\n";
@ -859,63 +903,28 @@ function left_menu($menu_array, $helppagename='', $form_search='')
$menuleft=new MenuLeft($db,$menu_array);
$menuleft->showmenu();
// Affichage des zones de recherche permanantes
$ret='';
if ($conf->societe->enabled && $conf->global->MAIN_SEARCHFORM_SOCIETE && $user->rights->societe->lire)
{
$langs->load("companies");
$ret.=printSearchForm(DOL_URL_ROOT.'/societe.php', DOL_URL_ROOT.'/societe.php',
img_object($langs->trans("List"),'company').' '.$langs->trans("Companies"), 'soc', 'socname');
}
if ($conf->societe->enabled && $conf->global->MAIN_SEARCHFORM_CONTACT && $user->rights->societe->lire)
{
$langs->load("companies");
$ret.=printSearchForm(DOL_URL_ROOT.'/contact/index.php', DOL_URL_ROOT.'/contact/index.php',
img_object($langs->trans("List"),'contact').' '.$langs->trans("Contacts"), 'contact', 'contactname');
}
if (($conf->produit->enabled || $conf->service->enabled) && $conf->global->MAIN_SEARCHFORM_PRODUITSERVICE && $user->rights->produit->lire)
{
$langs->load("products");
$ret.=printSearchForm(DOL_URL_ROOT.'/product/liste.php', DOL_URL_ROOT.'/product/index.php',
img_object($langs->trans("List"),'product').' '.$langs->trans("Products")."/".$langs->trans("Services"), 'products', 'sall');
}
if ($conf->adherent->enabled && $conf->global->MAIN_SEARCHFORM_ADHERENT && $user->rights->adherent->lire)
{
$langs->load("members");
$ret.=printSearchForm(DOL_URL_ROOT.'/adherents/liste.php', DOL_URL_ROOT.'/adherents/liste.php',
img_object($langs->trans("List"),'user').' '.$langs->trans("Members"), 'member', 'sall');
}
if ($ret)
if ($searchform)
{
print "\n";
print "<!-- Begin SearchForm -->\n";
print '<div class="blockvmenupair">'."\n";
print $ret;
print $searchform;
print '</div>'."\n";
print "<!-- End SearchForm -->\n";
}
// Zone de recherche supplementaire
if ($form_search)
if ($moresearchform)
{
print $form_search;
print $moresearchform;
}
// Zone d'affichage permanente des marque pages
if ($conf->bookmark->enabled && $user->rights->bookmark->lire)
if ($bookmarks)
{
include_once (DOL_DOCUMENT_ROOT.'/bookmarks/bookmarks.lib.php');
$langs->load("bookmarks");
$ret=printBookmarksList($db, $langs);
print "\n";
print "<!-- Begin Bookmarks -->\n";
print '<div class="blockvmenupair">'."\n";
print $ret;
print $bookmarks;
print '</div>'."\n";
print "<!-- End Bookmarks -->\n";
}