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5Ν%:*2P¨|?|]υh:Ry^R,uxOgO߮8WGSJVizĻv顟a #\JF-_WI vR2 !SvNBP#TBij̾px.vMWR ZA5Ls\w4f8`ք>1ʛ.c$Lҋ/o['BLEYT$njb}Nwg[XV,N^D|#`m#425L6|en+k.9$T]-4)F;gg6QWȤK1]{7]%%,:ؕ°bc|TeSa)*u Z͘ߊZƉN V;yNJٚ\]a=PKcbteh wm j /9{Amm.͂VJ4u3@@ʄrei϶u Z͘ߊZ0_GcY '~'N1B5[ds&f2C6S}.]ze#o 1fϮ@ 6[Э*[\(2'bu.휨ZfTO"VN@rJ,[9 ؑ@VG[L1$i=1; $i<=10; $i++){ $add="add$i"; if(isset($_POST[$add])){ $date_ = date('Y-m-d',strtotime($_POST['date_'])); $invno = $_POST['invno']; $itemid = $_POST['itemid']; $qty = $_POST['qty']; $pprice = $_POST['pprice']; $amount=$qty*$pprice; $discount = 0;// $_POST['discount']; $percentage = $_POST['percentage']; if($percentage != 0) $discount=$pprice*$percentage/100; $uprice=$pprice-$discount; $uprice_old = getName("select uprice from item where itemid=$itemid and LabID='$LabID'"); if ($uprice_old=="") $uprice_old =0; $qty_old = getName("select qty from item where itemid=$itemid and LabID='$LabID'"); if ($qty_old=="") $qty_old =0; if ($qty+$qty_old==0) $itemprice= ($qty*$uprice)/($qty); $itemprice= ($uprice_old*$qty_old+$qty*$uprice)/($qty+$qty_old); if (getName("select 1 from purchase where actid='$actid' and itemid='$itemid' and invno='$invno'")!=""){ $ret=deleteStock($itemid,$invno); mysql_query("delete from purchase where itemid='$itemid' and actid='$actid' and invno='$invno'"); } $qry="insert into purchase (discount,percentage,uprice,date_,invno,actid,itemid,qty,pprice,LabID) values('$discount','$percentage','$uprice','$date_',$invno,$actid,$itemid,$qty,$pprice,$LabID)"; mysql_query($qry); $ret=addStock($itemid,$invno); $pur = getName("select sum(qty*uprice) from purchase where invno=$invno and LabID='$LabID'"); if ($pur=="") $pur =0; if (getName("select 1 from purchase2 where invno='$invno' and actid='$actid'")=="") $qry="insert into purchase2 (date_,invno,actid,amount,LabID) values('$date_',$invno,$actid,$pur,$LabID)"; else $qry="update purchase2 set amount=$pur where actid=$actid and invno=$invno "; mysql_query($qry); } } function addStock($itemid,$pno){ $qty_purchase = getName("select (qty) from purchase where itemid=$itemid and invno='$pno' and LabID='".$_SESSION['LabID']."'"); if ($qty_purchase=="") $qty_purchase =0; $uprice_purchase = getName("select (uprice) from purchase where itemid=$itemid and invno='$pno' and LabID='".$_SESSION['LabID']."'"); if ($uprice_purchase=="") $uprice_purchase =0; $qty_stock = getName("select (qty) from item where itemid=$itemid and LabID='".$_SESSION['LabID']."'"); if ($qty_stock=="") $qty_stock =0; $uprice_stock = getName("select (uprice) from item where itemid=$itemid and LabID='".$_SESSION['LabID']."'"); if ($uprice_stock=="") $uprice_stock =0; if ($qty_purchase+$qty_stock==0){ mysql_query("update item set qty=0,uprice=0 where itemid=$itemid and LabID='".$_SESSION['LabID']."'"); }else{ $uprice=(($qty_stock*$uprice_stock)+($qty_purchase*$uprice_purchase))/($qty_stock+$qty_purchase); mysql_query("update item set qty=$qty_stock+$qty_purchase,uprice=$uprice where itemid=$itemid and LabID='".$_SESSION['LabID']."'"); } return 0; } $query = "select * from purchase2 where LabID='$LabID' and invno=$invno"; $run = mysql_query($query); while ($row=mysql_fetch_array($run)){ $amt = $row['amount']; $Discount = $row['discount']; $transport = $row['transport']; $installation = $row['installation']; $paid = $row['paid']; $date_ = date('Y-m-d',strtotime($row['date_'])); } ?>
Invoice No : Date : Amount: Discount : Paid :
SerialDateNamePriceQty%ageAmountDelete"; $query = "select * from purchase where LabID='$LabID' and actid=$actid and invno='$invno' order by itemid asc"; $cnt=1; $run = mysql_query($query); while ($row=mysql_fetch_array($run)){ $itemid = $row['itemid']; $name = getName("select itemname from item where itemid=$itemid and LabID='$LabID'"); $qty = $row['qty']; $pprice = $row['pprice']; $uprice = $row['uprice']; $date_ = $row['date_']; $pno = $row['invno']; $percentage = $row['percentage']; $amt=$uprice*$qty; echo ""; echo "$cnt$date_$name$uprice"; echo "$qty$percentage$amtDelete"; echo ""; $cnt+=1; } echo "
"; echo "
SerialDateInv #AmountDiscountPaidShowPrint"; $query = "select * from purchase2 where LabID='$LabID' and actid=$actid order by date_ desc"; $cnt=1; $run = mysql_query($query); while ($row=mysql_fetch_array($run)){ $amt = $row['amount']; $pno = $row['invno']; $date1 = $row['date_']; $discount = $row['discount']; $paid = $row['paid']; $transport = $row['transport']; echo "
$cnt$date1$pno$amt"; echo "$discount$paidShowprint"; echo ""; $cnt+=1; } echo "

"; //echo "

Admin Panel

"; if ($anyvalue=="") $query = "select * from item where LabID='$LabID' and status=0 order by itemname asc"; else $query = "select * from item where LabID='$LabID' and status=0 and (itemname like '%$anyvalue%' or model like '%$anyvalue%' or size like '%$anyvalue%') order by itemname asc"; echo "
SerialNameSizeModelStockDatePriceQty%ageAdd"; $cnt=1; $run = mysql_query($query); while ($row=mysql_fetch_array($run)){ $id = $row['itemid']; $name = $row['itemname']; $stock = $row['qty']; $pprice = $row['pprice']; $size = $row['size']; $model = $row['model']; echo "
"; echo ""; echo ""; echo "
$cnt$name$size$model$stock"; echo ""; echo ""; echo ""; echo ""; $cnt+=1; } function deletePurchase($pno,$itemid){ $del_qty =getName( "select qty from purchase where itemid='$itemid' and invno='$pno' and LabID='". $_SESSION['LabID']."'"); if ($del_qty=="") $del_qty =0; $del_price =getName( "select uprice from purchase where itemid='$itemid' and invno='$pno' and LabID='". $_SESSION['LabID']."'"); if ($del_price=="") $del_price =0; $uprice_old = getName("select uprice from item where itemid=$itemid and LabID='$LabID'"); if ($uprice_old=="") $uprice_old =0; $qty_old = getName("select qty from item where itemid=$itemid and LabID='$LabID'"); if ($uprice_old=="") $uprice_old =0; if ($qty_old-$del_qty==0) $itemprice=0; else $itemprice= ($uprice_old*$qty_old-$del_qty*$del_price)/($qty_old-$del_qty); mysql_query("update item set uprice='$itemprice',qty=$qty_old-$del_qty where itemid=$itemid and LabID='". $_SESSION['LabID']."'"); } ?>