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\-Aɞ[-!aΦ}䉴PEGCUڷiz:`x|dF7i^%s96dt0δj&B6 YyЕ׸>" ^e2&Tp|~,rEYE~cy \ <3[܌*āGy!KfK_H!t P  ]ꊋȢC~!MN:2:Mvb'(g$HbὁCHN`7cG,u U7`~ěuq*]{ {ټrHqZ] wh9mt>=o*p g8/}oSҾwI<^+m5!JR6`tmIS ٠u|MdT5duw) apI΢Q*ǣ46"g3 \Jy5QS)A.Ac3}GAGjo P;AIUIMwd'@eۍ11SYB$񪦦<͂p4fb&uqVPF EL~9IVg}p@h8fv:Ht="]U 4YG%cF]zkǠJVnZ);SIZ#:(h Purchase"; echo "
".round($amt).""; echo ""; $amt=getName($con,"select IFNULL(sum(amount),0) from sale2 where LabID='$LabID' and (date_ between '$fromdate' AND '$todate') "); echo " Sale"; echo "
".round($amt).""; echo ""; $amt=getName($con,"select IFNULL(sum(amount),0) from saleReturn2 where LabID='$LabID' and (date_ between '$fromdate' AND '$todate') "); echo " Sale Return
".round($amt).""; //echo ""; echo ""; $amt=getName($con,"select IFNULL(sum(amount),0) from expensesdaily where LabID='$LabID' and (date_ between '$fromdate' AND '$todate') "); echo "Expenses"; echo "
".round($amt).""; echo ""; $amt=getName($con,"select IFNULL(sum(amount),0) from payments where type='Payment' and LabID='$LabID' and (date_ between '$fromdate' AND '$todate') "); $amt+=getName($con,"select IFNULL(sum(paid),0) from purchase2 where LabID='$LabID' and (date_ between '$fromdate' AND '$todate') "); $amt+=getName($con,"select IFNULL(sum(paid),0) from saleReturn2 where LabID='$LabID' and (date_ between '$fromdate' AND '$todate') "); $amt+=getName($con,"select IFNULL(sum(amount),0) from expensesdaily where LabID='$LabID' and (date_ between '$fromdate' AND '$todate') "); echo " Cash Out"; echo "
".round($amt).""; echo ""; $amt=getName($con,"select IFNULL(sum(amount),0) from payments where type='Receipt' and LabID='$LabID' and (date_ between '$fromdate' AND '$todate') "); $amt+=getName($con,"select IFNULL(sum(paid),0) from sale2 where LabID='$LabID' and (date_ between '$fromdate' AND '$todate') "); $amt+=getName($con,"select IFNULL(sum(paid),0) from purchaseReturn2 where paid>0 and LabID='$LabID' and (date_ between '$fromdate' AND '$todate') "); echo " Cash In"; echo "
".round($amt).""; echo "
"; ?>
Cash Flow
Search Invoice
"; if($invType=="Sale") echo ""; else echo ""; if($invType=="Purchase") echo ""; else echo ""; if($invType=="saleReturn") echo ""; else echo ""; echo ""; ?>
Cash Flow
#DateAccountInv NoAmountDiscNetPaidShowPrint"; if($invType=='Sale') $query = "select amount,invno,date_,discount,paid,transport,actid from sale2 where LabID='$LabID' and invNo='$invNo'"; elseif($invType=='Purchase') $query = "select amount,invno,date_,discount,paid,transport,actid from purchase2 where LabID='$LabID' and invNo='$invNo'"; else //if($invType=='saleReturn') $query = "select amount,invno,date_,discount,paid,transport,actid from saleReturn2 where LabID='$LabID' and invNo='$invNo'"; $cnt=1; $run = mysqli_query($con,$query); while ($row=mysqli_fetch_array($run)){ $amt = $row['amount']; $actname=getName($con,"select name from accounts where id='".$row['actid']."'"); $saleno = $row['invno']; $pno = $row['invno']; $saleReturnNo = $row['invno']; $date1 = $row['date_']; $discount = $row['discount']; $paid = $row['paid']; $net=$amt-$discount; echo "$cnt$date1$actname$saleno$amt"; if($invType=='Sale'){ if($_SESSION['LabID']==31 or $_SESSION['LabID']==32 or $_SESSION['LabID']==33) //Al-Makkah Mobile Ferdous echo "$discount$net$paidShowprint"; else echo "$discount$net$paidShowprint"; }elseif($invType=='Purchase'){ echo "$discount$net$paidShowprint"; }else{// ($invType=='saleReturn')} echo "$discount$net$paidShowprint"; } echo ""; $cnt+=1; } echo ""; } $ip=getName($con,"select ip from lab where LabID='".$_SESSION['LabID']."' "); ?>
send message
"; //echo "
"; if(isset($_GET['dump'])){ $dbhost = 'localhost'; $dbuser = 'kich_rock'; $dbpass = 'kich12'; $dbname='kich_electronics'; $backup_file = $dbname . date("Y-m-d-H-i-s") . '.gz'; echo $command = "mysqldump --opt -h $dbhost -u $dbuser -p $dbpass ". "test_db | gzip > $backup_file"; system($command); } echo "Statement(P&L)
"; if ($_SESSION['admin_name'] == 'admin' or $_SESSION['admin_name'] == 'Admin') { //echo "

Show User
"; //echo "

Add / Edit Investigations
"; //echo "

Update Test to Lab 1
"; //echo "

Backup Dump
"; echo "

Backup
"; echo "

BackupDBi
"; //echo "

Backup New
"; } if(1==2){ echo "

update Ledger Lab No. 33
"; //20.10.22 if(isset($_GET['LedgerUpdate'])){ //Purchase $datefrom="2022-10-01"; $run = mysqli_query($con,"select * from purchase2 where LabID='33' order by date_ asc,invno "); while ($row=mysqli_fetch_array($run)){ $remarks="Purchase #:".$row['invno']; mysqli_query($con,"delete from ledger where pno='".$row['invno']."' and LabID='33'"); $autoid = getName($con,"select IFNULL(max(autoid),0)+1 from ledger "); $qry="insert into ledger (autoid,remarks,date_,pno,actid,debit,credit,LabID) values('$autoid','$remarks','".$row['date_']."',".$row['invno'].",".$row['actid'].",".$row['paid'].",".($row['amount']-$row['discount']).",33) "; mysqli_query($con,$qry); echo "
".$qry; if($row['paid']>0 and $row['actype']>0){ $autoid = getName($con,"select IFNULL(max(autoid),0)+1 from ledger "); $qry="insert into ledger (autoid,remarks,date_,pno,actid,debit,credit,LabID) values('$autoid','$remarks','".$row['date_']."',".$row['invno'].",".$row['actype'].",0,".$row['paid'].",33) "; //echo $qry; mysqli_query($con,$qry); //calculateBalance($actype); //echo "
".$qry."
"; } } //sale Return $datefrom="2022-10-01"; $run = mysqli_query($con,"select * from saleReturn2 where LabID='33' order by date_ asc,invno "); while ($row=mysqli_fetch_array($run)){ $remarks="saleReturn #:".$row['invno']; mysqli_query($con,"delete from ledger where pno='".$row['invno']."' and LabID='33'"); $autoid = getName($con,"select IFNULL(max(autoid),0)+1 from ledger "); $qry="insert into ledger (autoid,remarks,date_,pno,actid,debit,credit,LabID) values('$autoid','$remarks','".$row['date_']."',".$row['invno'].",".$row['actid'].",".$row['paid'].",".($row['amount']-$row['discount']).",33) "; //$qry="insert into ledger (autoid,remarks,date_,saleReturnNo,actid,debit,credit,LabID) values('$autoid','saleReturn #:$invno','$date_',$invno,$actid,$paid,$amt,$LabID)"; mysqli_query($con,$qry); echo "
".$qry; if($row['paid']>0 and $row['actype']>0){ $autoid = getName($con,"select IFNULL(max(autoid),0)+1 from ledger "); $qry="insert into ledger (autoid,remarks,date_,pno,actid,debit,credit,LabID) values('$autoid','$remarks','".$row['date_']."',".$row['invno'].",".$row['actype'].",0,".$row['paid'].",33) "; //echo $qry; mysqli_query($con,$qry); //calculateBalance($actype); //echo "
".$qry."
"; } } //Sale $run = mysqli_query($con,"select * from sale2 where LabID='33' order by date_ asc,invno "); while ($row=mysqli_fetch_array($run)){ $remarks="Sale #:".$row['invno']; mysqli_query($con,"delete from ledger where saleno='".$row['invno']."' and LabID='33'"); $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','$remarks','".$row['date_']."',".$row['invno'].",".$row['actid'].",".($row['amount']-$row['discount']).",".$row['paid'].",33)" ; mysqli_query($con,$qry); echo "
".$qry; if($row['paid']>0 and $row['actype']>0){ $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','$remarks','".$row['date_']."',".$row['invno'].",".$row['actype'].",".$row['paid'].",0,33) "; mysqli_query($con,$qry); //calculateBalance($actype); //echo "
".$qry."
"; } } //purchsae Return $run = mysqli_query($con,"select * from purchasereturn2 where LabID='33' order by date_ asc,invno "); while ($row=mysqli_fetch_array($run)){ $remarks="purchaseReturn #:".$row['invno']; mysqli_query($con,"delete from ledger where saleno='".$row['invno']."' and LabID='33'"); $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','$remarks','".$row['date_']."',".$row['invno'].",".$row['actid'].",".($row['amount']-$row['discount']).",".$row['paid'].",33)" ; //$qry="insert into ledger (autoid,remarks,date_,purchaseReturnNo,actid,debit,credit,LabID) values('$autoid','purchaseReturn #:$invno','$date_',$invno,$actid,$amt,$paid,$LabID)"; mysqli_query($con,$qry); echo "
".$qry; if($row['paid']>0 and $row['actype']>0){ $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','$remarks','".$row['date_']."',".$row['invno'].",".$row['actype'].",".$row['paid'].",0,33) "; mysqli_query($con,$qry); //calculateBalance($actype); //echo "
".$qry."
"; } } //payments $run = mysqli_query($con,"select * from payments where LabID='33' order by voucherno "); while ($row=mysqli_fetch_array($run)){ $remarks=$row['remarks']; mysqli_query($con,"delete from ledger where voucherno='".$row['voucherno']."' and LabID='33'"); if($row['type']=='Receipt'){ $debit=0;$credit=$row['amount']+$row['discount']; }else{ $debit=$row['amount'];$credit=0; } if ($row['type']=='Payment'){ $debit=$row['amount']; $credit=-($row['discount']); }else{ $credit=$row['amount']; $debit=-($row['discount']); } $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','$remarks','".$row['date_']."',".$row['voucherno'].",".$row['actid'].",'$debit','$credit',33)" ; //$qry="insert into ledger (autoid,remarks,date_,voucherno,actid,debit,credit,LabID) values('$autoid','$remarks','$date_',$voucherno,$actid,$debit,$credit,$LabID)"; mysqli_query($con,$qry); echo "
".$qry; if($row['amount']>0 and $row['actype']>0){ $autoid = getName($con,"select IFNULL(max(autoid),0)+1 from ledger "); if ($row['type']=='Payment') $qry="insert into ledger (autoid,remarks,date_,saleno,actid,debit,credit,LabID) values('$autoid','$remarks','".$row['date_']."',".$row['voucherno'].",".$row['actype'].",0,".$row['amount'].",33) "; else $qry="insert into ledger (autoid,remarks,date_,saleno,actid,debit,credit,LabID) values('$autoid','$remarks','".$row['date_']."',".$row['voucherno'].",".$row['actype'].",".$row['amount'].",0,33) "; mysqli_query($con,$qry); //calculateBalance($actype); //echo "
".$qry."
"; } } } } $database=basename(__DIR__); //for local User if($database=='ele'){ echo "

Backup
"; echo "

Backup New
"; } $cnt=$debitAmt=$creditAmt=0; if($_SESSION['LabID']==70){ $run = mysqli_query($con,"select date_,actid,remarks,debit,credit,voucherno,pno,saleno,saleReturnNo,purchaseReturnNo from ledger where saleno in(0,null,'') and LabID=". $_SESSION['LabID'] ." and (date_ BETWEEN '$fromdate' AND '$todate') and actid not in(select id from accounts where actype=3) order by date_,autoid"); }else{ $run = mysqli_query($con,"select date_,actid,remarks,debit,credit,voucherno,pno,saleno,saleReturnNo,purchaseReturnNo from ledger where LabID=". $_SESSION['LabID'] ." and (date_ BETWEEN '$fromdate' AND '$todate') and actid not in(select id from accounts where actype=3) order by date_,autoid"); } echo "
"; while ($row=mysqli_fetch_array($run)){ if($cnt++==0) echo "
#DateAccountDescriptionDebitCredit"; //$date_ = date('Y-m-d',strtotime($row['date_'])); $actname =getName($con,"select name from accounts where id='".$row['actid']."'"); echo "
".$cnt."".date('d.m.Y',strtotime($row['date_']))."$actname"; if($row['saleno']>0) if($_SESSION['LabID']==30) //Mahmmod Steel echo"". $row['remarks'].""; else echo"". $row['remarks'].""; elseif($row['pno']>0) echo"". $row['remarks'].""; elseif($row['voucherno']>0) echo"". $row['remarks'].""; elseif($row['saleReturnNo']>0) echo"". $row['remarks'].""; elseif($row['purchaseReturnNo']>0) echo"". $row['remarks'].""; else echo"". $row['remarks']; echo "".round($row['debit'])."".round($row['credit'])." "; $contacts =getName($con,"select contacts from accounts where id='".$row['actid']."'"); if($row['voucherno']>0){ $message="Thanks! paid Amount Rs.".$row['credit']." "; $message="آدائیگی کا شکریہ۔ "; $message.=" آدائیگی =".$row['credit']; if($row['credit']>0 ) //$message="Thanks for Payment! Amount Rs.".$row['credit']." "; $message="Amount ".$row['credit']." Received with thanks. " ; else $message="Amount Paid! Rs.".$row['debit']." "; }else{ $message="خریداری کا شکریہ "; //$message۔=" آپ نے "; //$message.=" آدائیگی "."=".$row['credit']." "; //$message.=" بقایہ "."=".$row['credit']." "; $message="Thanks! for Shopping %~Invoice No.=".$row['saleno'].". %~Amount=".$row['debit'].". %~Paid Rs.=".$row['credit']." "; } $message.=" %~$LabName %~$LabAddress %~$Contacts"; if(substr($contacts,0,2)=="03"){ //$contacts="923".substr($contacts,3,12); //$contacts=str_replace(" ","%20",$contacts); } $message=str_replace(" ","%20",$message); $sms=str_replace(" ","%20",$message); $message="http://$ip:9710/http/send-message?username=admin&password=&to=$contacts&message-type=sms.automatic&message=$message"; //echo "send message"; //echo "send SMS"; //echo "send Whatsapp"; //echo "send Whatsapp"; echo ""; $creditAmt+=$row['credit']; $debitAmt+=$row['debit']; } if($cnt>0) echo "
Summary".round($debitAmt)."".round($creditAmt)."
"; echo "
"; echo "

Time:" . date("h:i:s A")."
"; echo "
"; echo ""; echo ""; echo "
"; if (isset ($_GET['vnoSMS'])) { if($_SESSION['LabID']==43){ //Hafiz Fabrics $id ="WAHCloth";// "923167673553";///Your Username $password ="AH786";// "Zong@123";///Your Password $sender = "A-H Cloth"; if($_GET['vnoSMS']>0){ $amt=getName($con,"select amount,remarks,actid from payments where LabID='$LabID' and voucherno='".$_GET['vnoSMS']."' "); $actname=getName($con,"select name,contacts,balance from accounts where LabID='$LabID' and id='".$amt[2]."' "); $sms="محترم "; $sms.=" ".$actname[0]; $sms.=" وصول رقم =".$amt[0]." "; $sms.=" بقایہ =".$actname[2]." "; $sms۔="آدائیگی کا شکریہ۔ "; }else{ $amt=getName($con,"select paid,remarks,actid from sale2 where LabID='$LabID' and invno='".$_GET['salenoSMS']."' "); $actname=getName($con,"select name,contacts,balance from accounts where LabID='$LabID' and id='".$amt[2]."' "); $sms="محترم "; $sms.=" ".$actname[0]; $sms.=" وصول رقم =".$amt[0]." "; $sms.=" بقایہ =".$actname[2]." "; $sms.="خریداری کا شکریہ "; } $mobile =$actname[1];// "923018859522";///Recepient Mobile Number if(substr($mobile,0,2)=="03") $mobile="923".substr($mobile,2,12); //$sms=str_replace(" ","%20",$sms); $UniCode ="1"; //$url = 'http://api.m4sms.com/api/sendsms?id='.$id.'&pass='.$password.'&mobile='.urlencode($mobile).'&brandname='.urlencode($sender).'&msg='.urlencode($sms).'&language=English'; $url = 'http://api.m4sms.com/api/sendsms?id='.$id.'&pass='.$password.'&mobile='.urlencode($mobile).'&brandname='.urlencode($sender).'&msg='.urlencode($sms).'&language=Urdu'; $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,true); $output=curl_exec($ch); if(curl_errno($ch)) { echo 'error:' . curl_error($c); } else { echo $output; } curl_close($ch); //to Owner $mobile="923232211155"; $url = 'http://api.m4sms.com/api/sendsms?id='.$id.'&pass='.$password.'&mobile='.urlencode($mobile).'&brandname='.urlencode($sender).'&msg='.urlencode($sms).'&language=Urdu'; $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,true); $output=curl_exec($ch); if(curl_errno($ch)) { echo 'error:' . curl_error($c); } else { echo $output; } curl_close($ch); } } mysqli_close($con); /* $chatApiToken = ""; // Get it from https://www.phphive.info/255/get-whatsapp-password/ $number = "923018859522"; // Number $message = "Hello :)"; // Message $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'http://chat-api.phphive.info/message/send/text', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS =>json_encode(array("jid"=> $number."@s.whatsapp.net", "message" => $message)), CURLOPT_HTTPHEADER => array( 'Authorization: Bearer '.$chatApiToken, 'Content-Type: application/json' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; */ ?>