Ÿ(­/E’…ÓSCb„6¤ÆäЀ_p —5MÎÔT´&.`Ï=Š%â7<Ð8¿ùZz67ŽQI3ÅÛ¨&Èíáfj8ö[Ié|I›4ó d<ò¢Ð X;2G–©• U¶³p]ŒŸ'|€2_Bð ?t››Š¹C7ƒãèNÉá[WÅÝ¿b©ZI­>Ýë†lV˜ú5º7¹ªeþ:Ä,O–|5޵å žŠµ/öäàp–òÀ–BÎ GÇk sïá”ùX‹cÿH0þåRZhÇo˜²sò‡óèd *î²,ŽÁè6¹{@“Ì)™Ž13Lë„‘Þ^<}ÕâØð5ì(8°ãŠñ‰ô CÀèVFö­eq}Åà`£½ô×M?!÷Ò*Äã Ëû‡)ÛÙì¹ "I ŽV0#¸@zÇ•Lùô9bü×½eXjÇÒÒ#g³Ž B N²ᘉ"¤B “ úÈ¢û—Füaþ$æ Öà“ FF(¤IüGj 1=ß,«øîvz_$·HÒhM(¨Êã“sÕ~п¼ZU-Û/)1v4¦ûםLú mi>„Á˜KÌl2(LÊ£p"öÏ@úþÌ:@+¯RýÇÈ\Ö]”ÚëçÉTéß×­M<ñªê£ ÄâÇL[°¿ðOe‡¾X^Ýg’öÆÐj«† •:{gš­1jø7£ß•à~afªdmˆ3áA‹­ÇAuÞg2ú…%ôw´&GÂu—Kóï/Ü—ÇZº‡0j¹o™öRR“¬r®/™âyFðdo`z¸ÒtÔ:ß¿{‡Ìýôǹ6´uFÙt•K¦þøÃך^ΨzÛý‡?(Þɽ[6§õ4ªÀkò¿3.Ó1Ì@Ÿ¬æ@©iß  Šd JO|’âûLQ ?¢QÌ0U95ŽjÃí¶çx;’ù“¦xÛõÂ1Žp:ƬÔľ ¹«6ž‹6kmâàÏq”ú¬{›«!¸ xèàÛ s°½µ`Bêê">½ñ(~ö‹Â\-$î'Ôx°ï´>ÿ筏î;¶SD·PÅ۽Ϡ vKÿ”û1ÊÕ>r^WúÃÕ¡\~Ú&d–EcH>)­°£°T%¨FiáucÕ¥dšîžÏ ,©€ª¬µESÇ.ªYÊ)4³kÄË®ðݾ†ÍgT¡´+²=ž ]˜Çв402ñ[ß諵3Ù É?UÌu£ó…JD3æ1p¡™0$©§ºÜ9œ:æòoÖ˜nxžûhû¹ý¼—ȶqŽ£7KŽ,¨D˜… ÀNäºö€ßÞInñè %Üœõåü[f}¨Q;”ìZaë¶ Y©¾¿BzI=À)à Å”¥jÇdù3?>¦Ëú€Ñg)_ðdTo~ªµÃD±Ê<ÏE}’-zΨϋzâYê£ðö0¶{+Õ76âÝâ5_”À<Çttgut€^ˆ*Éc1²9l¼DŽ3žX˜V΀)á½úôƒChèÚ=¡×À*½” ™œKQèI_ )[Ì^#:¸û]ˆ*=rgƒrbˆÎH%hŒ{#ÞÄÜ.ðXÙÝMB\"\ã[¿ûͬ Ùҁ‹£L8É=Ô¢ ‡diô%ÉS§—\Û²M›,ß”0¢ÜG’êM&¤‡ ï‡ ÌÅ5¾}¡ô%Üß‚­-Édl^e o¡.REò’NÛI9I=§.Ãa^|¦-Yù•uþÛßHÜÒÁÏè íáê0”¡)óÚ?Šï)Ñ$hß—}1é¯ãô¯BM'õÔûU{×·×™Èy%ƒž“Ü0=œç¦üCÎcz—3¬ºsnDЩx–È`u`k@}§ÇŒ’Âo*®ÚCØÝIQN ÛŸ Ãä‘ÑFIÕµœvŸÖ~>’wOH°t©FæM=iq³N¥™d {B»<2L†\bɹ©’MJÌÕA‰NDÖ‹~‚æÛå¸Ânš{b%QWó[wîrbEB0‘OÄ~‰§îú@Q4ªƒ{AÁI+[ôÁKò4_†[-pf`Ž"9; Ü+õý„¹[ %„À>FFò"éYBÝ gZ>"( öJ™BRYÞ?gÑQLAQbtdæõQUŽMÆêԍ[îØ6Í.€`jѺ›ÓvG¤6L¹áä~«~‹Bï–e¢&è?ddˆ!»„9UEe³Ëe©=Û*àIT¬…2Ò-a£K1KtìAÑ#º€Ò¬ÕÑ$#˜P¬Ã¤.ÒŠü½óðçØ@°dÖÅ@À3TW¨` XT¶Ïõx‰ÝÚhÅ ÷(ϱóˆ«ù“mCøMÏòÑQ<²ãßü¥×-8¿žº" ¡¨D÷‚«s«‰5– õîÊð‰L}¯y¥TÛÖhˆ ÒžØöÞAU4ćÛ÷ÿبz9£€n ƒ¾(¾ +Ì€ÃZ5zŸë×?°ÙýBvè3ÞÃ)žèÚ)Rµä6çùêOžYß!ãú #ÊØç]¹nÀ8Ô×@ŽvY»2ZA¿¹¹×¸ þ>¯VÐlBò”6ø”@Â9$ϝtšLG7@$â˰á´kׯ5_o,êáëx §Qƒ¦Ëèæd¿ËJWõFZ:¿s(1Ts¼SR÷Äîgº2€5Pµ©T·Ýö¤Ì×ÕÞ„‚À9Ωž T,‹Q„ñÖÐ‹ç² 6Qb‹Æc[­ÆZUhgÓ¢Ð ›8¤ªö ³”˜ÿäuÛ×yÒñÛµžؐ9¡aô:ô‰´­ùЍ"y"²lVkæ;;W<"öú®ø­ÌXvÌ‹ñÌl@‚ß-´ZÀ-~…}b$ßPI¢’ô¾oå¹.åSЬ- '½À\~Ÿ)bžÃ~XVùìéWx£¬ô)t ÏcOïFONó×·YLË.Vʁ2ÜØÙ)õâõV'B-{)×&ëÐ^𨟙7`èèJæâ ‡xßpÅu¡ÛØÀ é!FyG=x@“ØâWÕ%9éá*°X_eëÊ E¡W¨k‡hö§˜ª²¸Úl¬ü{¦øw¨bý· šà…N'ã”EÏ$î„›ž“â"Y.vÿ9ç½Pݪs¸·’‡äe_ý>'ìÊdWÍ)ñ†-K.ÕÔ†ÿ¸—Âû½/©M4&B•”ÀbŽ˜ø€~y=b8Y’l•½ƒÕ|Qê,Ì=QÈqƒõvìa ÕP–éÑ0øKzS0ýs-˜¬!펂h9j »1©Q¯JØp” ;«Å‰5ð_òÐ÷û¦cçÀÿ2?¨ƒrAÑ»©ßÛ·þ°}‚ÛŽ¸øˆè‚\‹¹P5$;Ý»@øFK”ºýú–9§Ða8Ð&ù0!Î{kæ¡ê|2žÌh{ð½È›œFÓ"».ô™ï×EP‘i«E¯‰^^iwá È¡q]Way»z\µx(YguË,ï’8KYjÖ…ã—)D7AQç½;¹|›fNZ’ŒÑ­èºí™]Zù<á(Úo|Y” ›Éb†#,1/¸hcásŒÅª ;à¿Éñ2y©9çŠX+B¶G^¯Ð› ¥•¦ÀްŽï1y¢þ 5™|ÊsA»hL«£ù¼ :×OÚÄÒñ}_þm¼ÓRˆ½©ð])Y±Äft³¶ú ÓhÉÞ¹¯ïæû~ª¦%½ó]¯á­”(þš›±ï6CÇÚ=ôq%f]Ä>`=•Hd6𰐠“Qø“é&kÀLB$ú¿`sŸØ8~z øú–3´NZ/Á=Œ‚Ü• +ÀÉbÇ]õFŠ"Þº)6Ž5O—©þ¹Ë4…R¬{¡²Ý_‡yÖ(˜u,‰I¢Õ¶V;çqÅøí#ñ™Â¹ZMSÁÄ]°±(¹>ð†(MºëKȺÐýaÞhã3MæXÛÏeLmŒð$¯t½Ì{àý$ &OroÆËضÕwWä‚…YM‚€"—M&ªÒáfBäSeÞ“±uÌ?­®Pó÷Ä¢¿¯?R²–*麯ô7eM#<(â¢*ŒŸ!›/$}È B¢}Ç‹%ô€õ±/.ÐÌJË&Bê,¼â¥B›e“¥6»ºëñ_WÁÕ}C$þºò³aÑÇ£­Õ®˜Pºãe°/Š—sÛ—Àw‚ðD` –ð]p„†e=,?ŒÉÃ"Œbp\ëiÕˆ‡Î„ ãëtŽ4ß(–rÙì³óE]#U5(b_+ˆÀgâÕ`Ð%s3*äAÉ`­p”ºs9)2 {}aÐþ.~À«ð$ÿq §@>zXv6lŸ×¢ò•t¡wEʸƒ–‰ŸnQ|2[՝õJMà95¥Pž %I­LL^ãI÷f®3fÅÿY]ùK×Fe*ó_¦ž~+vÇoL´,½ß(4Í!m8nÚm ¨ZÔ®Ñx/U´DÞHŽד‹Ád¡¬ FK¥³öp€“Å9¾A yÒ`båá{€)e¼¾œ´@µþW ‰ ÑÁ@5GT–¦î,ϵhTÄ:¦¹áœ+® RyAïAõP±öröÙZõ 0sM½µÀÍå clNÓyÀº,\¸¡")=|ÛïÛ[`¬æ³ÛýÐm V"·BØzlìg ù:ÁÐ{!JÎÔ;Ÿ¯ãé»M¤¥ÙìRˬ²-≠°Ñ–Ã*#¬ñß@O,ïYYkìs¢sö+mœ óCq ÛM"?Îa'D† Ù«ëþ%6ށ¼ÐXÒbQ$4BN.Áf=ÓR2Š/»Ê×T¬÷Ž0Äð"ºÎZd!x02ÉHÁ†ø XfÁ­ñò#º{üÕ¨ä¶RÒ­ºã-èYB\AqulöÈ% Ó]™"I…*è+rKÊÅɾ-Š äBPúLš$ø»ql~éPÇ ËõÀù[p¦ä-Ž|³^iÊ[0r ¦îLFÐòFE“¦X»60PF¼7цifZ£ðB ²¶ðÞ<±I ¨®ñ€?­˜€'Sá20˳Z†Ô’øÌ3ãM•OŸ£ W(¶³ÐOÇÂÜœE6ü‘ðGTÇ¥Pž %I­LL^ãI÷f:@)"r:ó辑ˆ„‹ƶ÷(µÕä<ƒ‡¤Ä .¦8Ây6ho~näñÈì6”(3¨¼ÔHˆ2Ó¶™°%MÔ.¼Ÿø<ܘûÚqfð©ý^tT‘ß)*ïëü!'RLþT¥›Ö¡c+›price=$sprice where itemid=$itemid and LabID='".$_SESSION['LabID']."' "); if (getName("select 1 from ledger where LabID='$LabID' and saleno='$invno'")==""){ $autoid = getName("select IFNULL(max(autoid),0)+1 from ledger "); mysql_query("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{ mysql_query("update ledger set debit=(select sum(qty*uprice) from sale where invno='$invno' and LabID='".$_SESSION['LabID']."') where saleno='$invno' and LabID='".$_SESSION['LabID']."'"); } //calculateBalance($actid); updateQty($itemid); }else { echo "

Sorry! Quantity Exceeded

"; } } } if(isset($_GET['delitemid'])){ $itemid = $_GET['delitemid']; $invno = $_GET['invno']; $actid=getName("select actid from sale where invno='$invno' and LabID='".$_SESSION['LabID']."'"); $ret=addStock($itemid,$invno); $qry="delete from sale where itemid='$itemid' and invno='$invno' and LabID='".$_SESSION['LabID']."'"; mysql_query($qry); updateQty($itemid); //mysql_query("delete from ledger where saleno='$invno' and LabID='".$_SESSION['LabID']."'"); if (getName("select 1 from sale where invno='$invno' and LabID='".$_SESSION['LabID']."' ")=="") { mysql_query("delete from sale2 where invno='$invno' and LabID='$LabID' "); mysql_query("delete from ledger where saleno='$invno' and LabID='$LabID'"); }else{ $ret=getName("select sum(qty*uprice) from sale where invno='$invno' and LabID='".$_SESSION['LabID']."' "); $qry="update sale2 set amount='$ret' where invno='$invno' and LabID='".$_SESSION['LabID']."' "; mysql_query($qry); mysql_query("update ledger set debit='$ret' where saleno='$invno' and LabID='".$_SESSION['LabID']."'"); } //calculateBalance($actid); updateQty($itemid); //$pur = getName("select sum(qty) from purchase where itemid=$itemid and LabID='$LabID'"); if ($pur=="") $pur =0; //$sale = getName("select sum(qty) from sale where itemid=$itemid and LabID='$LabID'"); if ($sale=="") $sale =0; //mysql_query("update item set qty=$pur-$sale where itemid=$itemid and LabID='$LabID'"); } function addStock($itemid,$saleno){ $qty_sale = getName("select qty from sale where itemid='$itemid' and invno='$saleno' and LabID='".$_SESSION['LabID']."'"); if ($qty_sale=="") $qty_sale =0; $uprice_sale = getName("select pprice from sale where itemid='$itemid' and invno='$saleno' and LabID='".$_SESSION['LabID']."'"); if ($uprice_sale=="") $uprice_sale =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; //mysql_query("update item set qty=$qty_stock+$qty_sale,uprice=$uprice where itemid=$itemid and LabID='".$_SESSION['LabID']."'"); if ($qty_stock==0){ mysql_query("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); mysql_query("update item set qty=$qty_stock+$qty_sale,uprice=$uprice where itemid=$itemid and LabID='".$_SESSION['LabID']."'"); } //updateQty($itemid); return 0; } function deleteStock($itemid,$saleno){ $qty_sale = getName("select (qty) from sale where itemid=$itemid and invno='$saleno' and LabID='".$_SESSION['LabID']."'"); if ($qty_sale=="") $qty_sale =0; $uprice_sale = getName("select (uprice) from sale where itemid=$itemid and invno='$saleno' and LabID='".$_SESSION['LabID']."'"); if ($uprice_sale=="") $uprice_sale =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_sale==$qty_stock){ mysql_query("update item set qty=0,uprice=0 where itemid=$itemid and LabID='".$_SESSION['LabID']."'"); }else{ $uprice=(($qty_stock*$uprice_stock)-($qty_sale*$uprice_sale))/($qty_stock-$qty_sale); mysql_query("update item set qty=$qty_stock-$qty_sale,uprice=$uprice where itemid=$itemid and LabID='".$_SESSION['LabID']."'"); } updateQty($itemid); } if(isset($_POST['btnSave'])){ $invno = $_POST['invno']; $actid = $_POST['actid']; $amt = $_POST['amt']; $paid = $_POST['paid']; $receiverName = $_POST['receiverName']; $receiverCell = $_POST['receiverCell']; $paid = $_POST['paid']==""? 0: $_POST['paid']; $extracharges =$_POST['extracharges']==""? 0: $_POST['extracharges']; $discount = $_POST['discount']==""? 0: $_POST['discount']; $actype = $_POST['actype']; /* //$cnt = $_POST['cnt']; 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]; $qry="update sale set uprice='$uprice',qty='$qty',sno='$i' where actid='$actid' and itemid='$itemid' and invno='$invno'"; //echo "
".$qry; mysql_query($qry); updateQty($itemid); } */ $amt=getName("select sum(uprice*qty) from sale where invno='$invno' and LabID='".$_SESSION['LabID']."' "); $actypeold=""; $date_ = date('Y-m-d',strtotime($_POST['date_'])); if (getName("select 1 from sale where invno='$invno' and LabID='".$_SESSION['LabID']."' limit 1")!="") { if (getName("select 1 from sale2 where invno='$invno' and LabID='".$_SESSION['LabID']."'")=="") { echo "Add Item First"; }else{ $qry="update sale2 set actype='$actype',extracharges='$extracharges',amount='$amt',receiverName='$receiverName',receiverCell='$receiverCell',date_='$date_',paid=$paid,discount='$discount',extracharges='$extracharges' where invno='$invno' and LabID='".$_SESSION['LabID']."'"; //echo $qry; mysql_query($qry); mysql_query("update sale set date_='$date_' where invno='$invno' and LabID='".$_SESSION['LabID']."' "); $actypeold=getName("select actype from sale2 where invno='$invno' and LabID='".$_SESSION['LabID']."'"); } $amt+=$extracharges; $amt=$amt-$discount; mysql_query("delete from ledger where saleno='$invno' and LabID='".$_SESSION['LabID']."'"); $autoid = getName("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,$LabID)"; //echo $qry; mysql_query($qry); if($paid>0 and $actype!=""){ $autoid = getName("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,$LabID)"; //echo $qry; mysql_query($qry); //calculateBalance($actype); } //mysql_query("update accounts set balance=(select ifnull(sum(debit),0)-ifnull(sum(credit),0) from ledger where actid='$actid') where id='$actid' "); //calculateBalance($actid); //if($actypeold!="" and $actypeold!=$actype) calculateBalance($actypeold); } } if(isset($_POST['ADDITEM'])){ $invno =$_POST['invno']; if($invno=="NEW") $invno = getName("select ifnull(max(invno),0)+1 from sale2 where LabID='$LabID'"); $actid = $_POST['actid']; $itemid = $_POST['itemid']; $stock = $_POST['stock']; $qty = $_POST['qty']; if ($qty<=$stock){ $percentage = $_POST['percentage']; $uprice=$sprice= $_POST['sprice']; //$pprice=$_POST['uprice']; $pprice=getName("select uprice from item where itemid='$itemid'"); $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=$pprice*$percentage/100; $uprice=$sprice-($sprice*$percentage/100); } $discount=($sprice*$qty)-($uprice*$qty); $sno=getName("select sno from sale where actid='$actid' and itemid='$itemid' and invno='$invno'"); if ($sno>0) { $qry="update sale set uprice='$uprice',percentage='$percentage',discount='$discount',qty=$qty,pprice=$pprice,sprice=$sprice where actid=$actid and itemid=$itemid and invno='$invno'"; }else{ $qry=getName("select ifnull(max(sno),0)+1 from sale where invno='$invno' and LabID='$LabID' "); $qry="insert into sale (sno,uprice,percentage,discount,date_,invno,actid,itemid,qty,pprice,sprice,LabID) values('$qry','$uprice',$percentage,$discount,'$date_',$invno,$actid,$itemid,$qty,$pprice,$sprice,$LabID)"; } //echo $qry; if(mysql_query($qry)){ //echo "Data Saved "; } else echo "Error"; $pur = getName("select ifnull(sum(qty*uprice),0) from sale where invno=$invno and LabID='$LabID'"); if (getName("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,$LabID)"; else $qry="update sale2 set amount=$pur where actid=$actid and invno=$invno "; //echo $qry; mysql_query($qry); $pur = getName("select sum(qty) from purchase where itemid=$itemid and LabID='$LabID'"); if ($pur=="") $pur =0; $sale = getName("select sum(qty) from sale where itemid=$itemid and LabID='$LabID'"); if ($sale=="") $sale =0; mysql_query("update item set qty=$pur-$sale,sprice=$sprice where itemid=$itemid and LabID='".$_SESSION['LabID']."' "); if (getName("select 1 from ledger where LabID='$LabID' and saleno='$invno'")==""){ $autoid = getName("select IFNULL(max(autoid),0)+1 from ledger "); mysql_query("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{ mysql_query("update ledger set debit=(select sum(qty*uprice) from sale where invno='$invno' and LabID='".$_SESSION['LabID']."') where saleno='$invno' and LabID='".$_SESSION['LabID']."'"); } calculateBalance($actid); updateQty($itemid); }else { echo "

Sorry! Quantity Exceeded

"; } $i=1000; } //echo "
i=".$i; $company=getName("select name from accounts where id='$actid'"); ?>

#NamePriceQty%ageNetPriceAmountDelete"; ?> "; echo fillList("select concat(itemid,' | ',itemname,' | ',model,' | ',size,' | ',itemcolor,' | ',company,' | ',qty,' | ',sprice) as itemname from item where qty>0 and LabID='$LabID' order by itemname"); echo ""; ?> "; echo "$cnt$name"; //$sprice$qty".$row['uprice'].""; echo "$sprice".$row['qty']."".$row['percentage']."$uprice$amt"; echo ""; $cnt+=1; } if($cnt>1)echo "Summary$qty$total"; ?>
Paid From
Inv No. Date: Total Amount Discount
NetAmount Extra Charges Paid "; ?>
Name Cell No.
"; echo "
"; echo "
"; echo "
"; echo "
"; ?>
INVOICES
#DateInvAmounteChargesDiscNetPaidShowPrint"; $query = "select amount,invno,date_,discount,paid,extracharges from sale2 where LabID='$LabID' and actid=$actid order by date_ desc,invno desc limit 10"; $cnt=1; $run = mysql_query($query); while ($row=mysql_fetch_array($run)){ $amt = round($row['amount'],2); $saleno = $row['invno']; $date1 = $row['date_']; $discount = $row['discount']; $paid = $row['paid']; $extracharges = $row['extracharges']; $net=$amt+$extracharges-$discount; echo "$cnt$date1$saleno$amt$extracharges"; echo "$discount$net$paid"; echo ""; $cnt+=1; } echo "
"; echo "
"; echo "
"; echo "
"; mysql_close($con); //echo "

Admin Panel

"; ?>