<?php
/*******************************************************************************
* filename : rpoo.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.
******************************************************************************/
// --------------- connessione
require_once "./_fcom/fconn.php";
// --------------- sessione
require_once "./_fcom/fsess.php";
// --------------- dati di sessione
require_once "./_fcom/fperiodo.php";
// -------------------------------- parametri di lavoro
$vs = substr($_REQUEST['opt'],0,1);
$tm = substr($_REQUEST['opt'],1,1);
$pgm="rpoo.php?opt=".$vs.$tm;
// ====================================== versione video / stampa
if ($vs == "P") $tsextra = "Periodo"; else $tsextra = "Mese";
// --- versione video
if ($tm <> "P") {
require_once "./_fcom/doctype.php"; // --- testata html video
require_once "./_fcom/nav.php"; // --- barra di navigazione
$tsfun="Offerte / Ordini - $tsextra";
if ($vs == "P")
{$tsprint = "rpoo.php?opt=PP"; require_once "./_fcom/tstper.php";}
else {$tsprint = "rpoo.php?opt=MP"; require_once "./_fcom/tstme.php";}
}
// --- versione stampa
else {require_once "./_fcom/doctype_p.php"; // --- testata html stampa
if ($vs == "P") {$dxper = "periodo"; require_once "./_fcom/pr_perdx.php";}
else {$dxper = "mese"; require_once "./_fcom/pr_medx.php";}
$rptitle="Offerte/Ordini del $dxper";
$len = 960;
$rptdex= $pr_inizio." - ".$pr_fine;
require_once "./_fcom/rptesta.php";
}
// ------------------------------------------------------------------
// --------------------------------------------- impostazione inizio e fine periodo
if ($vs == "P") {$dti = $SEDTI; $dtf = $SEDTF;}
if ($vs == "M") {$dti = $SEDTM;
$gmm = date("t",mktime(0,0,0,$SEmem,$SEggm,$SEanm));
$dtf = $SEanm."-".$SEmem."-".$gmm; }
// =============================== Elenco offerte del cliente
$query = "SELECT * FROM offerta, cliente
WHERE OffCli = ClCod and OffDay >= \"$dti\" and OffDay <= \"$dtf\"
ORDER BY OffDay, ClDex#";
$rso = mysqli_query($connessione,$query) or die("Query off fallita");
$nrec = mysqli_num_rows($rso);
if ($nrec == 0) {print "\n<br /><div class=\"cpnn\"><div class=\"pd8c\">Nessuna registrazione</div></div>";}
else {
// ------------------------------- testata report
print "\n<div class=\"cpnn\">";
print "\n<table ><thead><tr>";
print "\n<th class=\"t8c\" width=\"65\">data off.</th>";
print "\n<th class=\"t8s\" width=\"100\">num.off.</th>";
print "\n<th class=\"t8s\" width=\"280\">cliente</th>";
print "\n<th class=\"t8c\" width=\"90\">tipo attv</th>";
print "\n<th class=\"t8d\" width=\"70\">val.off.</th>";
print "\n<th width=\"10\"> </th>";
print "\n<th class=\"t8c\" width=\"65\">data ord</th>";
print "\n<th class=\"t8s\" width=\"100\">num ord</th>";
print "\n<th class=\"t8c\" width=\"75\">progr</th>";
print "\n<th class=\"t8d\" width=\"70\">val.ord</th>";
// --- corpo scrollabile
print "\n<th width=\"20\"> </th>";
print "\n</tr></thead>";
if ($tm <> "P")
{print "\n<tfoot><tr>";
print "\n<td class=\"pd8s\"colspan=\"11\"> </td>";}
else print "\n<td colspan=\"11\"> </td>";
print "\n</tr></tfoot>";
print "\n<tbody><tr><td colspan=\"11\"><div class=\"win478\"><table class=\"tbover\">";
$sw1=0; $cli = " ";
while ($rg = mysqli_fetch_assoc($rso))
{
$acdata = substr($rg["OffDay"],8,2).".".substr($rg["OffDay"],5,2).".".substr($rg["OffDay"],2,2);
$ev = number_format($rg["OffVPro"], 0, ',', '.');
$query = "SELECT * FROM tb_lav WHERE LvCod = \"{$rg["OffTpo"]}\" ";
$rsok = mysqli_query($connessione,$query) or die("Query csp fallita");
$rgl = mysqli_fetch_assoc($rsok);
print "\n<td width=\"65\" class=\"c8c\">$acdata</td>";
print "\n<td width=\"100\" class=\"c8s\">{$rg["OffNum"]}</td>";
print "\n<td width=\"280\" class=\"c8s\" >{$rg["ClCod"]} - {$rg["ClDex"]}</td>";
print "\n<td width=\"90\" class=\"c8c\">{$rgl["LvDex"]}</td>";
print "\n<td width=\"70\" class=\"c8dg\">$ev</td>";
if ($rg["OffVOrd"] > 0)
{$ordata = substr($rg["OffDOrd"],8,2).".".
substr($rg["OffDOrd"],5,2).".".
substr($rg["OffDOrd"],2,2);
$ev = number_format($rg["OffVOrd"], 0, ',', '.');
print "\n<td width=\"10\"> </td>";
print "\n<td width=\"65\" class=\"c8c\">$ordata</td>";
print "\n<td width=\"100\" class=\"c8s\">{$rg["OffNOrd"]}</td>";
print "\n<td width=\"55\" class=\"c8c\">{$rg["OffPgm"]}</td>";
print "\n<td width=\"70\" class=\"c8dg\">$ev</td>";
}
else
{print "\n<td width=\"10\"> </td>";
print "\n<td width=\"65\" class=\"c8s\"> </td>";
print "\n<td width=\"100\" class=\"c8s\"> </td>";
print "\n<td width=\"55\" class=\"c8c\"> </td>";
print "\n<td width=\"70\" class=\"c8dg\"> </td>";}
print "\n</tr>";
}
print "\n</tr></table></div></td></tr></tbody></table></div>";
// ---------------------------------fine zero records
}
if ($tm <> "P") print "\n</div>";
?>
</body>
</html>