Skip to content

Commit

Permalink
Code for Notes for Particulars added.
Browse files Browse the repository at this point in the history
  • Loading branch information
abhis091 committed Jul 25, 2021
1 parent c600f0b commit 531cde6
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 33 deletions.
2 changes: 1 addition & 1 deletion fill.html
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ <h3 id="firmName" class="text-center text-primary"></h3>
</div>
<input type="text" id="fYearGST" class="form-control" aria-label="Default select example"
list="fYearListGST" placeholder="2021-22" />

<datalist id="fYearListGST">
<option data-id="1" >2000-01</option>
<option data-id="2" >2001-02</option>
Expand Down
65 changes: 33 additions & 32 deletions insertInvoiceData.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,34 @@
$firmId = $_COOKIE['firmId'];
$clientId = $_COOKIE['clientId'];

print_r($temp);
// print_r($temp);

$formData = array();
$particulars = array();
$notes = array();

if($firmId<3){
foreach ($temp as $key => $value) {
if($key<4){
array_push($formData,$value);
}else if($key>=4 && $key%2==0){
$particulars[$value] = $temp[$key+1];
}else{
continue;
}
}

}else{
foreach ($temp as $key => $value) {
if($key<6){
array_push($formData,$value);
}else if($key>=6 && $key%2==0){
$particulars[$value] = $temp[$key+1];
}else{
continue;
}
array_push($formData,$temp[0],$temp[1],$temp[2],$temp[3]);

for($i=4;$i<sizeof($temp);$i = $i+3){
$particulars[$temp[$i]] = $temp[$i+2];
$notes[$temp[$i]] = $temp[$i+1];
}
}
else{
array_push($formData,$temp[0],$temp[1],$temp[2],$temp[3],$temp[4],$temp[5]);

for($i=6;$i<sizeof($temp);$i = $i+3){
$particulars[$temp[$i]] = $temp[$i+2];
$notes[$temp[$i]] = $temp[$i+1];
}

}

print_r($particulars);
print_r($formData);
return;
// print_r($particulars);
// print_r($formData);
// print_r($notes);

$totalAmount = array_sum(array_values($particulars));

Expand All @@ -49,15 +45,15 @@
$queryBillMaster = "insert into bill_master values('".$formData[0]."',".$firmId.",'".$formData[1]."',".$clientId.",".$totalAmount.",0,0,0,0,0,0,null)";
}

print_r($formData);
// print_r($formData);
// echo "\n";
// print_r($particulars);

// echo $firmId;
// echo $clientId;
// echo $totalAmount;
// echo $queryBillMaster;
return;

$result = mysqli_query($con,$queryBillMaster);

if($result){
Expand All @@ -67,26 +63,31 @@
if($firmId==3){
$tax_amount = $pAmount + $pAmount*0.18;
}
$queryBillDetails = "insert into bill_details (bill_master_id,firm_id,service_id,taxable_amount,tax_amount)
values('".$formData[0]."','".$firmId."',".$pID.",".$pAmount.",".$tax_amount.")";
$queryBillDetails = "insert into bill_details (bill_master_id,firm_id,service_id,taxable_amount,tax_amount,service_note)
values('".$formData[0]."','".$firmId."',".$pID.",".$pAmount.",".$tax_amount.",'".$notes[$pID]."')";
$result1 = mysqli_query($con,$queryBillDetails);

if($result1){
echo "<script>alert('Bill Generated Successfully');</script>";
if($result){
$flag=1;
}else{
echo "<script>alert('Error during Bill Details Generation');</script>";
$flag=0;
break;
}
}
if($flag){
echo "<script>alert('Bill Generated Successfully');</script>";
}else{
echo "<script>alert('Error during Bill Details Generation');</script>";
}

}else{
echo "<script>alert('Error during Bill Master Generation');</script>";
}

/*echo "
echo "
<script>
window.location = './fill.html';
</script>
";*/
";

}

Expand Down

0 comments on commit 531cde6

Please sign in to comment.