I am trying to pass value from view to controller, but it not working. it just triggers normal
my controller public
function purchaseentryformsave(Request $request) {
if ($request - > gst == '0') {
$purchasen = new Purchase;
$purchasen - > supplier_name = $request - > supplier_name;
$purchasen - > bill_no = $request - > bill_no;
$purchasen - > suppliers_master_id = $request - > suppliers_master_id;
$purchasen - > party_id = $request - > party_id;
$purchasen - > GSTIN = $request - > GSTIN;
$purchasen - > bill_date = $request - > bill_date;
$purchasen - > bill_entry_date = $request - > bill_entry_date;
$purchasen - > total_bill_amount = $request - > total_bill_amount;
$purchasen - > phone = $request - > phone;
$purchasen - > pincode = $request - > pincode;
$purchasen - > state = $request - > state;
$purchasen - > address = $request - > address;
$purchasen - > suppliers_unic_id = $request - > suppliers_unic_id;
if ($purchasen - > save()) {
$bill_no = $purchasen - > bill_no;
$suppliers_master_id = $purchasen - > suppliers_master_id;
$suppliers_unic_id = $purchasen - > suppliers_unic_id;
$party_id = $purchasen - > party_id;
$supplier_name = $purchasen - > supplier_name;
$GSTIN = $purchasen - > GSTIN;
$bill_date = $purchasen - > bill_date;
$bill_entry_date = $purchasen - > bill_entry_date;
foreach($request - > qty as $k => $p) {
Billproduct::create(['product_name' => $request['product_name'][$k], 'bill_no' => $bill_no, 'suppliers_master_id' => $suppliers_master_id, 'suppliers_unic_id' => $suppliers_unic_id, 'party_id' => $party_id, 'supplier_name' => $supplier_name, 'GSTIN' => $GSTIN, 'bill_date' => $bill_date, 'bill_entry_date' => $bill_entry_date, 'qty' => $request['qty'][$k], 'HSN_SAC' => $request['HSN_SAC'][$k], 'sale_rate' => $request['sale_rate'][$k], 'MRP_rate' => $request['MRP_rate'][$k], 'purchase_rate' => $request['purchase_rate'][$k], 'part_no' => $request['part_no'][$k], 'dcs' => $request['dcs'][$k], 'gst' => strtoupper('18'), ]);
}
foreach($request - > qty as $g => $p) {
Item_list::create(['supplier_name' => $supplier_name, 'product_name' => $request['product_name'][$g], 'qty' => $request['qty'][$g], 'purchase_rate' => $request['purchase_rate'][$g], 'MRP_rate' => $request['MRP_rate'][$g], 'sale_rate' => $request['sale_rate'][$g], 'part_no' => $request['part_no'][$g], ]);
}
}
}
elseif($request - > gst != '0') {
$purchasen = new Purchase;
$purchasen - > supplier_name = $request - > supplier_name;
$purchasen - > bill_no = $request - > bill_no;
$purchasen - > suppliers_master_id = $request - > suppliers_master_id;
$purchasen - > party_id = $request - > party_id;
$purchasen - > GSTIN = $request - > GSTIN;
$purchasen - > bill_date = $request - > bill_date;
$purchasen - > bill_entry_date = $request - > bill_entry_date;
$purchasen - > total_bill_amount = $request - > total_bill_amount;
$purchasen - > phone = $request - > phone;
$purchasen - > pincode = $request - > pincode;
$purchasen - > state = $request - > state;
$purchasen - > address = $request - > address;
$purchasen - > suppliers_unic_id = $request - > suppliers_unic_id;
if ($purchasen - > save()) {
$bill_no = $purchasen - > bill_no;
$suppliers_master_id = $purchasen - > suppliers_master_id;
$suppliers_unic_id = $purchasen - > suppliers_unic_id;
$party_id = $purchasen - > party_id;
$supplier_name = $purchasen - > supplier_name;
$GSTIN = $purchasen - > GSTIN;
$bill_date = $purchasen - > bill_date;
$bill_entry_date = $purchasen - > bill_entry_date;
foreach($request - > qty as $k => $p) {
Billproduct::create(['product_name' => $request['product_name'][$k], 'bill_no' => $bill_no,
'suppliers_master_id' => $suppliers_master_id, 'suppliers_unic_id' => $suppliers_unic_id,
'party_id' => $party_id, 'supplier_name' => $supplier_name, 'GSTIN' => $GSTIN, 'bill_date' =>
$bill_date, 'bill_entry_date' => $bill_entry_date, 'qty' => $request['qty'][$k], 'HSN_SAC' =>
$request['HSN_SAC'][$k], 'sale_rate' => $request['sale_rate'][$k], 'MRP_rate' =>
$request['MRP_rate'][$k], 'purchase_rate' => $request['purchase_rate'][$k], 'part_no' =>
$request['part_no'][$k], 'dcs' => $request['dcs'][$k], 'gst' => $request['gst'][$k], ]);
}
foreach($request - > qty as $g => $p) {
Item_list::create(['supplier_name' => $supplier_name, 'product_name' => $request['product_name'][$g], 'qty' => $request['qty'][$g], 'purchase_rate' => $request['purchase_rate'][$g], 'MRP_rate' => $request['MRP_rate'][$g], 'sale_rate' => $request['sale_rate'][$g], 'part_no' => $request['part_no'][$g], ]);
}
}
}
return redirect('/allpurchasesupplierlist') - > with('success', ' NEW PURCHASE ADDED SUCCESSFULLY .');
}
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire