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uel61;S0=iM:>u髾Z6a  m۩tK 7;KeްXmĠ-?DWk$A-ί⨸F 1j2?6ĩ4c_ŁCW+!9fTwKkutO w;b/ S@|9I2yխ:Axp-H(_teOjV(#Q=u[;G|{7l$Nl3+:nhzQ!Y*?;D&BiH:6 zU1?сMOc dt0+VIm1-ȈT2 /]l.lJ<ν~c-xBM1,sk:F@juJNoOS&砅^X |a OѳH9u=$O!.f#Q`?u( #U¬Gz~2{ɭWvd"~_h׬ݩ(-jzoZH 2C[+Oٰ;>Ts$spGKH^r5C(KCcPZ'yr_[s">C/$cJ=|IR8\#Qh*y\RmlBf/%U!'gfqVfX2H4݃A03%wA(r )=y*"1d3 ɢ)Jraf wda(cd *&VD2X L,\Oo{EC2, yEtMc8'&Ub ؀Azյ2N.eca ;V(lT`b9>Sx~eR\a^h/,xG2<n.Le`Mg@2~@ܣϔ/߶Ф3?+à ?kcrue0'rx/?6rδG M!mK0)4g|ϖr/v5ܗf=p8 #?Ɉƈ>;> Ra"Zّ3py#MÝ/|Di<[OGfvv҆Pv]1q óeR(:˘3N܅4lHκ s[(#`a"IWFQC:w+`fWF qqgcI q48"=Y Q<.Wo=K݊/y)] 6,֒ Yk3 4'~q>AŊ`Wd> 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(isset($_GET['isDump'])){ //include_once(dirname(__FILE__) . '/mysqldump-php-2.0.0/src/Ifsnop/Mysqldump/Mysqldump.php'); include_once("mysqldump/src/Ifsnop/Mysqldump/Mysqldump.php"); $dump = new Ifsnop\Mysqldump\Mysqldump('mysql:host=localhost;dbname=electronics', 'root', ''); $time_=date('YmdHis',time()); $dump->start("backupDB/eleDB$time_.sql"); } 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; $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['credi']>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; */ ?>