malcomm_online/lista_towarow.php

84 lines
3.0 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
require ('mpdf.php');
require('funkcje.php');
lacz_baza();
// Zapytanie
$data = date('d-m-Y H:i:s');
$test = '<style type="text/css">
<!--
.style1 {
font-size: 28px;
font-weight: bold;
}
.style2 {
font-size: 6px;
font-weight: bold;
}
-->
</style>
<center>
<p align="center" class="style1">Lista towarów</p>
<table width=100%>
<tr align=center>
<td bgcolor=#CCCCCC align="center" width=10%>Kod</td>
<td bgcolor=#CCCCCC align="center" width=20%>Nazwa</td>
<td bgcolor=#CCCCCC align="center" width=20%>Kod EAN</td>
<td bgcolor=#CCCCCC align="center" width=35%>Grupa towarowa</td>
<td bgcolor=#CCCCCC align="center" width=10>IloϾ</td>
</tr>';
$towar=mysql_query("select a.id_tow,a.ean,b.jm,a.kod,c.nazwa as nazwa_gru,a.nazwa as nazwa_tow,a.id_jm,a.id_stru,a.opis,a.blok,a.usun,c.poziom,c.id_kategori_wyzej from towar a,jm b,struktura c where a.id_jm=b.id_jm and a.id_stru=c.id_stru and a.usun='0' order by a.kod asc");
while($t=mysql_fetch_array($towar))
{
if ($t['poziom']==1)
$nazwa_gru = $t['nazwa_gru'];
if ($t['poziom']==2)
{
$poziom_1 = mysql_query("select nazwa from struktura where id_stru='".$t['id_kategori_wyzej']."' and poziom='1'");
$p1=mysql_fetch_array($poziom_1);
$nazwa_gru = $p1[0].' - > '.$t['nazwa_gru'];
}
if ($t['poziom']==3)
{
$poziom_1 = mysql_query("select nazwa,id_kategori_wyzej from struktura where id_stru='".$t['id_kategori_wyzej']."' and poziom='2'");
$p1=mysql_fetch_array($poziom_1);
$poziom_2 = mysql_query("select nazwa,id_stru from struktura where id_stru='".$p1[1]."' and poziom='1'");
$p2=mysql_fetch_array($poziom_2);
$nazwa_gru = $p2[0].' - > '.$p1[0].' - > '.$t['nazwa_gru'];
}
if ($t['poziom']==4)
{
$poziom_1 = mysql_query("select nazwa,id_kategori_wyzej from struktura where id_stru='".$t['id_kategori_wyzej']."' and poziom='3'");
$p1=mysql_fetch_array($poziom_1);
$poziom_2 = mysql_query("select nazwa,id_kategori_wyzej from struktura where id_stru='".$p1[1]."' and poziom='2'");
$p2=mysql_fetch_array($poziom_2);
$poziom_3 = mysql_query("select nazwa,id_kategori_wyzej from struktura where id_stru='".$p2[1]."' and poziom='1'");
$p3=mysql_fetch_array($poziom_3);
$nazwa_gru = $p3[0].' - > '.$p2[0].' - > '.$p1[0].' - > '.$t['nazwa_gru'];
}
$test.= '
<tr align=center>
<td align="center" width=10%>'.$t['kod'].'</td>
<td align="left" width=20%>'.$t['nazwa_tow'].'</td>
<td align="left" width=20%>'.$t['ean'].'</td>
<td align="left" width=35%>'.$nazwa_gru.'</td>
<td align="center" width=10%>IloϾ</td>
</tr>';
}
$test.='</table>';
// ----------------------
$mpdf = new mPDF();
$mpdf=new mPDF('iso-8859-2');
$html = $test;
$mpdf->charset_in='windows-1250';
$mpdf->AddPage('L');
$mpdf->SetFooter('MalComm ul.CieÅlewskich 25A 03-017 Warszawa||System magazynowy online v 1.0');
$mpdf->WriteHTML($html,2);
$mpdf->Output('lista_towarow_'.$data.'.pdf',D);
echo $test;
?>