Dbut modification expedition livraison
Phase2: modification des livraisons - elles pourront dsormais etre li une propale (pas encore effectif) - on pourra faire un bon de livraison sans document de base
This commit is contained in:
parent
1051faac37
commit
79599aaf67
@ -1,8 +1,9 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
|
||||
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
|
||||
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
||||
* Copyright (C) 2005-2008 Regis Houssin <regis@dolibarr.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
|
||||
@ -439,12 +440,12 @@ else
|
||||
// Date
|
||||
print '<tr><td>'.$langs->trans("Date").'</td>';
|
||||
print '<td colspan="3">'.dolibarr_print_date($livraison->date_creation,'dayhourtext')."</td>\n";
|
||||
print '</tr>';
|
||||
print '</tr>';
|
||||
|
||||
// Statut
|
||||
print '<tr><td>'.$langs->trans("Status").'</td>';
|
||||
print '<td colspan="3">'.$livraison->getLibStatut(4)."</td>\n";
|
||||
print '</tr>';
|
||||
print '</tr>';
|
||||
|
||||
if (!$conf->expedition_bon->enabled && $conf->stock->enabled)
|
||||
{
|
||||
@ -461,60 +462,46 @@ else
|
||||
/*
|
||||
* Lignes produits
|
||||
*/
|
||||
echo '<br><table class="noborder" width="100%">';
|
||||
|
||||
$sql = "SELECT cd.fk_product, cd.description, cd.rowid, cd.qty as qty_commande,";
|
||||
$sql .= " ld.qty as qty_livre";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."commandedet as cd , ".MAIN_DB_PREFIX."livraisondet as ld";
|
||||
$sql .= " WHERE ld.fk_livraison = ".$livraison->id." AND cd.rowid = ld.fk_commande_ligne ";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
|
||||
if ($resql)
|
||||
print '<br><table class="noborder" width="100%">';
|
||||
|
||||
$num_prod = sizeof($livraison->lignes);
|
||||
|
||||
if ($num_prod)
|
||||
{
|
||||
$num_prod = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Products").'</td>';
|
||||
$i = 0;
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Products").'</td>';
|
||||
print '<td align="center">'.$langs->trans("QtyOrdered").'</td>';
|
||||
print '<td align="center">'.$langs->trans("QtyReceived").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$var=true;
|
||||
while ($i < $num_prod)
|
||||
print "</tr>\n";
|
||||
|
||||
$var=true;
|
||||
while ($i < $num_prod)
|
||||
{
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
if ($livraison->lignes[$i]->fk_product > 0)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
if ($objp->fk_product > 0)
|
||||
{
|
||||
$product = new Product($db);
|
||||
$product->fetch($objp->fk_product);
|
||||
|
||||
print '<td>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">'.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.'</a> - '.$product->libelle;
|
||||
if ($objp->description) print '<br>'.nl2br($objp->description);
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<td>".stripslashes(nl2br($objp->description))."</td>\n";
|
||||
}
|
||||
print '<td align="center">'.$objp->qty_commande.'</td>';
|
||||
print '<td align="center">'.$objp->qty_livre.'</td>';
|
||||
|
||||
print "</tr>";
|
||||
|
||||
$i++;
|
||||
$var=!$var;
|
||||
$product = new Product($db);
|
||||
$product->fetch($livraison->lignes[$i]->fk_product);
|
||||
|
||||
print '<td>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$livraison->lignes[$i]->fk_product.'">'.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.'</a> - '.$product->libelle;
|
||||
if ($livraison->lignes[$i]->description) print '<br>'.$livraison->lignes[$i]->description;
|
||||
print '</td>';
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
else
|
||||
{
|
||||
print "<td>".$livraison->lignes[$i]->description."</td>\n";
|
||||
}
|
||||
print '<td align="center">'.$livraison->lignes[$i]->qty_asked.'</td>';
|
||||
print '<td align="center">'.$livraison->lignes[$i]->qty_delivered.'</td>';
|
||||
|
||||
print "</tr>";
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2006 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2006-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2008 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2006-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -211,12 +211,27 @@ class Livraison extends CommonObject
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT l.rowid, l.date_creation, l.date_valid, l.ref, l.fk_user_author,";
|
||||
$sql .=" l.fk_statut, l.fk_commande, l.fk_expedition, l.fk_user_valid, l.note, l.note_public";
|
||||
$sql .= ", ".$this->db->pdate("l.date_livraison")." as date_livraison, l.fk_adresse_livraison, l.model_pdf";
|
||||
$sql .= ", c.fk_soc";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."livraison as l, ".MAIN_DB_PREFIX."commande as c";
|
||||
$sql .= " WHERE l.rowid = ".$id." AND c.rowid = l.fk_commande";
|
||||
$sql = "SELECT l.rowid, l.fk_soc, l.date_creation, l.date_valid, l.ref, l.ref_client, l.fk_user_author,";
|
||||
$sql.=" l.total_ht, l.fk_statut, l.fk_expedition, l.fk_user_valid, l.note, l.note_public";
|
||||
$sql.= ", ".$this->db->pdate("l.date_livraison")." as date_livraison, l.fk_adresse_livraison, l.model_pdf";
|
||||
if ($conf->commande->enabled)
|
||||
{
|
||||
$sql.= ", cl.fk_commande as origin_id";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql.= ", pl.fk_propal as origin_id";
|
||||
}
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."livraison as l";
|
||||
if ($conf->commande->enabled)
|
||||
{
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."co_liv as cl ON cl.fk_livraison = l.rowid";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."pr_liv as pl ON pl.fk_livraison = l.rowid";
|
||||
}
|
||||
$sql.= " WHERE l.rowid = ".$id;
|
||||
|
||||
$result = $this->db->query($sql) ;
|
||||
if ( $result )
|
||||
@ -227,9 +242,10 @@ class Livraison extends CommonObject
|
||||
$this->date_creation = $obj->date_creation;
|
||||
$this->date_valid = $obj->date_valid;
|
||||
$this->ref = $obj->ref;
|
||||
$this->socid = $obj->fk_soc;
|
||||
$this->ref_client = $obj->ref_client;
|
||||
$this->socid = $obj->fk_soc;
|
||||
$this->statut = $obj->fk_statut;
|
||||
$this->commande_id = $obj->fk_commande;
|
||||
$this->origin_id = $obj->origin_id;
|
||||
$this->expedition_id = $obj->fk_expedition;
|
||||
$this->user_author_id = $obj->fk_user_author;
|
||||
$this->user_valid_id = $obj->fk_user_valid;
|
||||
@ -561,19 +577,23 @@ class Livraison extends CommonObject
|
||||
$this->adresse = $adresse;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
function fetch_lignes()
|
||||
{
|
||||
$this->lignes = array();
|
||||
|
||||
$sql = "SELECT p.label, c.description, c.qty as qtycom, l.qty as qtyliv";
|
||||
$sql .= ", c.fk_product, c.price, p.ref";
|
||||
$sql = "SELECT p.label, p.ref";
|
||||
$sql.= ", l.description, l.fk_product, l.subprice, l.total_ht, l.qty as qtyliv";
|
||||
//$sql.= ", c.qty as qtycom";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."livraisondet as l";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."commandedet as c";
|
||||
//$sql .= " , ".MAIN_DB_PREFIX."commandedet as c";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."product as p";
|
||||
$sql .= " WHERE l.fk_livraison = ".$this->id;
|
||||
$sql .= " AND l.fk_commande_ligne = c.rowid";
|
||||
$sql .= " AND c.fk_product = p.rowid";
|
||||
//$sql .= " AND l.fk_commande_ligne = c.rowid";
|
||||
$sql .= " AND l.fk_product = p.rowid";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
@ -587,11 +607,11 @@ class Livraison extends CommonObject
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$ligne->fk_product = $obj->fk_product;
|
||||
$ligne->qty_commande = $obj->qtycom;
|
||||
$ligne->qty_livre = $obj->qtyliv;
|
||||
$ligne->qty_asked = $obj->qtycom;
|
||||
$ligne->qty_delivered = $obj->qtyliv;
|
||||
$ligne->ref = $obj->ref;
|
||||
$ligne->label = stripslashes($obj->label);
|
||||
$ligne->description = stripslashes($obj->description);
|
||||
$ligne->label = stripslashes(nl2br($obj->label));
|
||||
$ligne->description = stripslashes(nl2br($obj->description));
|
||||
$ligne->price = $obj->price;
|
||||
|
||||
$this->lignes[$i] = $ligne;
|
||||
|
||||
@ -133,4 +133,24 @@ alter table llx_livraisondet add column rang integer DEFAULT 0 after
|
||||
ALTER TABLE llx_livraisondet ADD INDEX idx_livraisondet_fk_expedition (fk_livraison);
|
||||
-- V4 ALTER TABLE llx_livraisondet ADD CONSTRAINT fk_livraisondet_fk_livraison FOREIGN KEY (fk_livraison) REFERENCES llx_livraison (rowid);
|
||||
|
||||
create table llx_pr_exp
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
fk_propal integer NOT NULL,
|
||||
fk_expedition integer NOT NULL,
|
||||
|
||||
key(fk_propal),
|
||||
key(fk_expedition)
|
||||
)type=innodb;
|
||||
|
||||
create table llx_pr_liv
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
fk_propal integer NOT NULL,
|
||||
fk_livraison integer NOT NULL,
|
||||
|
||||
key(fk_propal),
|
||||
key(fk_livraison)
|
||||
)type=innodb;
|
||||
|
||||
ALTER TABLE llx_paiement modify fk_bank integer NOT NULL DEFAULT 0;
|
||||
|
||||
30
mysql/tables/llx_pr_exp.sql
Normal file
30
mysql/tables/llx_pr_exp.sql
Normal file
@ -0,0 +1,30 @@
|
||||
-- ===================================================================
|
||||
-- Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
-- Copyright (C) 2008 Regis Houssin <regis@dolibarr.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
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program; if not, write to the Free Software
|
||||
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
--
|
||||
-- $Id$
|
||||
-- ===================================================================
|
||||
|
||||
create table llx_pr_exp
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
fk_propal integer NOT NULL,
|
||||
fk_expedition integer NOT NULL,
|
||||
|
||||
key(fk_propal),
|
||||
key(fk_expedition)
|
||||
)type=innodb;
|
||||
30
mysql/tables/llx_pr_liv.sql
Normal file
30
mysql/tables/llx_pr_liv.sql
Normal file
@ -0,0 +1,30 @@
|
||||
-- ===================================================================
|
||||
-- Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
-- Copyright (C) 2008 Regis Houssin <regis@dolibarr.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
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program; if not, write to the Free Software
|
||||
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
--
|
||||
-- $Id$
|
||||
-- ===================================================================
|
||||
|
||||
create table llx_pr_liv
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
fk_propal integer NOT NULL,
|
||||
fk_livraison integer NOT NULL,
|
||||
|
||||
key(fk_propal),
|
||||
key(fk_livraison)
|
||||
)type=innodb;
|
||||
Loading…
Reference in New Issue
Block a user