www/inv_instock.php

changeset 514
3c680d1dea35
parent 209
dc30801e6961
equal deleted inserted replaced
513:217ba4596c4d 514:3c680d1dea35
1 <?php 1 <?php
2 require_once($_SERVER['DOCUMENT_ROOT'].'/includes/global.inc.php'); 2 require_once($_SERVER['DOCUMENT_ROOT'].'/includes/global.inc.php');
3 require_once($_SERVER['DOCUMENT_ROOT'].'/includes/constants.php');
3 require_once($_SERVER['DOCUMENT_ROOT'].'/fpdf/fpdf.php'); 4 require_once($_SERVER['DOCUMENT_ROOT'].'/fpdf/fpdf.php');
4 5
5 define('EURO', chr(128) ); 6 define('EURO', chr(128) );
6 7
7 $link = mysqli_connect(DBASE_HOST,DBASE_USER,DBASE_PASS,DBASE_NAME); 8 $link = mysqli_connect(DBASE_HOST,DBASE_USER,DBASE_PASS,DBASE_NAME);
64 function AddCol($width=-1, $caption='', $align='L') { 65 function AddCol($width=-1, $caption='', $align='L') {
65 $this->aCols[]=array('c'=>$caption,'w'=>$width,'a'=>$align); 66 $this->aCols[]=array('c'=>$caption,'w'=>$width,'a'=>$align);
66 } 67 }
67 68
68 function TableFermentables($link,$prop) { 69 function TableFermentables($link,$prop) {
70 global $fermentabletype;
69 $this->AddCol( 26,'Type','L'); 71 $this->AddCol( 26,'Type','L');
70 $this->AddCol( 26,'Leverancier','L'); 72 $this->AddCol( 26,'Leverancier','L');
71 $this->AddCol( 68,'Vergistbaar ingredient','L'); 73 $this->AddCol( 68,'Vergistbaar ingredient','L');
72 $this->AddCol( 30,'Voorraad','R'); 74 $this->AddCol( 30,'Voorraad','R');
73 $this->AddCol( 20, 'Prijs/kg', 'R'); 75 $this->AddCol( 20, 'Prijs/kg', 'R');
83 $this->TableHeader(); 85 $this->TableHeader();
84 $this->SetFont('Helvetica','',9); 86 $this->SetFont('Helvetica','',9);
85 $this->ColorIndex=0; 87 $this->ColorIndex=0;
86 $this->ProcessingTable=true; 88 $this->ProcessingTable=true;
87 89
88 $type = array( 'Mout', 'Suiker', 'V Extract', 'Extract', 'Ongemout graan' );
89 $sql = "SELECT type,name,supplier,inventory,cost FROM inventory_fermentables WHERE inventory > 0 ORDER BY type,supplier,name"; 90 $sql = "SELECT type,name,supplier,inventory,cost FROM inventory_fermentables WHERE inventory > 0 ORDER BY type,supplier,name";
90 $result = mysqli_query($link, $sql); 91 $result = mysqli_query($link, $sql);
91 $tot_fermentables = 0.0; 92 $tot_fermentables = 0.0;
92 93
93 while($row=mysqli_fetch_array($result)) { 94 while($row=mysqli_fetch_array($result)) {
95 $tot_fermentables += $value; 96 $tot_fermentables += $value;
96 97
97 $this->SetX($this->TableX); 98 $this->SetX($this->TableX);
98 $ci=$this->ColorIndex; 99 $ci=$this->ColorIndex;
99 $this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]); 100 $this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]);
100 $this->Cell(26,5,$type[$row['type']],0,0,'L',true); 101 $this->Cell(26,5,$fermentabletype[$row['type']],0,0,'L',true);
101 $this->Cell(26,5,iconv('UTF-8','windows-1252',$row['supplier']),0,0,'L',true); 102 $this->Cell(26,5,iconv('UTF-8','windows-1252',$row['supplier']),0,0,'L',true);
102 $this->Cell(68,5,iconv('UTF-8','windows-1252',$row['name']),0,0,'L',true); 103 $this->Cell(68,5,iconv('UTF-8','windows-1252',$row['name']),0,0,'L',true);
103 $this->Cell(30,5,sprintf("%10.3f kg",$row['inventory']),0,0,'R',true); 104 $this->Cell(30,5,sprintf("%10.3f kg",$row['inventory']),0,0,'R',true);
104 $this->Cell(20,5,sprintf("%8.2f ",$row['cost']).EURO,0,0,'R',true); 105 $this->Cell(20,5,sprintf("%8.2f ",$row['cost']).EURO,0,0,'R',true);
105 $this->Cell(20,5,sprintf("%8.2f ",$value).EURO,0,0,'R',true); 106 $this->Cell(20,5,sprintf("%8.2f ",$value).EURO,0,0,'R',true);
117 $this->cMargin=$cMargin; 118 $this->cMargin=$cMargin;
118 $this->aCols=array(); 119 $this->aCols=array();
119 } 120 }
120 121
121 function TableHops($link,$prop) { 122 function TableHops($link,$prop) {
123 global $hopform;
122 $this->AddCol( 30,'Land','L'); 124 $this->AddCol( 30,'Land','L');
123 $this->AddCol( 75,'Hoppen','L'); 125 $this->AddCol( 75,'Hoppen','L');
124 $this->AddCol( 15,'Soort','L'); 126 $this->AddCol( 15,'Soort','L');
125 $this->AddCol( 30,'Voorraad','R'); 127 $this->AddCol( 30,'Voorraad','R');
126 $this->AddCol( 20, 'Prijs/kg', 'R'); 128 $this->AddCol( 20, 'Prijs/kg', 'R');
133 $this->TableHeader(); 135 $this->TableHeader();
134 $this->SetFont('Helvetica','',9); 136 $this->SetFont('Helvetica','',9);
135 $this->ColorIndex=0; 137 $this->ColorIndex=0;
136 $this->ProcessingTable=true; 138 $this->ProcessingTable=true;
137 139
138 $type = array( 'Pellets', 'Plugs', 'Bellen' );
139 $result = mysqli_query($link, "SELECT name,form,origin,inventory,cost FROM inventory_hops WHERE inventory > 0 ORDER BY origin,name"); 140 $result = mysqli_query($link, "SELECT name,form,origin,inventory,cost FROM inventory_hops WHERE inventory > 0 ORDER BY origin,name");
140 $tot_hops = 0.0; 141 $tot_hops = 0.0;
141 142
142 while($row=mysqli_fetch_array($result)) { 143 while($row=mysqli_fetch_array($result)) {
143 $value = $row['inventory'] * $row['cost']; 144 $value = $row['inventory'] * $row['cost'];
147 $this->SetX($this->TableX); 148 $this->SetX($this->TableX);
148 $ci=$this->ColorIndex; 149 $ci=$this->ColorIndex;
149 $this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]); 150 $this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]);
150 $this->Cell(30,5,iconv('UTF-8','windows-1252',$row['origin']),0,0,'L',true); 151 $this->Cell(30,5,iconv('UTF-8','windows-1252',$row['origin']),0,0,'L',true);
151 $this->Cell(75,5,iconv('UTF-8','windows-1252',$row['name']),0,0,'L',true); 152 $this->Cell(75,5,iconv('UTF-8','windows-1252',$row['name']),0,0,'L',true);
152 $this->Cell(15,5,$type[$row['form']],0,0,'L',true); 153 $this->Cell(15,5,$hopform[$row['form']],0,0,'L',true);
153 $this->Cell(30,5,sprintf("%10.1f gr",$stock),0,0,'R',true); 154 $this->Cell(30,5,sprintf("%10.1f gr",$stock),0,0,'R',true);
154 $this->Cell(20,5,sprintf("%8.2f ",$row['cost']).EURO,0,0,'R',true); 155 $this->Cell(20,5,sprintf("%8.2f ",$row['cost']).EURO,0,0,'R',true);
155 $this->Cell(20,5,sprintf("%8.2f ",$value).EURO,0,0,'R',true); 156 $this->Cell(20,5,sprintf("%8.2f ",$value).EURO,0,0,'R',true);
156 $this->Ln(); 157 $this->Ln();
157 $this->ColorIndex=1-$ci; 158 $this->ColorIndex=1-$ci;
221 $this->cMargin=$cMargin; 222 $this->cMargin=$cMargin;
222 $this->aCols=array(); 223 $this->aCols=array();
223 } 224 }
224 225
225 function TableMiscs($link,$prop) { 226 function TableMiscs($link,$prop) {
227 global $misctype;
226 $this->AddCol( 30,'Type','L'); 228 $this->AddCol( 30,'Type','L');
227 $this->AddCol( 90,'Ingredient','L'); 229 $this->AddCol( 90,'Ingredient','L');
228 $this->AddCol( 30,'Voorraad','R'); 230 $this->AddCol( 30,'Voorraad','R');
229 $this->AddCol( 20, 'Prijs/kg', 'R'); 231 $this->AddCol( 20, 'Prijs/kg', 'R');
230 $this->AddCol( 20, 'Waarde', 'R'); 232 $this->AddCol( 20, 'Waarde', 'R');
238 $this->ColorIndex=0; 240 $this->ColorIndex=0;
239 $this->ProcessingTable=true; 241 $this->ProcessingTable=true;
240 242
241 $result = mysqli_query($link, "SELECT name,type,amount_is_weight,inventory,cost FROM inventory_miscs WHERE inventory > 0 ORDER BY type,name"); 243 $result = mysqli_query($link, "SELECT name,type,amount_is_weight,inventory,cost FROM inventory_miscs WHERE inventory > 0 ORDER BY type,name");
242 $tot_miscs = 0.0; 244 $tot_miscs = 0.0;
243 $type = array( 'Specerij', 'Kruid', 'Smaakstof', 'Klaringsmiddel', 'Brouwzout', 'Gistvoeding', 'Anders' );
244 245
245 while($row=mysqli_fetch_array($result)) { 246 while($row=mysqli_fetch_array($result)) {
246 $value = $row['inventory'] * $row['cost']; 247 $value = $row['inventory'] * $row['cost'];
247 $tot_miscs += $value; 248 $tot_miscs += $value;
248 $stock = floatval($row['inventory']) * 1000.0; 249 $stock = floatval($row['inventory']) * 1000.0;
249 ($row['amount_is_weight']) ? $amount = "gr" : $amount = "ml"; 250 ($row['amount_is_weight']) ? $amount = "gr" : $amount = "ml";
250 251
251 $this->SetX($this->TableX); 252 $this->SetX($this->TableX);
252 $ci=$this->ColorIndex; 253 $ci=$this->ColorIndex;
253 $this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]); 254 $this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]);
254 $this->Cell(30,5,$type[$row['type']],0,0,'L',true); 255 $this->Cell(30,5,$misctype[$row['type']],0,0,'L',true);
255 $this->Cell(90,5,iconv('UTF-8','windows-1252',$row['name']),0,0,'L',true); 256 $this->Cell(90,5,iconv('UTF-8','windows-1252',$row['name']),0,0,'L',true);
256 $this->Cell(30,5,sprintf("%10.1f ",$stock).$amount,0,0,'R',true); 257 $this->Cell(30,5,sprintf("%10.1f ",$stock).$amount,0,0,'R',true);
257 $this->Cell(20,5,sprintf("%8.2f ",$row['cost']).EURO,0,0,'R',true); 258 $this->Cell(20,5,sprintf("%8.2f ",$row['cost']).EURO,0,0,'R',true);
258 $this->Cell(20,5,sprintf("%8.2f ",$value).EURO,0,0,'R',true); 259 $this->Cell(20,5,sprintf("%8.2f ",$value).EURO,0,0,'R',true);
259 $this->Ln(); 260 $this->Ln();

mercurial