" . mysqli_error($conn);
}
$sql="delete from tbl_proc_po";
echo $sql;
if (mysqli_query($conn, $sql)) {
echo "New record created successfully";
//} else {
// echo "Error: " . $sql . "
" . mysqli_error($conn);
}
$sql="delete from tbl_proc_indent_detail";
if (mysqli_query($conn, $sql)) {
echo "New record created successfully";
//} else {
// echo "Error: " . $sql . "
" . mysqli_error($conn);
}
$sql="delete from tbl_proc_indent";
if (mysqli_query($conn, $sql)) {
echo "New record created successfully";
//} else {
// echo "Error: " . $sql . "
" . mysqli_error($conn);
}
*/
/* Indent Hdr
$sql="select sih.*,sitm.indent_type_id from scm_indent_hdr sih , scm_indent_type_master sitm where sih.indent_type =sitm.indent_type_code
and (sih.company_id=1 or sih.company_id=2) and indent_type<>'J' order by hdrid desc ";
$resulta = $conn->query($sql);
while($rowa = $resulta->fetch_assoc())
{
$cmpn=$rowa["company_id"];
$sql="INSERT INTO tbl_proc_indent ( indent_id,approved_by,approved_date,fy,indent_date,indent_squence_no,internal_remarks,is_active,record_type
,remarks,total_value,branch,category,company,project,created_by,created_date,indent_status) VALUES
(".$rowa["hdrid"].",'26586','".$rowa["indent_date"]."',".$rowa["fin_year"].",'".$rowa["indent_date"]."','".$rowa["indent_no"]."','".$rowa["internal_note"].
"',".$rowa["is_active"].",'INDENT','".$rowa["remarks"]."',0,".$rowa["branch_id"].",".$rowa["indent_type_id"].",".$rowa["company_id"].","
.$rowa["project_id"].",'26586','".$rowa["auto_datetime_insert"]."',".$rowa["indent_status"].")";
echo $sql;
if (mysqli_query($conn, $sql)) {
echo "New record created successfully";
//} else {
// echo "Error: " . $sql . "
" . mysqli_error($conn);
}
}
*/
/*
$sql1="
select njmcode from (
select s1.supp_code njmcode ,s2.supp_code empcode from
(
select concat(group_code,item_code) supp_code from itemmaster where company_id =1 and group_code <>'999'
) s1
left join
(
select concat(group_code,item_code) supp_code from itemmaster where company_id =2 and group_code <>'999'
) s2
on s1.supp_code=s2.supp_code
) dd where empcode IS NULL ORDER by njmcode
";
$resulta = $conn->query($sql1);
while($rowa = $resulta->fetch_assoc())
{
$sql1="update suppliermaster set status=60 where supp_code ='".$rowa["njmcode"]."'";
$sql1="update itemmaster set issuable_tag =NULL where concat(group_code,item_code) ='".$rowa["njmcode"]."' and company_id =1";
if (mysqli_query($conn, $sql1)) {
echo "New record created successfully";
//} else {
// echo "Error: " . $sql . "
" . mysqli_error($conn);
}
}
*/
/* indent detail
$sql="delete from tbl_proc_indent_detail";
if (mysqli_query($conn, $sql)) {
echo "New record created successfully";
//} else {
// echo "Error: " . $sql . "
" . mysqli_error($conn);
}
$sql="select a.*,md1.rec_id from (
select sili.*,ifnull(sili.rate,0) rate1, tpi.indent_id,i.item_id,tpi.indent_status,tpi.indent_squence_no,dept_desc,ifnull(po_placed,0) qtypo
from scm_indent_line_item sili,tbl_proc_indent tpi ,itemmaster i, master_department md
where sili.indent_no = tpi.indent_squence_no and sili.group_code =i.group_code and sili.company_id =tpi.company and sili.fin_year =tpi.fy
and sili.item_code= i.item_code and IFNULL(i.issuable_tag,'Ý')<>'N' and (tpi.company =1 or tpi.company =2) and sili.group_code<>'999'
and sili.dept_code =md.mdept_id and sili.company_id =md.company_id
order by sili.indent_srl_no DESC
) a,master_department md1 where a.dept_desc=md1.dept_desc and IFNULL(md1.created_by,'Y')<>'N' AND (md1.company_id =2 or md1.company_id=1 )
order by indent_srl_no ";
echo $sql;
$resulta = $conn->query($sql);
while($rowa = $resulta->fetch_assoc())
{
$sql1="INSERT INTO tbl_proc_indent_detail (indent_detail_id,is_active, qoh_branch, qoh_company, qoh_project, qty, qty_po, rate, remarks, uom_code,
department, indent, item, indent_status,rate_source) VALUES (".
$rowa["indent_srl_no"].",".$rowa["is_active"].",0, 0, 0,".$rowa["indent_qty"].",".$rowa["qtypo"].",".$rowa["rate1"].",'".$rowa["remark"]."','".$rowa["uom_code"].
"',".$rowa["rec_id"].",".$rowa["indent_id"].",".$rowa["item_id"].",".$rowa["indent_status"].",1)";
//"1, 0, 0, 0, 350, 36, 0, '', 'KGS', 19, 45, 5514, 3);
echo $sql1;
if (mysqli_query($conn, $sql1)) {
echo "New record created successfully";
//} else {
// echo "Error: " . $sql . "
" . mysqli_error($conn);
}
}
*/
/* po hdr
$sql="delete from tbl_proc_po";
echo $sql;
if (mysqli_query($conn, $sql)) {
echo "New record created successfully";
//} else {
// echo "Error: " . $sql . "
" . mysqli_error($conn);
}
$nnn=1;
$sql="
select hdr_id,a.company_id,IFNULL(credit_term,' ') credit_term,IFNULL(delivery_addr,' ') delivery_addr, IFNULL(delivery_timeline,0) delivery_timeline,
IFNULL(discount,0) discount,expected_date,fin_year,footer_note,IFNULL(frieght_charge,0) frieght_charge,po_num,IFNULL( indent_no,' ') indent_no,
po_date,IFNULL(remarks,' ') remarks,po_status,supp_code,tax,tax_type,po_type,po_val_wt_tax,po_val_wo_tax,weight,branch_id,project_id,
IFNULL(internal_note,' ') internal_note, src1,supp_id,ifnull(hdrid,'NULL') hdrid,sitm.indent_type_id,
case
when tax_type=1 then 'IGST'
when tax_type=2 then 'CGST & SGST'
else 'NO TAX'
end taxname
from
(
select a.*,hdrid from (
select sph.*,case WHEN with_or_without=1 then 'WITHINDENT' ELSE 'WITHOUTINDENT' END src1,supp_id
from scm_po_hdr sph,suppliermaster s where indent_type_id <>'J'
and sph.supp_code =s.supp_code and ( s.status=60 or s.status=90)
) a left JOIN
( select hdrid,indent_no,company_id,sih.fin_year from scm_indent_hdr sih
) b on a.indent_no=b.indent_no and a.company_id=b.company_id and a.fin_year=b.fin_year order by a.hdr_id
) a,scm_indent_type_master sitm where sitm.indent_type_code=a.po_type order by hdr_id desc
";
$resulta = $conn->query($sql);
while($rowa = $resulta->fetch_assoc())
{
$sql1="INSERT INTO tbl_proc_po (po_id,created_by,terms_nconditions,discount_value,expected_delivery_date,footer_notes,
freight_charges,po_date,po_approve_date,po_sequence_no,remarks,
source,branch,company,project,supplier,tax_type,tax_payable,delivery_timeline,status,
category,total_amount,
net_amount,tax_type_name,advance_type,advance_percentage,advance_amount,credit_days,indent) VALUES (".
$rowa["hdr_id"].",25686,'".$rowa["credit_term"]."',".$rowa["discount"].",'".$rowa["expected_date"]."','".$rowa["footer_note"]."',".$rowa["frieght_charge"].",'".
$rowa["po_date"]."','".$rowa["po_date"]."','".$rowa["po_num"]."','".
$rowa["delivery_timeline"]."','".$rowa["src1"]."',".
$rowa["branch_id"].",".$rowa["company_id"].",".$rowa["project_id"].",".$rowa["supp_id"].",".$rowa["tax_type"].",1,0,".
$rowa["po_status"].",".$rowa["indent_type_id"].",".$rowa["po_val_wt_tax"].",".$rowa["po_val_wo_tax"].",'".$rowa["taxname"]."',0,0,0,0,".$rowa["hdrid"]." )";
echo $sql1;
if (mysqli_query($conn, $sql1)) {
echo "New record created successfully";
//} else {
// echo "Error: " . $sql . "
" . mysqli_error($conn);
}
echo "Line No".$nnn;
$nnn++;
}
*/
/*
$sql="delete from tbl_proc_po_detail";
echo $sql;
if (mysqli_query($conn, $sql)) {
echo "New record created successfully";
//} else {
// echo "Error: " . $sql . "
" . mysqli_error($conn);
}
$sql="select a.*,md1.rec_id,tm.tax_id taxid from (
select hdr_id,sph.po_num ,spli.line_item_num ,spli.c_tax,spli.tax_percentage,description ,spli.discount ,
spli.i_tax ,spli.quantity ,spli.gate_po_placed ,rate ,IFNULL( spli.cancel_qty,0) cancel_qty,
ifnull(last_purchase_rate,0) last_purchase_rate ,last_purchase_date ,last_purchase_supp ,
spli.is_active ,ifnull(status,1) status ,spli.s_tax ,md.dept_desc ,
spli.group_code ,spli.item_code ,i.hsn_code,uom ,spli.company_id ,i.item_id ,department_id, spli.tax_id ,tm2.tax_name
, Case when spli.indent_no=0 then 'NULL'
else spli.indent_no end indent_no
from scm_po_line_item spli ,scm_po_hdr sph,itemmaster i ,master_department md,tax_master tm2
where sph.po_num =spli.po_num and sph.indent_type_id <>'J'
and spli.item_code= i.item_code and spli.group_code =i.group_code and IFNULL(i.issuable_tag,'Ý')<>'N'
and spli.department_id =md.mdept_id and sph.company_id =md.company_id and spli.tax_id =tm2.tax_id
) a,master_department md1,tax_master tm where a.dept_desc=md1.dept_desc and IFNULL(md1.created_by,'Y')<>'N'
and a.tax_name=tm.tax_name and IFNULL( tm.created_by,1)<>0
order by line_item_num desc
";
echo $sql;
$resulta = $conn->query($sql);
while($rowa = $resulta->fetch_assoc())
{
$sql1="INSERT INTO tbl_proc_po_detail (po_detail_id,cancelled_qty,ctax_percentage,
discount_mode,discount_percentage,i_tax_percentage,qty,qty_recvd,rate,
rate_lastpurchase,is_active,status,
stax_percentage,department,indent_detail,item,po,hsn_code,tax,uom_code)
values (".$rowa["line_item_num"].",".$rowa["cancel_qty"].",".$rowa["c_tax"].",1,0,".$rowa["i_tax"].",".$rowa["quantity"].",".$rowa["gate_po_placed"].",".
$rowa["rate"].",".$rowa["last_purchase_rate"].",".$rowa["is_active"].",".$rowa["status"].",".$rowa["s_tax"].",".$rowa["rec_id"].",".$rowa["indent_no"].",".$rowa["item_id"].
",".$rowa["hdr_id"].",'".$rowa["hsn_code"]."',".$rowa["taxid"].",'".$rowa["uom"]."')";
echo $sql1;
if (mysqli_query($conn, $sql1)) {
echo "New record created successfully";
//} else {
// echo "Error: " . $sql . "
" . mysqli_error($conn);
}
$sql2="INSERT INTO tbl_proc_po_detail (po_detail_id,cancelled_qty,ctax_percentage,
description,discount_mode,discount_percentage,i_tax_percentage,qty,qty_recvd,rate,
rate_lastpurchase,is_active,status,
stax_percentage,department,indent_detail,item,po,hsn_code,tax,uom_code)
values ( ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
//$sql2="INSERT INTO tbl_proc_po_detail (po_detail_id,cancelled_qty,ctax_percentage,description) values ( ?,?,?,?)";
$a1=$rowa["line_item_num"];
$a2=$rowa["cancel_qty"];
$a3=$rowa["c_tax"];
$a4=$rowa["description"];
$a5=1;
$a6=0;
$a7=$rowa["i_tax"];
$a8=$rowa["quantity"];
$a9=$rowa["gate_po_placed"];
$a10=$rowa["rate"];
$a11=$rowa["last_purchase_rate"];
$a12=$rowa["is_active"];
$a13=$rowa["status"];
$a14=$rowa["s_tax"];
$a15=$rowa["rec_id"];
$a16=$rowa["indent_no"];
//$a16=0;
$a17=$rowa["item_id"];
$a18=$rowa["hdr_id"];
$a19=$rowa["hsn_code"];
$a20=$rowa["taxid"];
$a21=$rowa["uom"];
echo $a16;
$ab='$a1';
$b=1;
$x = 2;
while($x <= 21) {
$b='$a'.$x;
$ab=$ab.",".$b;
$x++;
}
//echo "ab = ". $ab;
$sql2="INSERT INTO tbl_proc_po_detail (po_detail_id,cancelled_qty,ctax_percentage,description,discount_mode,discount_percentage,i_tax_percentage,qty,qty_recvd
,rate,rate_lastpurchase,is_active,status,stax_percentage,department,indent_detail,item,po,hsn_code,tax,uom_code)
values ( ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
//,discount_percentage,i_tax_percentage,qty,qty_recvd,rate,
//rate_lastpurchase,is_active,status,
//stax_percentage,department,indent_detail,item,po,hsn_code,tax,uom_code)
//,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?
/*
$stmt = $conn->prepare($sql2);
//$stmt->bind_param('sssss', $a1,$a2,$a3,$a4,$a5,$a6,$a7,$a8,$a9,$a10,$a11,$a12,$a13,$a14,$a15,$a16,$a17,$a18,$a19,$a20,$a20,$a21);
$stmt->bind_param('sssssssssssssssisssss', $a1,$a2,$a3,$a4,$a5,$a6,$a7,$a8,$a9,$a10,$a11,$a12,$a13,$a14,$a15,$a16,$a17,$a18,$a19,$a20,$a21);
//$stmt->bind_param('sssssssssssssssisssss',".$ab.")";
$stmt->execute();
//);
echo $sql2;
}
*/
/*
$sql="delete from tbl_proc_inward_detail";
echo $sql;
if (mysqli_query($conn, $sql)) {
echo "New record created successfully";
//} else {
// echo "Error: " . $sql . "
" . mysqli_error($conn);
}
$sql="delete from tbl_proc_inward";
echo $sql;
if (mysqli_query($conn, $sql)) {
echo "New record created successfully";
//} else {
// echo "Error: " . $sql . "
" . mysqli_error($conn);
}
$n=1;
$sql="SELECT a.*,ifnull(po_id,'NULL') po_id FROM (
select store_receive_no,concat(cm.sr_prefix,'/',bm.branch_name,'/',ay.string_label,'/' ) inwardseqno,
ssh.gate_entry_no,
gserh.in_date, case when length(ifnull(gserh.po_no,' '))=0 then 'WITHOUTPO' else 'WITHPO' end psource,'GRN' rectype,ssh.remarks,
ssh.challan_no ,ifnull(ssh.challan_date,'2022-04-01') challan_date ,ssh.store_receive_dt ,s.supp_id ,ssh.company_id ,
ssh.branch_id ,ssh.project_id ,ifnull(ssh.internal_note,'NULL') internal_note ,gserh.inspec_check ,ssh.sr_good_recept_status ,ssh.tax_type ,
ssh.store_print_no ,ssh.store_receipt_no ,
case
when ssh.tax_type=1 then 'IGST'
when ssh.tax_type=2 then 'CGST & SGST'
else 'NO TAX'
end taxname ,gserh.po_no,ssh.vehicle_no ,tcs_percentage,tcs_amount,round_off
from scm_sr_hdr ssh ,company_master cm ,academic_years ay ,branch_master bm ,gate_store_entry_reg_hdr gserh ,suppliermaster s
where ssh.company_id =cm.comp_id and ssh.ac_year =ay.year and ssh.company_id =ay.company_id and ssh.branch_id =bm.branch_id
and ssh.gate_entry_no =gserh.hdr_id and ssh.store_receive_no<=11276
and ssh.supp_code =s.supp_code and ( s.status=60 or s.status=90)
union all
SELECT store_receive_no,concat(cm.sr_prefix,'/',bm.branch_name,'/',ay.string_label,'/',ssh.store_receive_no ) inwardseqno,
'NULL' gate_entry_no,
store_receive_dt in_date,'WITHOUTPO' psource,'GRN' rectype ,remarks,challan_no,ifnull(ssh.challan_date,'2022-04-01') challan_date,ssh.store_receive_dt,
'NULL' supp_id,
ssh.company_id,ssh.branch_id,project_id,'OP.Stock' internal_note,'Y' inspec_check,sr_good_recept_status ,4 tax_type,
store_print_no,store_receipt_no,'NO TAX','NULL' po_no,vehicle_no,tcs_percentage,tcs_amount,round_off FROM
scm_sr_hdr ssh ,company_master cm ,academic_years ay ,branch_master bm
where ssh.company_id =cm.comp_id and ssh.ac_year =ay.year and ssh.company_id =ay.company_id and ssh.branch_id =bm.branch_id
AND store_receive_no IN (3391,3595,7407,9178)
) a
LEFT JOIN
tbl_proc_po tpp on a.po_no=tpp.po_sequence_no
ORDER BY store_receive_no ";
echo $sql;
$resulta = $conn->query($sql);
while($rowa = $resulta->fetch_assoc())
{
$g=sprintf("%06s", $n);
$inwseq=$rowa["inwardseqno"].$g;
$sql1="INSERT INTO tbl_proc_inward (inward_id,inward_sequence_no,vehicle_number,inward_date,
source,record_type,receipts_remarks,
challanno,challanno_date,store_receipt_no,store_receipt_date,
tcs_percentage,tcs_amount,round_off_value,po,supplier,status,company,branch,project,
store_receipt_actual_date,internal_note,
inspection_check,sr_status,tax_type,tax_type_desc) VALUES (".
$rowa["store_receive_no"].",'".$inwseq."','".$rowa["vehicle_no"]."','".$rowa["in_date"]."','".$rowa["psource"]."','".$rowa["rectype"]."','".$rowa["remarks"].
"','".$rowa["challan_no"]."','".$rowa["challan_date"]."','".$rowa["store_print_no"].
"','".$rowa["store_receive_dt"]."',".
$rowa["tcs_percentage"].",".$rowa["tcs_amount"].
",".$rowa["round_off"].",".$rowa["po_id"].",".$rowa["supp_id"].",".$rowa["sr_good_recept_status"].",".$rowa["company_id"].",".$rowa["branch_id"].",".$rowa["project_id"].
",'".$rowa["store_receive_dt"]."','".$rowa["internal_note"]."','".$rowa["inspec_check"]."',".$rowa["sr_good_recept_status"].",".$rowa["tax_type"].",'".$rowa["taxname"]."')";
echo $sql1;
if (mysqli_query($conn, $sql1)) {
echo "New record created successfully";
//} else {
// echo "Error: " . $sql . "
" . mysqli_error($conn);
}
$n++;
}
*/
/* gate entry will taken which are not inspected */
$sql="delete from tbl_proc_material_inventory";
echo $sql;
if (mysqli_query($conn, $sql)) {
echo "New record created successfully";
//} else {
// echo "Error: " . $sql . "
" . mysqli_error($conn);
}
$sql="delete from tbl_proc_inward_detail";
echo $sql;
if (mysqli_query($conn, $sql)) {
echo "New record created successfully";
//} else {
// echo "Error: " . $sql . "
" . mysqli_error($conn);
}
$n=1;
$sql="select p.*,ifnull(q.tax_id,'NULL') taxid FROM (
select k.*,ifnull(l.po_line_no,'NULL') po_line_no,ifnull(pohdrid,'NULL') pohdrid from (
select g.*,ifnull(md1.rec_id,'NULL') rec_id from (
select a.*,md.dept_desc FROM (
select store_line_item_no ,actual_quantity ,ssli.uom_code,final_qty ,dr_qty,item_desc,ssli.is_active,item_id,ifnull(c_tax,0) c_tax,
ifnull(s_tax,0) s_tax ,ifnull(i_tax,0) i_tax , ssh.sr_good_recept_status status ,rate,final_value ,
case
when ifnull(warehouse_no,0)>0 then warehouse_no
ELSE 'NULL'
end warehouse_no ,
ifnull(i.hsn_code,'NULL') hsn_code, ssli.store_receive_no ,
ssli.dept_id ,ssh.company_id ,gate_line_item_no,ssli.tax_id,tax_name, quantity_consumed,branch_id,project_id from scm_sr_line_item ssli,
itemmaster i,scm_sr_hdr ssh,tax_master tm where ssli.item_grp_id =i.group_code and ssli.item_code =i.item_code and IFNULL(i.issuable_tag,'Ý')<>'N'
and ssh.store_receive_no =ssli.store_receive_no and ssh.store_receive_no<=11276
and ssh.company_id <>0 and ssli.tax_id=tm.tax_id ) a left join master_department md on
a.dept_id=md.mdept_id and a.company_id=md.company_id AND md.company_id in (1,2,3) ) g left join master_department md1 on g.dept_desc=md1.dept_desc
and ifnull(md1.created_by,'Y')<>'N' AND md1.company_id in (1,2,3) ) k left join ( select a.*,b.hdr_id pohdrid from gate_store_entry_reg_dtl a left join
scm_po_hdr b on a.po_no=b.po_num ) l on k.gate_line_item_no=l.dtl_id ) p left join tax_master q on p.tax_name=q.tax_name and q.created_by>0
order by store_line_item_no desc
";
echo $sql;
$resulta = $conn->query($sql);
while($rowa = $resulta->fetch_assoc())
{
$tx=0;
if ($rowa["c_tax"]>0 ) {
$tx=$rowa["c_tax"]+$rowa["s_tax"];
} else {
$tx=$rowa["i_tax"];
}
$sql1="INSERT INTO tbl_proc_inward_detail (indent_details_id,inward_qty,uom,approved_qty,rejected_qty,
tax_percentage,cgst_percentage,igst_percentage,sgst_percentage,rate,amount,
discount,wh_id,is_active,item,po,po_detail,tax,status,inward,department,hsn_code) VALUES
( ".$rowa["store_line_item_no"].",".$rowa["actual_quantity"].",'".$rowa["uom_code"]."',".$rowa["final_qty"].",0,".$tx.
",".$rowa["c_tax"].",".$rowa["i_tax"].",".$rowa["s_tax"].",".$rowa["rate"].",".$rowa["final_value"].
",0,".$rowa["warehouse_no"].",".$rowa["is_active"].",".$rowa["item_id"].",".$rowa["pohdrid"].",".$rowa["po_line_no"].",".$rowa["taxid"].",".
$rowa["status"].",".$rowa["store_receive_no"].",".$rowa["rec_id"].",'".$rowa["hsn_code"]."')";
echo $sql1;
if (mysqli_query($conn, $sql1)) {
echo "New record created successfully";
//} else {
// echo "Error: " . $sql . "
" . mysqli_error($conn);
}
$sql2="INSERT INTO tbl_proc_inward_detail (indent_details_id,inward_qty,uom,approved_qty,rejected_qty,
tax_percentage,cgst_percentage,igst_percentage,sgst_percentage,rate,amount,
discount,wh_id,description,is_active,item,po,po_detail,tax,status,inward,department,hsn_code) VALUES ( ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
$a1=$rowa["store_line_item_no"];
$a2=$rowa["actual_quantity"];
$a3=$rowa["uom_code"];
$a4=$rowa["final_qty"];
$a5=0;
$a6=$tx;
$a7=$rowa["c_tax"];
$a8=$rowa["i_tax"];
$a9=$rowa["s_tax"];
$a10=$rowa["rate"];
$a11=$rowa["final_value"];
$a12=0;
$a13=$rowa["warehouse_no"];
$a14=$rowa["item_desc"];
$a15=$rowa["is_active"];
$a16=$rowa["item_id"];
$a17=$rowa["pohdrid"];
$a18=$rowa["po_line_no"];
$a19=$rowa["taxid"];
$a20=$rowa["status"];
$a21=$rowa["store_receive_no"];
$a22=$rowa["dept_id"];
$a23=$rowa["hsn_code"];
//$stmt = $conn->prepare($sql2);
//$stmt->bind_param('sssssssssssssssssssssss', $a1,$a2,$a3,$a4,$a5,$a6,$a7,$a8,$a9,$a10,$a11,$a12,$a13,$a14,$a15,$a16,$a17,$a18,$a19,$a20,$a20,$a21,$a22,$a23);
//$stmt->execute();
echo $sql1;
$bqty=$a4-$rowa["quantity_consumed"];
$sql3="insert into tbl_proc_material_inventory ( item,inward,inward_detail ,qty,balanace_qty ,company,branch ,
status ,project,location ) values ( ".$a16.",".$rowa["store_receive_no"].",".$a1.",".$a4.",".$bqty.",".$rowa["company_id"].",".$rowa["branch_id"].
",".$a20.",".$rowa["project_id"].",".$a13.")";
echo $sql3;
if (mysqli_query($conn, $sql3)) {
echo "New record created successfully";
//} else {
// echo "Error: " . $sql . "
" . mysqli_error($conn);
}
}
echo "complete";
?>