www/inv_instock.php

changeset 209
dc30801e6961
parent 82
7af1d472475a
child 514
3c680d1dea35
equal deleted inserted replaced
208:578c78abf058 209:dc30801e6961
64 function AddCol($width=-1, $caption='', $align='L') { 64 function AddCol($width=-1, $caption='', $align='L') {
65 $this->aCols[]=array('c'=>$caption,'w'=>$width,'a'=>$align); 65 $this->aCols[]=array('c'=>$caption,'w'=>$width,'a'=>$align);
66 } 66 }
67 67
68 function TableFermentables($link,$prop) { 68 function TableFermentables($link,$prop) {
69 $this->AddCol( 30,'Leverancier','L'); 69 $this->AddCol( 26,'Type','L');
70 $this->AddCol( 90,'Vergistbaar ingredient','L'); 70 $this->AddCol( 26,'Leverancier','L');
71 $this->AddCol( 68,'Vergistbaar ingredient','L');
71 $this->AddCol( 30,'Voorraad','R'); 72 $this->AddCol( 30,'Voorraad','R');
72 $this->AddCol( 20, 'Prijs/kg', 'R'); 73 $this->AddCol( 20, 'Prijs/kg', 'R');
73 $this->AddCol( 20, 'Waarde', 'R'); 74 $this->AddCol( 20, 'Waarde', 'R');
74 $prop['width']=$this->w-$this->lMargin-$this->rMargin; 75 $prop['width']=$this->w-$this->lMargin-$this->rMargin;
75 $prop['align']='L'; 76 $prop['align']='L';
82 $this->TableHeader(); 83 $this->TableHeader();
83 $this->SetFont('Helvetica','',9); 84 $this->SetFont('Helvetica','',9);
84 $this->ColorIndex=0; 85 $this->ColorIndex=0;
85 $this->ProcessingTable=true; 86 $this->ProcessingTable=true;
86 87
87 $result = mysqli_query($link, "SELECT name,supplier,inventory,cost FROM inventory_fermentables WHERE inventory > 0 ORDER BY supplier,name"); 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 $result = mysqli_query($link, $sql);
88 $tot_fermentables = 0.0; 91 $tot_fermentables = 0.0;
89 92
90 while($row=mysqli_fetch_array($result)) { 93 while($row=mysqli_fetch_array($result)) {
91 $value = $row['inventory'] * $row['cost']; 94 $value = $row['inventory'] * $row['cost'];
92 $tot_fermentables += $value; 95 $tot_fermentables += $value;
93 96
94 $this->SetX($this->TableX); 97 $this->SetX($this->TableX);
95 $ci=$this->ColorIndex; 98 $ci=$this->ColorIndex;
96 $this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]); 99 $this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]);
97 $this->Cell(30,5,iconv('UTF-8','windows-1252',$row['supplier']),0,0,'L',true); 100 $this->Cell(26,5,$type[$row['type']],0,0,'L',true);
98 $this->Cell(90,5,iconv('UTF-8','windows-1252',$row['name']),0,0,'L',true); 101 $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);
99 $this->Cell(30,5,sprintf("%10.3f kg",$row['inventory']),0,0,'R',true); 103 $this->Cell(30,5,sprintf("%10.3f kg",$row['inventory']),0,0,'R',true);
100 $this->Cell(20,5,sprintf("%8.2f ",$row['cost']).EURO,0,0,'R',true); 104 $this->Cell(20,5,sprintf("%8.2f ",$row['cost']).EURO,0,0,'R',true);
101 $this->Cell(20,5,sprintf("%8.2f ",$value).EURO,0,0,'R',true); 105 $this->Cell(20,5,sprintf("%8.2f ",$value).EURO,0,0,'R',true);
102 $this->Ln(); 106 $this->Ln();
103 $this->ColorIndex=1-$ci; 107 $this->ColorIndex=1-$ci;
129 $this->TableHeader(); 133 $this->TableHeader();
130 $this->SetFont('Helvetica','',9); 134 $this->SetFont('Helvetica','',9);
131 $this->ColorIndex=0; 135 $this->ColorIndex=0;
132 $this->ProcessingTable=true; 136 $this->ProcessingTable=true;
133 137
138 $type = array( 'Pellets', 'Plugs', 'Bellen' );
134 $result = mysqli_query($link, "SELECT name,form,origin,inventory,cost FROM inventory_hops WHERE inventory > 0 ORDER BY origin,name"); 139 $result = mysqli_query($link, "SELECT name,form,origin,inventory,cost FROM inventory_hops WHERE inventory > 0 ORDER BY origin,name");
135 $tot_hops = 0.0; 140 $tot_hops = 0.0;
136 141
137 while($row=mysqli_fetch_array($result)) { 142 while($row=mysqli_fetch_array($result)) {
138 $value = $row['inventory'] * $row['cost']; 143 $value = $row['inventory'] * $row['cost'];
142 $this->SetX($this->TableX); 147 $this->SetX($this->TableX);
143 $ci=$this->ColorIndex; 148 $ci=$this->ColorIndex;
144 $this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]); 149 $this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]);
145 $this->Cell(30,5,iconv('UTF-8','windows-1252',$row['origin']),0,0,'L',true); 150 $this->Cell(30,5,iconv('UTF-8','windows-1252',$row['origin']),0,0,'L',true);
146 $this->Cell(75,5,iconv('UTF-8','windows-1252',$row['name']),0,0,'L',true); 151 $this->Cell(75,5,iconv('UTF-8','windows-1252',$row['name']),0,0,'L',true);
147 $this->Cell(15,5,iconv('UTF-8','windows-1252',$row['form']),0,0,'L',true); 152 $this->Cell(15,5,$type[$row['form']],0,0,'L',true);
148 $this->Cell(30,5,sprintf("%10.1f gr",$stock),0,0,'R',true); 153 $this->Cell(30,5,sprintf("%10.1f gr",$stock),0,0,'R',true);
149 $this->Cell(20,5,sprintf("%8.2f ",$row['cost']).EURO,0,0,'R',true); 154 $this->Cell(20,5,sprintf("%8.2f ",$row['cost']).EURO,0,0,'R',true);
150 $this->Cell(20,5,sprintf("%8.2f ",$value).EURO,0,0,'R',true); 155 $this->Cell(20,5,sprintf("%8.2f ",$value).EURO,0,0,'R',true);
151 $this->Ln(); 156 $this->Ln();
152 $this->ColorIndex=1-$ci; 157 $this->ColorIndex=1-$ci;
178 $this->TableHeader(); 183 $this->TableHeader();
179 $this->SetFont('Helvetica','',9); 184 $this->SetFont('Helvetica','',9);
180 $this->ColorIndex=0; 185 $this->ColorIndex=0;
181 $this->ProcessingTable=true; 186 $this->ProcessingTable=true;
182 187
183 $result = mysqli_query($link, "SELECT name,laboratory,product_id,form,inventory,cost FROM inventory_yeasts WHERE inventory > 0 ORDER BY laboratory,product_id"); 188 $sql = "SELECT name,laboratory,product_id,form,inventory,cost FROM inventory_yeasts WHERE inventory > 0 ORDER BY laboratory,product_id";
189 $result = mysqli_query($link, $sql);
184 $tot_yeasts = 0.0; 190 $tot_yeasts = 0.0;
185 191
186 while($row=mysqli_fetch_array($result)) { 192 while($row=mysqli_fetch_array($result)) {
187 $value = $row['inventory'] * $row['cost']; 193 $value = $row['inventory'] * $row['cost'];
188 $tot_yeasts += $value; 194 $tot_yeasts += $value;
189 $stock = floatval($row['inventory']) * 1000.0; 195 if ($row['form'] == 0)
190 ($row['form'] == 'Dry') ? $amount = "gr" : $amount = "ml"; 196 $stock = floatval($row['inventory']);
197 else
198 $stock = floatval($row['inventory']) * 1000.0;
199 $form = array( 'pak', 'gr', 'ml', 'ml', 'ml', 'ml' );
191 200
192 $this->SetX($this->TableX); 201 $this->SetX($this->TableX);
193 $ci=$this->ColorIndex; 202 $ci=$this->ColorIndex;
194 $this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]); 203 $this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]);
195 $this->Cell(30,5,iconv('UTF-8','windows-1252',$row['laboratory']),0,0,'L',true); 204 $this->Cell(30,5,iconv('UTF-8','windows-1252',$row['laboratory']),0,0,'L',true);
196 $this->Cell(20,5,iconv('UTF-8','windows-1252',$row['product_id']),0,0,'L',true); 205 $this->Cell(20,5,iconv('UTF-8','windows-1252',$row['product_id']),0,0,'L',true);
197 $this->Cell(70,5,iconv('UTF-8','windows-1252',$row['name']),0,0,'L',true); 206 $this->Cell(70,5,iconv('UTF-8','windows-1252',$row['name']),0,0,'L',true);
198 $this->Cell(30,5,sprintf("%10.1f ",$stock).$amount,0,0,'R',true); 207 $this->Cell(30,5,sprintf("%10.1f ",$stock).$form[$row['form']],0,0,'R',true);
199 $this->Cell(20,5,sprintf("%8.2f ",$row['cost']).EURO,0,0,'R',true); 208 $this->Cell(20,5,sprintf("%8.2f ",$row['cost']).EURO,0,0,'R',true);
200 $this->Cell(20,5,sprintf("%8.2f ",$value).EURO,0,0,'R',true); 209 $this->Cell(20,5,sprintf("%8.2f ",$value).EURO,0,0,'R',true);
201 $this->Ln(); 210 $this->Ln();
202 $this->ColorIndex=1-$ci; 211 $this->ColorIndex=1-$ci;
203 } 212 }
229 $this->ColorIndex=0; 238 $this->ColorIndex=0;
230 $this->ProcessingTable=true; 239 $this->ProcessingTable=true;
231 240
232 $result = mysqli_query($link, "SELECT name,type,amount_is_weight,inventory,cost FROM inventory_miscs WHERE inventory > 0 ORDER BY type,name"); 241 $result = mysqli_query($link, "SELECT name,type,amount_is_weight,inventory,cost FROM inventory_miscs WHERE inventory > 0 ORDER BY type,name");
233 $tot_miscs = 0.0; 242 $tot_miscs = 0.0;
243 $type = array( 'Specerij', 'Kruid', 'Smaakstof', 'Klaringsmiddel', 'Brouwzout', 'Gistvoeding', 'Anders' );
234 244
235 while($row=mysqli_fetch_array($result)) { 245 while($row=mysqli_fetch_array($result)) {
236 $value = $row['inventory'] * $row['cost']; 246 $value = $row['inventory'] * $row['cost'];
237 $tot_miscs += $value; 247 $tot_miscs += $value;
238 $stock = floatval($row['inventory']) * 1000.0; 248 $stock = floatval($row['inventory']) * 1000.0;
239 ($row['amount_is_weight']) ? $amount = "gr" : $amount = "ml"; 249 ($row['amount_is_weight']) ? $amount = "gr" : $amount = "ml";
240 250
241 $this->SetX($this->TableX); 251 $this->SetX($this->TableX);
242 $ci=$this->ColorIndex; 252 $ci=$this->ColorIndex;
243 $this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]); 253 $this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]);
244 $this->Cell(30,5,iconv('UTF-8','windows-1252',$row['type']),0,0,'L',true); 254 $this->Cell(30,5,$type[$row['type']],0,0,'L',true);
245 $this->Cell(90,5,iconv('UTF-8','windows-1252',$row['name']),0,0,'L',true); 255 $this->Cell(90,5,iconv('UTF-8','windows-1252',$row['name']),0,0,'L',true);
246 $this->Cell(30,5,sprintf("%10.1f ",$stock).$amount,0,0,'R',true); 256 $this->Cell(30,5,sprintf("%10.1f ",$stock).$amount,0,0,'R',true);
247 $this->Cell(20,5,sprintf("%8.2f ",$row['cost']).EURO,0,0,'R',true); 257 $this->Cell(20,5,sprintf("%8.2f ",$row['cost']).EURO,0,0,'R',true);
248 $this->Cell(20,5,sprintf("%8.2f ",$value).EURO,0,0,'R',true); 258 $this->Cell(20,5,sprintf("%8.2f ",$value).EURO,0,0,'R',true);
249 $this->Ln(); 259 $this->Ln();

mercurial