Exemplo n.º 1
0
 function savePartQuantity()
 {
     $db = Database::getInstance();
     $cxn = $db->getConnection();
     if ($this->supplierid == '' && $this->moutwardid != '') {
         $q = "INSERT INTO MO_Drg_Qty (Material_Outward_ID,MI_Drg_Qty_ID,Drawing_ID,Outward_Qty)\n\t\t\tVALUES({$this->moutwardid},{$this->midrgqtyid},{$this->partid},{$this->qty})";
         //print("<br>$q");
         if (!($res = $cxn->query($q))) {
             echo "error :", $cxn->error;
         } else {
             $pm = new PartMaterial();
             $pm->setMIDQID($this->midrgqtyid);
             $pm->setPartMaterialDetails();
             $materialreceived = $pm->getQuantity();
             $query = "SELECT sum(Outward_Qty) as oq from MO_Drg_Qty where Drawing_ID={$this->partid} and MI_Drg_Qty_ID={$this->midrgqtyid}";
             //								print("<br>$query");
             if (!($resq = $cxn->query($query))) {
                 echo "error :", $cxn->error;
             } else {
                 $r = mysqli_fetch_assoc($resq);
                 $oq = $r['oq'];
                 $tq = $materialreceived - $oq;
                 //									print("<br>Material received=$materialreceived");
                 if ($tq == 0) {
                     $q3 = "UPDATE MI_Drg_Qty SET Qty_Open='0' WHERE MI_Drg_Qty_ID={$this->midrgqtyid}";
                     //											print("<br>$q3");
                     if (!($resq = $cxn->query($q3))) {
                         echo "error :", $cxn->error;
                     }
                 }
             }
             //								print("Part Quantity of $this->qty Updated in Challan");
         }
         $inwardid = $pm->getInwardID();
         $q4 = "SELECT Drawing_ID FROM MI_Drg_Qty WHERE Qty_Open=1 AND Material_Inward_ID={$inwardid};";
         //print("<br>$q4");
         $res4 = $cxn->query($q4);
         $opendqty = $res4->num_rows;
         if ($opendqty == 0) {
             $q5 = "UPDATE Material_Inward SET Open=0 WHERE Material_Inward_Id={$inwardid};";
             //print("<br>$q5");
             $res5 = $cxn->query($q5);
         }
     } else {
         $q = "INSERT INTO Misc_Material (Material_Outward_ID,Supplier_ID,Material_Desc,Misc_Qty,Misc_Remarks)\n\t\t\tVALUES({$this->moutwardid},{$this->supplierid},'{$this->miscdec}',{$this->qty},'{$this->remark}')";
         //print("<br>$q");
         if (!($res = $cxn->query($q))) {
             echo "error :", $cxn->error;
         }
     }
 }
Exemplo n.º 2
0
 $pdf->MultiCell(80, 8, $part->getPartName() . " " . $part->getDrawingNO() . ' Rev No: ' . $part->getPartRevision(), 0, 'L', 0, 0, '', '', true, 0, false, true, 8, 'M', true);
 //part name and drawing no
 $pdf->Cell(35, 8, $dq_list[$j][1], 0, 0, 'C');
 //total quantity
 $pdf->Cell(50, 8, $dq_list[$j][2], 0, 1, 'L');
 //remarks for each part
 ///print material receipt details
 if ($cqr_list[$j][0] != '') {
     $t = 0;
     while ($t < $dq_list[$j][1]) {
         $t += $cqr_list[$l][2];
         $pdf->SetFont('helvetica', 'I', 8);
         //body font
         $pma = new PartMaterial();
         $pma->setMIDQID($cqr_list[$l][1]);
         $pma->setPartMaterialDetails();
         if ($custid == 3 || $custid == 10) {
             $pdf->Cell(50, 7, 'GP No: ' . $pma->getGpno() . " Dated: " . $pma->getGpDate(), 0, 0, 'L');
             $pdf->Cell(50, 7, ",DA No: " . $pma->getDano() . " Dated: " . $pma->getDaDate(), 0, 0, 'L');
             $pdf->Cell(50, 7, ",Ex Ch No: " . $pma->getExchallanno() . " Dated: " . $pma->getExchallandate(), 0, 1, 'L');
         } else {
             $pdf->Cell(20, 7, '', 0, 0, 'C');
             $pdf->MultiCell(80, 7, 'Ex Ch No: ' . $pma->getExchallanno() . " Dated: " . $pma->getExchallandate() . ', Qty: ' . $cqr_list[$l][2], 0, 'L', 0, 1, '', '', true, 0, false, true, 7, 'M', true);
             //part name and drawing no
             //						$pdf->Cell(50,7,'Ex Ch No: '.$pma->getExchallanno()." Dated: ".$pma->getExchallandate(),0,0,'L');
         }
         //						$pdf->Cell(15,7," Qty: ".$cqr_list[$l][2],0,1,'L');
         $l++;
     }
 }
 if (isset($dq_list[$j + 1])) {