Location: PHPKode > projects > PMbyAS - Gestione Attivita > versione_4_1/pmbyas_4_1_script/PMbyAS-4-0/ordreg.php
<?php
/*******************************************************************************
 *  filename    : ordreg.php
 *  last change : 2006 - 11 - 20
 *
 *  http://www.avesan.it/
 *  Copyright 2006 Alberto Santoro
 *
 *  PMbyAS 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.
 ******************************************************************************/
$pgm="ordreg.php";
// --------------- connessione
require_once "./_fcom/fconn.php";
// --------------- sessione
require_once "./_fcom/fsess.php";
// --------------- dati di sessione
require_once "./_fcom/fperiodo.php";
// --------------- inclusione della testata HTML
require_once "./_fcom/doctype.php";
// ------------- inclusione barra navigazione
require_once "./_fcom/nav.php";

// --------------- Intestazione  standard 
$query = "SELECT ClDex FROM cliente WHERE ClCod = \"$SECLI\" ";
$qrc = mysqli_query($connessione,$query) or die("Query cli fallita");
$rcl = mysqli_fetch_assoc($qrc);
$tsfun="Registrazione Ordine";
$tsdt2 = "$SECLI &nbsp; {$rcl["ClDex"]}";
require_once "./_fcom/tstnopm.php";

$tch = $_GET["tch"];
$oday = $_GET["day"];
$onum = $_GET["num"];

// --------------- recupero dei dati digitati il ciclo precedente
if (isset($_REQUEST['hold']))
   {$hold = $_REQUEST['hold']; 
    $post = explode(";", $hold);
    $num = $post[0];
    $day = $post[1];
    $val = $post[2];
    $job = $post[3];
    $tch = $post[4];
    $onum = $post[5];
    $oday = $post[6];}


// ---------------- Riferimento all'offerta
print "\n<div class=\"cpst\">";
if ($tch == "N")
    {print "\n<div class=\"dvtlab2\">Nessuna offerta da evadere</div>";
     $val = " "; }
else     
    {print "\n<div class=\"dvtlab\">Evade l'offerta numero</div> 
            <div class=\"dvtext\">$onum &nbsp; del $oday</div>";
     $query = "SELECT * FROM offerta 
               WHERE OffNum = \"$onum\" and
                     OffDay = \"$oday\"#"; 
     $rso = mysqli_query($connessione,$query) 
     or die("Query off fallita");
     $rg = mysqli_fetch_assoc($rso);
     $val = $rg["OffVPro"];
     }
print "\n</div>";

// ------------------- controllo esistenza job
$tpo = substr($_SESSION['TLV'],0,1);
$query = "SELECT * FROM prog 
          WHERE PgmStato <> \"C\" AND PgmCli = \"$SECLI\" AND PgmTpo = \"$tpo\" " ; 
     $vpm = mysqli_query($connessione,$query) 
     or die("Query vpm fallita");
$nrec = mysqli_num_rows($vpm);
if ($nrec < 1){
   print "<div class=\"cpst\">";
   print "<div class=\"divstx\">&nbsp;</div>";
   print "<div class=\"diverb\">Nessun programma da abbinare all'ordine. - Abbandonare la transazione, creare il programma, ripartire con la registrazione dell'ordine&nbsp;</div>";
   print "</div>";}

// -------------------- riga eventuale errore
print "<div class=\"cpst\">";
print "<div class=\"divstx\">&nbsp;</div>";
if (isset($_REQUEST['merr'])) print "<div class=\"diverb\">{$_REQUEST['merr']} &nbsp;</div>";
print "</div>";

// ------------------------ riga di registrazione
print "<form action=\"ordagg.php\" method=\"post\">";
print "<table  width=\"840\"><tr>";
print "\n<th width=\"120\">numero ordine</th>";
print "\n<th width=\"90\">data ordine</th>";
print "\n<th width=\"100\">importo</th>";
print "\n<th width=\"80\">programma</th>";
print "\n<th width=\"10\">&nbsp;</th>";
print "\n<th width=\"10\">&nbsp;</th>";
print "\n<th width=\"10\">&nbsp;</th>";
print "\n<th width=\"10\">&nbsp;</th>";
print "\n<th width=\"100\">&nbsp;</th>";
print "</tr><tr>";

print "\n<td><input class=\"text\" type=\"text\" 
       name=\"num\" size=\"14\" maxlength=\"10\" value=\"$num\"></td>";

print "\n<td><input class=\"text\" type=\"text\" 
       name=\"day\" size=\"14\" maxlength=\"10\" value=\"$day\"></td>";

print "\n<td><input class=\"text\" type=\"text\" 
       name=\"val\" size=\"12\" maxlength=\"9\" value=\"$val\"></td>";


// --------------------------------------------------------- codice job
print "\n<td width=\"280\"><select name=\"job\">";
$tpo = substr($_SESSION['TLV'],0,1);
$job = substr($_SESSION['PGM'],0,7);
$query = "SELECT * FROM prog WHERE PgmStato <> \"C\" AND PgmCli = \"$SECLI\" AND PgmTpo = \"$tpo\" ORDER BY PgmDex";
$qra = mysqli_query($connessione,$query) or die("Query prog fallita");
while ($rl = mysqli_fetch_assoc($qra))
 {if ($rl['PgmCod'] == $job) $sel="selected"; else $sel=" ";
 print "\n<option $sel>{$rl['PgmCod']} {$rl['PgmDex']}</option>";}
print "\n</select></td>";

print "\n<td ><input type=\"hidden\" 
       name=\"tch\" size=\"1\" maxlength=\"1\" value=\"$tch\"></td>";
print "\n<td ><input type=\"hidden\" 
       name=\"onum\" size=\"10\" maxlength=\"10\" value=\"$onum\"></td>";
print "\n<td ><input type=\"hidden\" 
       name=\"oday\" size=\"10\" maxlength=\"10\" value=\"$oday\"></td>";

print "\n<td >&nbsp;</td>";
print "\n<td><input class=\"sub\" type=\"submit\" name=\"sub\" value=\"registra\" </td>";
print "\n</tr></table>";
print "\n</form>";

print "\n<br /><div class=\"cpd\">&nbsp;Note:<ul>
       <li>Il numero d'ordine è obbligatorio in assenza di offerta.</li>
       <li>In presenza di offerta il numero d'ordine può essere omesso; 
           il sistema lo assumerà uguale a quello dell'offerta.</li></ul></div> ";

?>
</div></body></html>
Return current item: PMbyAS - Gestione Attivita