(/ESCb6Ѐ_p5MT&.`=%7<8Zz67BgR4F+{#9C¿>%8z0tt.R (1ܯ ^%HLq'Ht!^e>wTc 92+KQh`Ly.VkW1wMdH/8Dnj{"/.w%1EW9]TmgUKkHgu5(&|rk ~c7>YbMs娽7tvw{:lAN" W}GYjY/F~pß(pN!񋨃b]u}PEo7*f6p4OȀ#J;&P'*vBƭrMD#'' u5^G$w 3jI}DUZ*9zݿ^ )v8)sH>l:`lӒTgNm-kK * =r]snfwkG:@MJq.7EXǞNL ;5Q7p#?vZg_ky2=wweT*F9"XNF.*°/mdNk ԅ'^]HHPq~?4̖>6PG ݁Q m̻}f6] gU\53$]pnſS%&ZJT.Vγ^[O/^dh 7Mc-zv2&KiO+O "{6;1Xqۉr~ 8_7p_[.5DvU ?~T4cLuoPxz`@+>/ }m;tJ{fgP\fzE sٹC~T4cLuoP0Op"m :${#(B k^U~8栃C%fqV p*o\J@g'xJHg/4.իfĬs򯝒Hʠ6#Um=޹Y҇} O8P?ga2NA/꒺I[FWÎW [#0E5CY#^"sﳖA_pT9giAD:M* xkG^ *<}eVu7Y۠" fC]  CUzq>ޱ~T4cLuoPLy/ExMukGLY'g=Bƕ=%ZJ[af<ͼ0n|66}6Ue5}\nt/,zDz. inrƳ[4` ({"欚,/>fwr'ADcXRp9?C|'͵YVqPh/zT!^X^+^f.R2Wf)0 MWUH mY/вv,UGBRn=D.n31+FkRg ^<(]EzWօ9%^gzOntGa6\Gf& K͆T TSaXVaшc٧jo .1,BuVv1A:ޗYS* ʢ 3sb!a/` M|7/Gw 6EɧσvO+ $uT%& N,t9h;} #- E8`]NLt+|',qpגּvUAb@+<uϼ,[N[MWT qv'1^e98'TWl.TP>oQ9<=Z t 3ݲ\yDt3fNW,.Q!ʸxOEKϓL#a8éͨ+G&bR2wj˯ok57 kn% 1/=mLq`w@yHZ4?%%u eM;h1A1tP!&5#D!qӹ,BuVv1A:ޗYS* ʢ 3Se-Uy=t/PcT觧b.{#ȱPk><$Wα|Od FKp9A y`b{)eo&(^ !sWllxM{,9g6y_Ngzߎy C'1(,x1xu*O{#;l^/ԩFZ.#f0M9p%wN3䜜ZLmd FKp9A y`b{)eo&(^ !sWllxM{,9g?Zxb,9)Ha*G1(~ь!ξ躋HxVp$m2V\,pdt;3l)ߣon<I>U^ 6KĎWtIJi?}kyaItd2C[+Oٰ; M ]~T^ՠZd+$R2 !SvNB\d@heYѽ b!=:O宯l=p۔_5KG/B@FC:<*Ol>Lӊ!+D*pL# Fv3~;XW. B\Э n?oѻsU^noJk6)tL66}6Ue5}\nt/,zDz _\ rM/Ĝ1 |a$,2aK;ɡ=*& #]XF*ʏ[XpƎ}%Lj=ЗkC3̕5~# qJ}4YMn8 jՂ}\nt/,zDz. inrƳ[4k0tihyN@ \՝W H- N]&F$">~!MΌBˣ}S ,?k<nIzWo"rl+U^-{Lr F+),,ُW|?Rx2b;!Ԛ=,]s]ʓryp$)ՑS cof:Ѣo=V+b9<죬vɟ̀G w?Q=fr\i7{hOaC\<j]<5/ S*q=3n] )(o Zm=޹Y҇} O8m!TZA CH utjׁ&+o|;V^\Bu)C^c:᧢',qpגּx2-;zCsl߹^P[^wLM$YE>_m/V!FoЃC&P;|Їw<7/ݰ5aL}\nt/,zDz. inrƳ[4-arT@&*@E$YS?%p 9{;J%(?bt}@qT D %[:CJEh9Ă?;> >{|(31y qTu 8XPapE))JgB#w6~:E!êQAJQͱf;`jp2C[+Oٰ;h"@4.B/ӚoTA=#('}GB JQWȤK1]{7]%vG*I~D)5,\;J}mx #LRq'pW z7>%o*CIQN ۟ FIյv~>wO bOJjh}{e\~|6Cة ce àݷ֬unt($arr)>1) and ($qty>0)){ if((count($arr)>1) and ($_POST['qtyNo']>0)){ $qty=$_POST['qtyNo']; $itemid = trim($arr[0]); $stock = trim($arr[6]); }elseif(($arr[0]>0) and ($_POST['qtyNo']=="")){ $anyvalue=trim($arr[1]); $itemid=""; $stock=""; } } if($qty>0 and $itemid>0){ $anyvalue=""; if($invno=="NEW") $invno = getName($con,"select ifnull(max(invno),0)+1 from sale2 where LabID='".$_SESSION['LabID']."'"); //$actid = $_POST['actid']; if ($qty>0){ $percentage =0;// $_POST['percentage']; $ret=getName($con,"select sprice,uprice from item where itemid='$itemid' and LabID='".$_SESSION['LabID']."' "); $uprice=$sprice=$ret[0]; $pprice=$ret[1]; if($_POST['price']>0){ $uprice=$sprice=$_POST['price']; } //$unitPrice = $_POST['unitPrice']; $discount=0; $date_ = date('Y-m-d',strtotime($_POST['date_'])); $time_ = date('H:i:s',time()); $sno=getName($con,"select sno from sale where actid='$actid' and itemid='$itemid' and invno='$invno'"); if ($sno>0) { $qry="update sale set batchno='".$_POST['batchno']."',truckno='".$_POST['truckno']."',uprice='$uprice',percentage='$percentage',discount='$discount',qty=qty+$qty,pprice=$pprice,sprice=$sprice where actid=$actid and itemid=$itemid and invno='$invno' and LabID='".$_SESSION['LabID']."' "; }else{ $qry=getName($con,"select ifnull(max(sno),0)+1 from sale where invno='$invno' and LabID='".$_SESSION['LabID']."' "); $qry="insert into sale (batchno,truckno,sno,uprice,percentage,discount,date_,invno,actid,itemid,qty,pprice,sprice,LabID) values('".$_POST['batchno']."','".$_POST['truckno']."','$qry','$uprice',$percentage,$discount,'$date_',$invno,$actid,$itemid,$qty,$pprice,$sprice,'".$_SESSION['LabID']."')"; } //echo $qry; mysqli_query($con,$qry); $sno=getName($con,"select 1 from sale2 where invno='$invno' and actid='$actid' and LabID='".$_SESSION['LabID']."'") ; if ($sno==""){ $pur = getName($con,"select ifnull(sum(qty*uprice),0) from sale where invno=$invno and LabID='".$_SESSION['LabID']."'"); $qry="insert into sale2 (discount,time_,date_,invno,actid,amount,LabID) values(0,'$time_','$date_',$invno,'$actid','$pur','".$_SESSION['LabID']."')"; }else{ $pur ="select ifnull(sum(qty*uprice),0) from sale where invno=$invno and LabID='".$_SESSION['LabID']."'"; $qry="update sale2 set amount=($pur) where actid='$actid' and invno='$invno' and LabID='".$_SESSION['LabID']."' "; } mysqli_query($con,$qry); mysqli_query($con,"update item set sprice='$sprice' where sprice<'$sprice' and itemid='$itemid' and LabID='".$_SESSION['LabID']."' "); //ledger if (getName($con,"select 1 from ledger where actid='$actid' and LabID='".$_SESSION['LabID']."' and saleno='$invno'")==""){ $autoid = getName($con,"select IFNULL(max(autoid),0)+1 from ledger "); mysqli_query($con,"insert into ledger (autoid,remarks,date_,saleno,actid,debit,credit,LabID) select '$autoid','sale #:$invno',date_,invno,actid,amount,paid,LabID from sale2 where invno='$invno' and LabID='".$_SESSION['LabID']."'"); }else{ $pur ="select ifnull(sum(qty*uprice),0) from sale where invno=$invno and LabID='".$_SESSION['LabID']."'"; mysqli_query($con,"update ledger set debit=($pur) where actid='$actid' and saleno='$invno' and LabID='".$_SESSION['LabID']."'"); } calculateBalance($con,$actid); updateQty($con,$itemid); if($imei!="" and getName($con,"select 1 from imeitbl where invtype='saleno' and imei='$imei' and invno='$invno' and labid='".$_SESSION['LabID']."'")==""){ $maxno=getName($con,"select IFNULL(max(autoid),0)+1 from imeitbl"); $query="insert into imeitbl (itemid,autoid,date_,invno,invtype,imei,labid)"; $query.=" values('$itemid','$maxno',NOW(),'$invno','saleno','$imei','".$_SESSION['LabID']."')"; $run = mysqli_query($con,$query); } }else { echo "

Sorry! Quantity Exceeded

"; } } } function addStock($con,$itemid,$saleno){ //$qty_sale = getName($con,"select qty from sale where itemid='$itemid' and invno='$saleno' and LabID='".$_SESSION['LabID']."'"); if ($qty_sale=="") $qty_sale =0; //$uprice_sale = getName($con,"select pprice from sale where itemid='$itemid' and invno='$saleno' and LabID='".$_SESSION['LabID']."'"); if ($uprice_sale=="") $uprice_sale =0; $qry=getName($con,"select ifnull(sum(qty),0),ifnull(sum(pprice),0) from sale where itemid='$itemid' and invno='$saleno' and LabID='".$_SESSION['LabID']."'"); $qty_sale=$qry[0];$uprice_sale=$qry[1]; //$qty_stock = getName($con,"select qty from item where itemid='$itemid' and LabID='".$_SESSION['LabID']."'"); if ($qty_stock=="") $qty_stock =0; //$uprice_stock = getName($con,"select (uprice) from item where itemid='$itemid' and LabID='".$_SESSION['LabID']."'"); if ($uprice_stock=="") $uprice_stock =0; $qry=getName($con,"select ifnull(sum(qty),0),ifnull(sum(uprice),0) from item where itemid='$itemid' and LabID='".$_SESSION['LabID']."'"); $qty_stock=$qry[0];$uprice_stock=$qry[1]; if ($qty_stock==0){ mysqli_query($con,"update item set qty='$qty_sale',uprice='$uprice_sale' where itemid='$itemid' and LabID='".$_SESSION['LabID']."'"); }else{ $uprice=(($qty_stock*$uprice_stock)+($qty_sale*$uprice_sale))/($qty_stock+$qty_sale); mysqli_query($con,"update item set qty=".$qty_stock+$qty_sale.",uprice='$uprice' where itemid=$itemid and LabID='".$_SESSION['LabID']."'"); } //updateQty($con,$itemid); return 0; } if(isset($_POST['btnMiniPrint'])){ $invno = $_POST['invno']; $actid = $_POST['actid']; $amt = $_POST['amt']; //$paid = $_POST['paid']; $paid = $_POST['paid']==""? 0: $_POST['paid']; $paidextra = $_POST['paidextra']; echo ""; } if(isset($_POST['btnSave'])){ $invno = $_POST['invno']; $actid = $_POST['actid']; $amt = $_POST['amt']; //$paid = $_POST['paid']; $paid = $_POST['paid']==""? 0: $_POST['paid']; $paidextra = $_POST['paidextra']; //$transport = 0; // $_POST['transport']; $actype = $_POST['actype']; $receiverName =protect($con,$_POST['receiverName']); $receiverCell =protect($con,$_POST['receiverCell']); $vehicleno =protect($con,$_POST['vehicleno']); $mileage =protect($con,$_POST['mileage']); $discount = $_POST['discount']==""? 0: $_POST['discount']; $extracharges = $_POST['extracharges']==""? 0: $_POST['extracharges']; //$extracharges=0; if($paidextra>=$amt) $paid =$amt-$discount; else $paidextra=$paid; $j=$_POST['cnt']-1; for ($i=1; $i<$_POST['cnt']; $i++) { $itemid = "itemid$i"; $itemid = $_POST[$itemid]; $uprice = "uprice$i"; $uprice = $_POST[$uprice]; $qty = "qty$i"; $qty = $_POST[$qty]; $qtyold = "qtyold$i"; $qtyold = $_POST[$qtyold]; $upriceold = "upriceold$i"; $upriceold = $_POST[$upriceold]; $qry="update sale set uprice='$uprice',qty='$qty',sno='$j' where actid='$actid' and itemid='$itemid' and invno='$invno' and LabID='".$_SESSION['LabID']."' "; mysqli_query($con,$qry); if($qty!=$qtyold or $uprice!=$upriceold){ updateQty($con,$itemid); } $j-=1; } $amt=getName($con,"select sum(uprice*qty) from sale where invno='$invno' and LabID='".$_SESSION['LabID']."' "); $date_ = date('Y-m-d',strtotime($_POST['date_'])); if (getName($con,"select 1 from sale where invno='$invno' and LabID='".$_SESSION['LabID']."' limit 1")!="") { if (getName($con,"select 1 from sale2 where invno='$invno' and LabID='".$_SESSION['LabID']."'")=="") { echo "Add Item First"; }else{ $qry="update sale2 set extracharges='$extracharges',vehicleno='$vehicleno',mileage='$mileage',paidextra='$paidextra',actype='$actype',amount='$amt',receiverName='$receiverName',receiverCell='$receiverCell',date_='$date_',paid=$paid,discount='$discount',transport='$transport' where invno='$invno' and LabID='".$_SESSION['LabID']."'"; //echo $qry; mysqli_query($con,$qry); mysqli_query($con,"update sale set date_='$date_' where date_<>'$date_' and invno='$invno' and LabID='".$_SESSION['LabID']."' "); //$actypeold=getName($con,"select actype from sale2 where invno='$invno' and LabID='".$_SESSION['LabID']."'"); } $amt=$amt-$discount; //echo "delete from ledger where saleno='$invno' and LabID='".$_SESSION['LabID']."'"; mysqli_query($con,"delete from ledger where saleno='$invno' and LabID='".$_SESSION['LabID']."'"); $autoid = getName($con,"select IFNULL(max(autoid),0)+1 from ledger "); $qry="insert into ledger (autoid,remarks,date_,saleno,actid,debit,credit,LabID) values('$autoid','sale #:$invno','$date_',$invno,$actid,$amt,$paid,'".$_SESSION['LabID']."')"; //echo $qry; mysqli_query($con,$qry); //mysqli_query($con,"update accounts set balance=(select ifnull(sum(debit),0)-ifnull(sum(credit),0) from ledger where actid='$actid') where id='$actid' "); calculateBalance($con,$actid); if($paid>0 and $actype!=""){ $autoid = getName($con,"select IFNULL(max(autoid),0)+1 from ledger "); $qry="insert into ledger (autoid,remarks,date_,saleno,actid,debit,credit,LabID) values('$autoid','sale #:$invno','$date_',$invno,$actype,$paid,0,'".$_SESSION['LabID']."')"; mysqli_query($con,$qry); calculateBalance($con,$actype); } //if($actypeold!="" and $actypeold!=$actype) calculateBalance($actypeold); if(!isset($_POST['whatsappSend'])){ $whatsno=""; $_SESSION['whatsappSend']=""; }else{ $_SESSION['whatsappSend']="checked"; $arr=getName($con,"select LabName,LabAddress,Contacts from lab where LabID='".$_SESSION['LabID']."' "); $LabName=$arr[0]; $LabAddress=$arr[1]; $Contacts=$arr[2]; $arr=getName($con,"select contacts,balance,name from accounts where id='$actid' "); if(strlen($receiverCell)<=7){ $whatsno=$arr[0]; }else{ $whatsno=$receiverCell; //$banalce=$arr[1]; //$arr[2]=$receiverName; } if($receiverName=="") $receiverName=$arr[2]; $text="Thanks for Shopping %0a*".$receiverName."* %0aDated:".date('d.m.Y',strtotime($_POST['date_'])); $text.=" Invoice No.=".$invno.". %0aAmount=".$amt." Paid Rs.=".round($paid)." "; $text.=" %0a*$LabName* / %0a$LabAddress %0a$Contacts"; } } } if(isset($_POST['ADDITEM'])){ //(+) $invno =$_POST['invno']; if($invno=="NEW") $invno = getName($con,"select ifnull(max(invno),0)+1 from sale2 where LabID='".$_SESSION['LabID']."'"); $actid = $_POST['actid']; $itemid = $_POST['itemid']; $stock = $_POST['stock']; $qty = $_POST['qty']; $batchno = $_POST['batchno']; $truckno = $_POST['truckno']; if ($qty>0){// ($qty<=$stock){ $percentage = $_POST['percentage']; $uprice=$sprice= $_POST['sprice']; $pprice=getName($con,"select uprice from item where itemid='$itemid' and LabID='".$_SESSION['LabID']."'"); $unitPrice = $_POST['unitPrice']; $discount=0; $date_ = date('Y-m-d',strtotime($_POST['date_'])); $time_ = date('H:i:s',time()); if($percentage>0){ $uprice=$sprice-($sprice*$percentage/100); }elseif($unitPrice>0){ $percentage=(100*(($sprice*$qty)-($qty*$unitPrice)))/($sprice*$qty); $uprice=$sprice-($sprice*$percentage/100); } $discount=($sprice*$qty)-($uprice*$qty); $sno="";//getName($con,"select sno from sale where actid='$actid' and itemid='$itemid' and invno='$invno'"); if ($sno>0) { $qry="update sale set truckno='$truckno',batchno='$batchno',uprice='$uprice',percentage='$percentage',discount='$discount',qty=$qty,pprice=$pprice,sprice=$sprice where actid=$actid and itemid=$itemid and invno='$invno'"; }else{ $qry=getName($con,"select ifnull(max(sno),0)+1 from sale where invno='$invno' and LabID='".$_SESSION['LabID']."' "); $qry="insert into sale (batchno,truckno,sno,uprice,percentage,discount,date_,invno,actid,itemid,qty,pprice,sprice,LabID) values('$batchno','$truckno','$qry','$uprice',$percentage,$discount,'$date_',$invno,$actid,$itemid,$qty,$pprice,$sprice,'".$_SESSION['LabID']."')"; } //echo $qry; mysqli_query($con,$qry); $pur = getName($con,"select ifnull(sum(qty*uprice),0) from sale where invno=$invno and LabID='".$_SESSION['LabID']."'"); if (getName($con,"select 1 from sale2 where invno='$invno' and actid='$actid'")=="") $qry="insert into sale2 (time_,date_,invno,actid,amount,LabID) values('$time_','$date_',$invno,$actid,$pur,'".$_SESSION['LabID']."')"; else $qry="update sale2 set amount=$pur where actid=$actid and invno=$invno "; //echo $qry; mysqli_query($con,$qry); //$pur = getName($con,"select ifnull(sum(qty),0) from purchase where itemid=$itemid and LabID='".$_SESSION['LabID']."'"); //$sale = getName($con,"select ifnull(sum(qty),0) from sale where itemid=$itemid and LabID='".$_SESSION['LabID']."'"); //mysqli_query($con,"update item set qty=$pur-$sale,sprice='$sprice' where sprice<>'$sprice' and itemid='$itemid' and LabID='".$_SESSION['LabID']."' "); mysqli_query($con,"update item set sprice='$sprice' where sprice<>'$sprice' and itemid='$itemid' and LabID='".$_SESSION['LabID']."' "); /* if (getName($con,"select 1 from ledger where actid='$actid' and LabID='".$_SESSION['LabID']."' and saleno='$invno'")==""){ mysqli_query($con,"delete from ledger where actid='$actid' and saleno='$invno' and LabID='".$_SESSION['LabID']."'"); $autoid = getName($con,"select IFNULL(max(autoid),0)+1 from ledger "); mysqli_query($con,"insert into ledger (autoid,remarks,date_,saleno,actid,debit,credit,LabID) select '$autoid','sale #:$invno',date_,invno,actid,amount,paid,LabID from sale2 where invno='$invno' and LabID='".$_SESSION['LabID']."'"); }else{ mysqli_query($con,"update ledger set debit=(select sum(qty*uprice) from sale where invno='$invno' and LabID='".$_SESSION['LabID']."') where actid='$actid' and saleno='$invno' and LabID='".$_SESSION['LabID']."'"); calculateBalance($con,$actid); } */ updateQty($con,$itemid); }else { echo "

Sorry! Quantity Exceeded

"; } $i=1000; } //echo "
i=".$i; if($invno>0){ $date2=getName($con,"select date_ from sale2 where invno='$invno' and LabID='".$_SESSION['LabID']."' "); if($date2!="") $date_=date('Y-m-d',strtotime($date2)); } $company=getName($con,"select CONCAT(name,' (Balance=', balance,')') from accounts where id='$actid' and LabID='".$_SESSION['LabID']."'"); ?> <?php echo $company;?>
"; echo "
"; ?>
"; echo " "; echo " "; ?>
"; echo fillList($con,"select concat(itemid,' | ',itemname,' | ',model,' | ',size,' | ',itemcolor,' | ',company,' | ',qty) as itemname from item where qty>0 and LabID='".$_SESSION['LabID']."' order by itemname"); /* foreach($_SESSION['itemData'] as $rec){ if($rec[2]>0){ //qty>0 echo "
Name/Size/ModelPriceWeightDateBiltyNotrucknoAdd"; if ($anyvalue=="") $query = "select itemid,itemname,qty,uprice,sprice,model,size,company from item where LabID='".$_SESSION['LabID']."' and status=0 order by itemid desc limit 10"; else $query = "select itemid,itemname,qty,uprice,sprice,model,size,company from item where LabID='".$_SESSION['LabID']."' and status=0 and (itemname like '%$anyvalue%' or model like '%$anyvalue%' or size like '%$anyvalue%') order by itemname asc"; $cnt=1; $run = mysqli_query($con,$query); while ($row=mysqli_fetch_array($run)){ //$id = $row['itemid']; //$name = $row['itemname']; $stock = $row['qty']; $uprice = $row['uprice']; $size = $row['size']; if($row['model']!="") $size.="/".$row['model']; if($row['company']!="") $size.="/".$row['company']; echo "
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
".$row['itemname']."
$size"; if($_SESSION['LabID']==22) // hide pprice for Zabi echo "
$stock"; else echo ""; echo ""; //echo ""; echo ""; // bilty No. echo ""; echo ""; //echo ""; echo ""; //$cnt+=1; } echo "
"; //old history $query = "select s.*,i.itemname,i.size,i.model from sale s,item i where s.itemid=i.itemid and s.actid='$actid' and s.LabID='".$_SESSION['LabID']."' and (i.itemname like '%$anyvalue%' ) order by s.date_ desc,i.itemname asc limit 5"; //echo $query; echo "
"; echo "
Inv#Item NameqtyDatePriceuPriceBiltyNotruckno"; $run = mysqli_query($con,$query); while ($row=mysqli_fetch_array($run)){ $name = $row['itemname']; $stock = $row['qty']; $sprice = $row['sprice']; $uprice = $row['uprice']; $size = $row['size']; if($row['model']!="") $size.="/".$row['model']; echo "
".$row['invno']."$name $size$stock"; echo ""; echo "$sprice$uprice"; } echo "
"; //end history echo "
"; //panel body closed echo "
"; echo "
"; if($invno!="NEW"){ echo "
"; echo "
"; ?>
SALE INVOICE
#DateNamePriceQtyAmtBiltyNoTruckNoDelIMEI"; $query = "select s.date_,s.truckno,s.batchno,s.itemid,s.qty,s.uprice,s.invno,s.percentage,s.sno,i.itemname from sale s,item i where s.itemid=i.itemid and s.LabID='".$_SESSION['LabID']."' and s.actid=$actid and s.invno='$invno' order by s.sno desc"; $run = mysqli_query($con,$query); $cnt=1; while ($row=mysqli_fetch_array($run)){ $itemid = $row['itemid']; //$name = getName($con,"select itemname from item where itemid='$itemid' and LabID='".$_SESSION['LabID']."'"); //$qty = $row['qty']; //$uprice = $row['uprice']; $saleno = $row['invno']; //$amt=$row['uprice']*$row['qty']; echo ""; echo ""; echo ""; //echo "".$row['sno']."".$row['itemname']; echo "".$cnt; echo "".date('d.m.Y',strtotime($row['date_'])); echo "".$row['itemname']; echo ""; echo ""; echo "".$row['uprice']*$row['qty']; echo "".$row['batchno'].""; echo "".$row['truckno'].""; echo ""; echo ""; //echo "x"; //onClick=\"javascript:return confirm('are you sure you want to delete this?');\" $cnt+=1; } echo ""; echo "
"; if($invno!="NEW"){ $query = "select amount,discount,paid,receiverName,receiverCell,date_,actype,extracharges,paidextra,vehicleno,mileage from sale2 where LabID='".$_SESSION['LabID']."' and invno='$invno'"; $run = mysqli_query($con,$query); while ($row=mysqli_fetch_array($run)){ $amt = $row['amount']; $discount = $row['discount']; $net=$amt-$discount; $paid = $row['paid']; $receiverName = $row['receiverName']; $receiverCell = $row['receiverCell']; $date_ = date('Y-m-d',strtotime($row['date_'])); $actype = $row['actype']; $extracharges = $row['extracharges']; $paidextra = $row['paidextra']; $vehicleno = $row['vehicleno']; $mileage = $row['mileage']; } } if($paid>0) $balRed=""; else $balRed=$net; $profit=getName($con,"select IFNULL(sum(qty*uprice),0)-IFNULL(sum(qty*pprice),0) from sale where LabID='".$_SESSION['LabID']."' and invno='$invno' "); ?>
Inv No. Date: New Inv
Total Amount Tax
NetAmount Paid
Name Send whatsapp >
Vehicle No "; echo ""; echo ""; } ?> Paid To"; ?>
INVOICES
#DateInvAmountDiscNetPaidPrint"; $query = "select amount,invno,date_,discount,paid,transport from sale2 where LabID='".$_SESSION['LabID']."' and actid=$actid order by date_ desc,invno desc limit 10"; $cnt=1; $run = mysqli_query($con,$query); while ($row=mysqli_fetch_array($run)){ $saleno = $row['invno']; $date1 = date('d-m-Y',strtotime($row['date_'])); $paid = $row['paid']; $net=$row['amount']-$row['discount']; echo "$cnt$date1 $saleno".$row['amount']; echo "".$row['discount']."$net$paid"; echo ""; //$cnt+=1; } echo "
"; echo "
"; echo "
"; echo "
"; mysqli_close($con); //echo "

Admin Panel

"; ?>