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L ^8!b9٢lp_n;|-ܳ1+DC1Z˟1t0L8Dz7T<{C2Dd%!SÉa~`"Q%BuV%c Y4tK,0 ۹;Q2 Oi7"?{loLP+m]Jz,9tvU^))dȔ܃X\ɇK%zb'UpߕL8 NqF:U},)D%}jvS>ȹlM4 G0}eYևmCA2xZv.c^Y2gO%Kz}׵_k`+9xgˍ$Q@I6=bګ1Ž`~@}6|V}T kI1כ$爹 ǖ__){9&&^<4)V˦P' e0ǪvcjyS\Cw`XB={ż.uzOSWȲNUs_)̌=E˅t\\x\FAzTfޑpF0һ3^HR_")YX7Pr$ Lh*dd:pv d)>* !'#=Z?{8x߱SwTz .ڂzZ3ֈ$zTO3=o%u~Z4 M0h
ACCOUNT
"; echo "
ITEM
"; /* echo ""; echo ""; echo fillList($con,"select distinct itemname from item where LabID='$LabID' order by itemname"); echo ""; */ echo "
FROM


TO
"; ?>





Sale Detail
#InvNoDateAccountItemqtypriceAmountppProfit"; $date_ = date('d-m-Y',strtotime($row['date_'])); $actname =getName($con,"select name from accounts where id='".$row['actid']."'"); $itemname =getName($con,"select CONCAT(itemname ,' ',model) from item where itemid='".$row['itemid']."'"); echo "
".$cnt.""; if($_SESSION['LabID']==30) echo" ". $row['invno'].""; //echo "".$cnt.""; else echo" ". $row['invno'].""; echo "$date_$actname$itemname". $row['qty']."".round($row['uprice'],2)."".round($row['qty']*$row['uprice'],2); $profit=($row['qty']*$row['uprice'])-($row['qty']*$row['pprice']); echo "".round($row['pprice'],2); echo "".round($profit,2); $price=getName($con,"select uprice from item where itemid='".$row['itemid']."'"); if($price!=$row['pprice']) echo "".$price; $creditAmt+=$row['qty']*$row['uprice']; $profitAmt+=$row['qty']*$row['uprice']-$row['qty']*$row['pprice']; $qty+=$row['qty']; } if($cnt>0) echo "
Summary".round($qty)."".round($creditAmt)."".round($profitAmt)."
"; exit(); } if($imei==""){ echo ""; $saleAmt=round(getName($con,"select IFNULL(sum(qty*uprice),0) from sale where $qry ")); $saleAmt-=round(getName($con,"select ifnull(sum(qty*uprice),0) from saleReturn where $qry ")); echo "
SalePurchaseProfitExpensesDiscountNet_Profit"; //echo "
Sale$saleAmt"; $purchaseAmt=getName($con,"select IFNULL(sum(qty*pprice),0) from sale where $qry "); $purchaseAmt-=getName($con,"select ifnull(sum(qty*pprice),0) from saleReturn where $qry "); //echo "
Purchase$purchaseAmt"; $amt=$saleAmt-$purchaseAmt; //echo "
Profit$amt"; $expenses="select IFNULL(sum(Amount),0) from expensesdaily where LabID='". $_SESSION['LabID'] ."' and (Date_ BETWEEN '$fromdate' AND '$todate') "; $expenses=round(getName($con,$expenses)); //echo "
Expenses$expenses"; $paymentDisc=(getName($con,"select IFNULL(sum(discount),0) from payments where type='Receipt' and LabID='". $_SESSION['LabID'] ."' and (date_ BETWEEN '$fromdate' AND '$todate') ")); $discount="select IFNULL(sum(discount),0) from sale2 where LabID='". $_SESSION['LabID'] ."' and (Date_ BETWEEN '$fromdate' AND '$todate') "; $discount=getName($con,$discount); $discount-=$paymentDisc; //$discount=round($discount); //echo "
Discount$discount"; $netamt=$amt-$expenses; $netamt-=$discount; //echo "
Net Profit$amt"; echo "
$saleAmt".round($purchaseAmt)."".round($amt)."$expenses".round($discount)."".round($netamt); //$amt=getName($con,"select IFNULL(sum(qty*uprice)-sum(qty*pprice),0) from sale where $qry "); //$amt-=getName($con,"select IFNULL(sum(qty*uprice)-sum(qty*pprice),0) from saleReturn where $qry "); //echo "
Profit$amt"; echo "

"; } $tMeter=$qty=0; if($imei!=""){ //$run = mysqli_query($con,"select date_,actid,itemid,invno,qty,uprice from sale where $qry and invno in(select invno from imeitbl where invtype='saleno' and imei='$imei' ) order by date_"); $run = mysqli_query($con,"select date_,actid,itemid,invno,qty,uprice,meter from purchase where $qry and invno in(select invno from imeitbl where invtype='pno' and imei='$imei' ) order by date_,invno"); }else{ $run = mysqli_query($con,"select date_,actid,itemid,invno,qty,uprice,meter from purchase where $qry order by date_,invno"); } while ($row=mysqli_fetch_array($run)){ if($cnt++==0) echo "
Purchases Detail
#InvNoDateAccountItemMeterqtypriceAmount"; $date_ = date('d-m-Y',strtotime($row['date_'])); $actname =getName($con,"select name from accounts where id='".$row['actid']."'"); $itemname =getName($con,"select CONCAT(itemname ,' ', model) from item where itemid='".$row['itemid']."'"); echo "
".$cnt.""; echo" ". $row['invno'].""; echo "$date_$actname$itemname".$row['meter']."". $row['qty']."". $row['uprice']; if($row['meter']>0){ echo "".$row['meter']*$row['qty']*$row['uprice']; $creditAmt+=$row['qty']*$row['uprice']*$row['meter']; }else{ echo "".$row['qty']*$row['uprice']; $creditAmt+=$row['qty']*$row['uprice']; } $tMeter+=$row['qty']*$row['meter']; $qty+=$row['qty']; } if($cnt>0) echo "
Summary$tMeter$qty$creditAmt
"; $tMeter=$cnt=$qty=0; $run = mysqli_query($con,"select * from purchaseReturn where $qry order by date_"); while ($row=mysqli_fetch_array($run)){ if($cnt++==0) echo "
Purchases Return Detail
#InvNoDateAccountItemqtypriceAmount"; $date_ = date('d-m-Y',strtotime($row['date_'])); $actname =getName($con,"select name from accounts where id='".$row['actid']."'"); $itemname =getName($con,"select CONCAT(itemname ,' ', model) from item where itemid='".$row['itemid']."'"); echo "
".$cnt.""; echo" ". $row['invno'].""; echo "$date_$actname$itemname".$row['meter']."". $row['qty']."". $row['uprice']; if($row['meter']>0){ echo "".$row['meter']*$row['qty']*$row['uprice']; $creditAmt+=$row['qty']*$row['uprice']*$row['meter']; }else{ echo "".$row['qty']*$row['uprice']; $creditAmt+=$row['qty']*$row['uprice']; } $tMeter+=$row['qty']*$row['meter']; $qty+=$row['qty']; } if($cnt>0) echo "
Summary$creditAmt
"; $qty=0; $tMeter=$profitAmt=$creditAmt=$cnt=0; $qry2=" s.LabID='". $_SESSION['LabID'] ."' and (s.Date_ BETWEEN '$fromdate' AND '$todate') "; if($actid!="") $qry2.= " and s.actid='$actid'"; if($itemid!="") $qry2.=" and s.itemid='$itemid'"; if($imei!=""){ //$run = mysqli_query($con,"select date_,actid,itemid,invno,qty,uprice,meter from sale where $qry and invno in(select invno from imeitbl where invtype='saleno' and imei='$imei' ) order by date_"); $run = mysqli_query($con,"select s.date_,s.actid,s.itemid,s.invno,s.qty,s.uprice,s.pprice,s.meter,CONCAT(i.itemname ,' ',i.model) as itemname,a.name from sale s,item i,accounts a where s.itemid=i.itemid and s.actid=a.id and $qry2 and s.invno in(select invno from imeitbl where invtype='saleno' and imei='$imei' ) order by s.date_"); }else{ //$run = mysqli_query($con,"select date_,actid,itemid,invno,qty,uprice,pprice,meter from sale where $qry order by date_,invno"); $run = mysqli_query($con,"select s.date_,s.actid,s.itemid,s.invno,s.qty,s.uprice,s.pprice,s.meter,CONCAT(i.itemname ,' ',i.model) as itemname,a.name from sale s,item i,accounts a where s.itemid=i.itemid and s.actid=a.id and $qry2 order by s.date_,s.invno"); } while ($row=mysqli_fetch_array($run)){ if($cnt++==0) echo "
Sale Detail
#InvNoDateAccountItemMeterqtypriceAmountppProfit"; $date_ = date('d-m-Y',strtotime($row['date_'])); $actname =$row['name']; //getName($con,"select name from accounts where id='".$row['actid']."'"); $itemname =$row['itemname']; //getName($con,"select CONCAT(itemname ,' ', model) from item where itemid='".$row['itemid']."'"); echo "
".$cnt.""; if($_SESSION['LabID']==30) echo" ". $row['invno'].""; //echo "".$cnt.""; else echo" ". $row['invno'].""; echo "$date_$actname$itemname".$row['meter']."". $row['qty']."".round($row['uprice'],2); $price=getName($con,"select uprice from item where itemid='".$row['itemid']."'"); //$creditAmt+=$row['qty']*$row['uprice']; $qty+=$row['qty']; if($row['meter']>0){ echo "".$row['meter']*$row['qty']*$row['uprice']; $creditAmt+=$row['qty']*$row['uprice']*$row['meter']; $profit=($row['meter']*$row['qty']*$row['uprice'])-($row['meter']*$row['qty']*$row['pprice']); }else{ echo "".$row['qty']*$row['uprice']; $creditAmt+=$row['qty']*$row['uprice']; $profit=($row['qty']*$row['uprice'])-($row['qty']*$row['pprice']); } $profitAmt+=$profit; echo "".round($row['pprice'],2); echo "".round($profit,2); if($price!=$row['pprice']) echo "".$price; $tMeter+=$row['qty']*$row['meter']; } if($cnt>0) echo "
Summary$tMeter".round($qty)."".round($creditAmt)."".round($profitAmt)."
"; //Sale Return $profitAmt=$tMeter=$creditAmt=$cnt=$qty=0; //$run = mysqli_query($con,"select * from saleReturn where $qry order by date_"); $run = mysqli_query($con,"select s.date_,s.actid,s.itemid,s.invno,s.qty,s.uprice,s.pprice,s.meter,CONCAT(i.itemname ,' ',i.model) as itemname,a.name from saleReturn s,item i,accounts a where s.itemid=i.itemid and s.actid=a.id and $qry2 order by s.date_,s.invno"); while ($row=mysqli_fetch_array($run)){ if($cnt++==0) echo "
Sale Return Detail
#Inv NoDateAccountItemMeterqtypriceAmountpploss"; $date_ = date('d-m-Y',strtotime($row['date_'])); //$actname =getName($con,"select name from accounts where id='".$row['actid']."'"); //$itemname =getName($con,"select CONCAT(itemname ,' ', model) from item where itemid='".$row['itemid']."'"); echo "
".$cnt." ". $row['invno'].""; echo "$date_".$row['name']."".$row['itemname']."".$row['meter']."". $row['qty']."". $row['uprice']; if($row['meter']>0){ echo "".$row['meter']*$row['qty']*$row['uprice']; $creditAmt+=$row['qty']*$row['uprice']*$row['meter']; $profit=($row['meter']*$row['qty']*$row['uprice'])-($row['meter']*$row['qty']*$row['pprice']); }else{ echo "".$row['qty']*$row['uprice']; $creditAmt+=$row['qty']*$row['uprice']; $profit=($row['qty']*$row['uprice'])-($row['qty']*$row['pprice']); } echo "".round($row['pprice'],2)."".round($profit); $profitAmt+=$profit; $qty+=$row['qty']; $tMeter+=$row['qty']*$row['meter']; } if($cnt>0) echo "
Summary$tMeter$qty$creditAmt".round($profitAmt)."
"; //sold items $cnt=$qty=0; $run = mysqli_query($con,"select s.itemid,i.itemname,sum(s.qty) as qty from sale s, item i where s.itemid=i.itemid and s.LabID='$LabID' and (s.date_ BETWEEN '$fromdate' AND '$todate') group by s.itemid,i.itemname ORDER BY SUM(s.qty) DESC,i.itemname "); while ($row=mysqli_fetch_array($run)){ if($cnt++==0) echo "
Total Items Sold Report
#ItemQty"; //$itemname =getName($con,"select CONCAT(itemname ,' ', model) from item where itemid='".$row['itemid']."'"); echo "
".$cnt.""; echo "".$row['itemname']; echo "". $row['qty']; $qty+=$row['qty']; } if($cnt>0) echo "
Summary$qty
"; mysqli_close($con); ?>