From ba776de57d9edcea7155b1145ae335c04e950b58 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Tue, 28 Oct 2003 16:17:46 +0000 Subject: [PATCH] Ajout la copie --- htdocs/fourn/facture/fiche.php | 151 ++++++++++++++++++--------------- 1 file changed, 84 insertions(+), 67 deletions(-) diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 6c2fb9683ad..fda41a24b18 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -44,25 +44,24 @@ if ($action == 'payed') $result = $db->query( $sql); } +if ($HTTP_POST_VARS["action"] == 'modif_libelle') +{ + $sql = "UPDATE llx_facture_fourn set libelle = '$form_libelle' WHERE rowid = $facid ;"; + $result = $db->query( $sql); +} + + if ($action == 'update') { - - $tva = ($HTTP_POST_VARS["tauxtva"] * $HTTP_POST_VARS["amount"]) / 100 ; - $remise = 0; - $total = $tva + $amount ; - $datefacture = $db->idate(mktime(12, 0 , 0, $HTTP_POST_VARS["remonth"], $HTTP_POST_VARS["reday"], $HTTP_POST_VARS["reyear"])); $sql = "UPDATE llx_facture_fourn set "; - $sql .= " libelle='".$HTTP_POST_VARS["libelle"]."'"; + $sql .= " facnumber='".trim($HTTP_POST_VARS["facnumber"])."'"; + $sql .= ", libelle='".trim($HTTP_POST_VARS["libelle"])."'"; $sql .= ", note='".$HTTP_POST_VARS["note"]."'"; $sql .= ", datef = '$datefacture'"; - $sql .= ", amount=".$HTTP_POST_VARS["amount"]; - $sql .= ", total = $total"; - $sql .= ", tva = $tva"; $sql .= " WHERE rowid = $facid ;"; $result = $db->query( $sql); - } if ($action == 'add') @@ -137,10 +136,15 @@ llxHeader(); * */ -if ($action == 'create') +if ($action == 'create' or $action == 'copy') { + if ($action == 'copy') + { + $fac_ori = new FactureFourn($db); + $fac_ori->fetch($facid); + } print_titre("Saisir une facture"); - + print '
'; print ''; print ''; @@ -177,9 +181,14 @@ if ($action == 'create') print ''; print ''; - - print "".''; - + if ($action == 'copy') + { + print ''; + } + else + { + print ''; + } print "".''; @@ -187,36 +196,28 @@ if ($action == 'create') print ''; print "
Numéro :
Libellé :
Libellé :
Libellé :
Date :'; $html->select_date(); print '
Auteur :'.$user->fullname.'

"; - print ''; - print "".''; + print '
 LibelléP.U.QtyTx TVA
'; + print "".''; - print "".''; - print ''; - print ''; - print ''; - - print "".''; - print ''; - print ''; - print ''; - - print "".''; - print ''; - print ''; - print ''; - - print "".''; - print ''; - print ''; - print ''; + for ($i = 1 ; $i < 5 ; $i++) + { + if ($action == 'copy') + { + $value_label = $fac_ori->lignes[$i-1][0]; + $value_pu = $fac_ori->lignes[$i-1][1]; + $value_qty = $fac_ori->lignes[$i-1][3]; + } + else + { + $value_qty = "1"; + } + print ''; + print ''; + print ''; + print ''; + } print "
 LibelléP.U.QtyTx TVA
Ligne 1 :'; - $html->select_tva("tauxtva1"); - print '
Ligne 2 :'; - $html->select_tva("tauxtva2"); - print '
Ligne 3 :'; - $html->select_tva("tauxtva3"); - print '
Ligne 4 :'; - $html->select_tva("tauxtva4"); - print '
Ligne '.$i.' :'; + $html->select_tva("tauxtva".$i); + print '
"; print '

'; @@ -262,13 +263,13 @@ else print ''; print ''; - print ""; + print ""; print ''; print ''; - print "".'".''; print ''; - print "".'".''; - print "".''; + print "".''; print ''; - print ""; - print ""; - print ""; + print ""; + print ""; print "
Société :
Société :'.stripslashes($obj->socnom); print 'Commentaires :
Numéro :'; + print "
Numéro :'; print ''; @@ -276,20 +277,20 @@ else print stripslashes($obj->note); print '
Libellé :'; + print "
Libellé :'; print '
Montant HT :
Montant HT :'.price($fac->total_ht).'
Date :"; + print "
Date :"; print_date_select($obj->df); print "
Auteur :".' '."
Auteur :".' '."
"; print "
"; @@ -312,8 +313,8 @@ else print ''.$fac->lignes[$i][2].""; print ''.price($fac->lignes[$i][5]).""; print ''.price($fac->lignes[$i][6]).""; - print '['; - print 'Supprimer]'; + print ''; + print 'Supprimer'; print ''; } @@ -351,19 +352,21 @@ else * Facture */ print ''; - print ""; + print ""; print "\n"; print ""; - print "\n"; - print ""; - print ""; + print "\n"; + print ""; + print ""; - print "".'"; + print "".'"; print '"; - print "".'"; + print "".'"; if (strlen($obj->note)) { - print "".'".''; } @@ -459,11 +462,11 @@ else if ($obj->statut == 0 && $user->societe_id == 0) { - print ''; + print ''; } elseif ($obj->statut == 1 && $obj->paye == 0 && $user->societe_id == 0) { - print ''; + print ''; } else { @@ -472,7 +475,14 @@ else if ($obj->statut == 0 && $user->societe_id == 0) { - print ''; + if ($action == "edit") + { + print ''; + } + else + { + print ''; + } } else { @@ -481,7 +491,7 @@ else if ($obj->statut == 1 && abs($resteapayer == 0) && $obj->paye == 0 && $user->societe_id == 0) { - print ""; + print ""; } else { @@ -490,13 +500,20 @@ else print ""; - if ($obj->statut == 0 && $user->societe_id == 0) + if ($user->societe_id == 0) { - print ""; + if ($obj->statut == 0) + { + print ""; + } + else + { + print ""; + } } else { - print ""; + print ''; } print "
Sociétésocidp\">$obj->socnom
Sociétésocidp\">$obj->socnomsocidp\">Autres factures
Date".strftime("%A %d %B %Y",$obj->df)."
Libelle$obj->libelle
Auteur$fac->author 
Date".strftime("%A %d %B %Y",$obj->df)."
Libellé"; + print $obj->libelle; + print "
Auteur$fac->author 
 Total HT'.price($fac->total_ht)."
 Total HT'.price($fac->total_ht)."TVA'.price($fac->total_tva)."
 Total TTC'.price($fac->total_ttc)."
 Total TTC'.price($fac->total_ttc)."
Commentaires'; + print "
Commentaires'; print nl2br(stripslashes($obj->note)); print '
[Supprimer]Supprimer[Emmettre un paiement]Emmettre un paiement[Editer]AnnulerEditer[Classer 'Payée']Classer 'Payée'-[Valider]Validersocidp\">Copier--
";