0) { list($day1, $month1 , $year1) = explode('-',$values["Order_Date"]); if(strlen($values["Order_Date"]) != 10 || !checkdate( $month1 , $day1 , $year1 )) $errors['Order_Date'] = "Correct Format Reqd."; } if(strlen($values['InclGST'])== 0) $errors['InclGST'] = "Specify GST Details. "; //if(htmlentities($values['InclGST']) == "Yes" && strlen($values['Incl_GST'])== 0) $errors['InclGST'] = "Specify GST %"; if (htmlentities($values['SubCatName']) == "Select") $errors['SubCatName'] = "Theme/Topic Required"; if(htmlentities($values['qty']) > 0) { $Qty = htmlentities($values['qty']); for($k=$Qty;$k>=1;$k--) { $name = "Item".$k."_Name"; $Type = "Item".$k."_Type"; $nameQty = "Item".$k."_Qty"; $namePrice = "Item".$k."_Price"; $nameDisc = "Item".$k."_Discount"; $nameGST = "Item".$k."_GST"; $nameOC = "Item".$k."_OthCharges"; $nameFP = "Item".$k."_FPrice"; //echo $nameFP; if(strlen($values[$nameFP])== 0 && !is_numeric($values['nameFP'])) $errors['ItemError'] = "** Error : Total Amount of Item No. : ".$k." reqd."; if((strlen($values[$namePrice])== 0) && (!is_numeric($values['namePrice']))) $errors['ItemError'] = "** Error : Article Price of Item No. ".$k." reqd."; if(strlen($values[$nameQty])== 0 && !is_numeric($values['nameQty'])) $errors['ItemError'] = "** Error : Article Quantity of Item No. ".$k." reqd."; if(strlen($values[$name])== 0 ) $errors['ItemError'] = "** Error : Article Name of Item No. ".$k." reqd."; if(htmlentities($values[$Type]) == "Select") $errors['ItemError'] = "** Error : Article Type of Item No. ".$k." reqd."; } } else { $errors['qty'] = "Total Item Number Reqd."; } if(strlen($values['OtherCharges']) > 0 && !is_numeric($values['OtherCharges'])) $errors['OtherCharges'] = "Only Numeric Value Required"; if(htmlentities($values['Discount']) == "Y") { if(!is_numeric($values['BillDiscount']) || htmlentities($values['BillDiscount']) == '0') $errors['BillDiscount'] = "Numeric Value Reqd."; } if(!is_numeric($values['Bill_Total']) || htmlentities($values['Bill_Total']) == '0') $errors['Bill_Total'] = "Numeric Value Reqd."; list($day3, $month3 , $year3) = explode('-',$values["Installation_Date"]); if(strlen($values['Installation_Date']) > 0 && (strlen($values["Installation_Date"]) != 10 || !checkdate( $month3 , $day3 , $year3 ))) $errors['Installation_Date'] = "Correct Format Reqd."; if(strlen($values['FirmName'])== 0) $errors['FirmName'] = "Firm Name Required"; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ print_r($errors); return (count($errors) == 0); } //--------------------------------------------------------------------------------------------------------------------------------------- // DISPLAY FORM FUNCTION //--------------------------------------------------------------------------------------------------------------------------------------- function outputOptionList($list, $selected) { foreach ($list as $item) echo "\n"; } function DisplayForm($values, $errors) { // $chars = "abcdefghijkmnopqrstuvwxyz023456789"; $i=0; $d=date(d); $m=date(F); $n=date(n); $y=date(Y); $optionListMonth = array( array('Value' =>'Select', 'Text' => '(select Month)'), array('Value' =>'01', 'Text' => 'January'), array('Value' =>'02', 'Text' => 'February'), array('Value' =>'03', 'Text' => 'March'), array('Value' =>'04', 'Text' => 'April'), array('Value' =>'05', 'Text' => 'May'), array('Value' =>'06', 'Text' => 'June'), array('Value' =>'07', 'Text' => 'July'), array('Value' =>'08', 'Text' => 'August'), array('Value' =>'09', 'Text' => 'September'), array('Value' =>'10', 'Text' => 'October'), array('Value' =>'11', 'Text' => 'November'), array('Value' =>'12', 'Text' => 'December'), ); $optionListYear = array( array('Value' => 'Select', 'Text' => "(select Year)"), array('Value' => '2018', 'Text' => "2018"), array('Value' => '2019', 'Text' => "2019"), array('Value' => '2020', 'Text' => "2020"), ); $ItemTypeList = array( array('Value' => 'Select', 'Text' => "(select Type)"), array('Value' => 'Cm', 'Text' => "Consumable"), array('Value' => 'Ct', 'Text' => "Capital"), ); //print_r($optionListYear); $StdList = array( array('Value' =>'Select', 'Text' => 'Select'), array('Value' =>'1st Std.', 'Text' => '1st Std.'), array('Value' =>'2nd Std.', 'Text' => '2nd Std.'), array('Value' =>'3rd Std.', 'Text' => '3rd Std.'), array('Value' =>'4th Std.', 'Text' => '4th Std.'), array('Value' =>'5th Std.', 'Text' => '5th Std.'), array('Value' =>'6th Std.', 'Text' => '6th Std.'), array('Value' =>'7th Std.', 'Text' => '7th Std.'), array('Value' =>'8th Std.', 'Text' => '8th Std.'), array('Value' =>'9th Std.', 'Text' => '9th Std.'), array('Value' =>'10th Std.', 'Text' => '10th Std.'), array('Value' =>'11th Std.', 'Text' => '11th Std.'), array('Value' =>'12th Std.', 'Text' => '12th Std.'), ); ?> Finance Module

<< Admin Home

STOCK REGISTER

For adding the new Bill into Stock Register, kindly furnish the following information :

  
  

 1. Bill No. :

*     2. Bill Date : (dd-mm-yyyy) *  
  

 3. Purchase Order No :

      4. Purchase Order Date :(dd-mm-yyyy)    
  

 5. Order No :

      6. Order Date :(dd-mm-yyyy)    
  

 7. No. of Items :

*       
  

 8.a. Is the Bill Inclusive of GST ? :   OnClick="this.form.submit()">Yes  OnClick="this.form.submit()">No    8.b.  ----> GST in % :   

 
 
Sr.No.Article Type Article NameQuantity Unit of Qty
e.g. sq.ft./ml.
Price Any Discount
[Tick for % Discount]
Other Charges Total Price

.

onClick="this.form.submit()">
 
Sr.No.Article Type Article NameQuantity Unit of Qty
e.g. sq.ft./ml.
Price Any Discount
[Tick for % Discount]
Other Charges GST % Total Price

.

onClick="this.form.submit()">
 
  

 9. Other Charges :

Name:  Amt :    10. Installation Date :(dd-mm-yyyy)    
  

11. Discount on Bill :
   [Please Tick for % Discount]

    onClick="this.form.submit()" >%   12. Bill Total:*  
  

13. Firm Name :

*       
  
     

----->".$name.$k; $Type = "Item".$k."_Type"; $name[$k][2] = $_POST[$Type]; // echo "**".$Type; $Type = $_POST[$Type]; echo "`".$Type."*"; $nameQty = "Item".$k."_Qty"; $name[$k][3] = $_POST[$nameQty]; $nameQty_Unit = "Item".$k."_QtyUnit"; $name[$k][10] = $_POST[$nameQty_Unit]; $namePrice = "Item".$k."_Price"; $name[$k][4] = $_POST[$namePrice]; $nameDisc = "Item".$k."_Discount"; $name[$k][5] = $_POST[$nameDisc]; // $nameOC = "Item".$k."_OthCharges"; $name[$k][6] = $_POST[$nameOC]; //echo $nameOC; echo "
"; $nameGST = "Item".$k."_GST"; $name[$k][9] = $_POST[$nameGST]; //echo $nameOC; echo "
"; $nameFP = "Item".$k."_FPrice"; $name[$k][7] = $_POST[$nameFP]; $DiscCheck = "ch".$k; $name[$k][8] = $_POST[$DiscCheck]; $i++; } echo "

----->"; print_r($name); echo "

----->".$Stock_Cnt; //echo $name; $OC_Name = $_POST["OC_Name"]; $OtherCharges = $_POST["OtherCharges"]; $Installation_Date = $_POST["Installation_Date"]; //$InstallationDate = date('Y-m-d',strtotime($Installation_Date)); $PerDiscount = $_POST["Discount"]; $BillDiscount = $_POST["BillDiscount"]; $Bill_Total = $_POST["Bill_Total"]; $FirmName = $_POST["FirmName"]; if($Installation_Date == '1970-01-01') $Installation_Date = ""; if($PODate == '1970-01-01') $PODate = ""; if($OrderDate == '1970-01-01') $OrderDate = ""; if (isset($Bill_No) && isset($Bill_Date) && isset($qty) && isset($Bill_Total) && isset($FirmName)) { // print_r($_POST); $Fdate = date("Y-m-d"); $Tag = "0"; $ExhbtNWCount = $ExhbtCount-$ExhbtWCount; $qry5 = "SELECT * from FRegCnt where `TypeCode` = 'Cm'"; echo $qry5; $result5 = mysql_db_query("ScpFinance", $qry5) or die ("could not query" . mysql_error()); while ($re5 = mysql_fetch_array($result5)) { $ConsumablePtr = $re5["Ptr"]; } $ConsumablePtr++; //---------------------------------------------------------------- INSERT INTO REGISTER MASTER _____________________________________________________ $qry3 = "SELECT * from RegisterCnt"; echo $qry3; $result3 = mysql_db_query("ScpFinance", $qry3) or die ("could not query" . mysql_error()); while ($re3 = mysql_fetch_array($result3)) { $RegisterName = $re3["RegisterName"]; $RegCnt = $re3["RegCnt"]; echo $RegCnt; } $RegCnt++; $NewCnt = str_pad($RegCnt, 3, "0", STR_PAD_LEFT); $UID = $RegisterName.$NewCnt; $query0 = "INSERT INTO RegisterMaster VALUES ('$UID','$Bill_No','$BillDate', '$Order_No', '$OrderDate','$PO_No', '$PODate', '$qty', '$InclGST', '$Incl_GSTNo', '$OC_Name','$OtherCharges','$PerDiscount', '$BillDiscount', '$Bill_Total', '$FirmName','SCP', '$Installation_Date','','GRANTNAME','A', '$Fdate')"; //echo "
".$query0 ; $result5 = mysql_db_query("ScpFinance", $query0) or die ("could not connect to database->".mysql_error()); $tung5=mysql_affected_rows(); if($tung5 != 0) { $query10 = "UPDATE RegisterCnt set `RegCnt`='$RegCnt'"; $result10 = mysql_db_query("ScpFinance", $query10) or die ("could not query" . mysql_error()); $tung10=mysql_affected_rows(); //-------------------------------------------- Stock No Allocation --------------------------------------------------------------------------------- $Stock_No = 0; for($k=1;$k<=$qty;$k++) { // if($InclGST == "Yes") { $GST = $Incl_GSTNo; } else { $GST = $name[$k][9]; } $val = $name[$k][4]; if($name[$k][8] == "on" ) { $Per = ($name[$k][3]*$name[$k][4]*$name[$k][5])/100; //echo "
".$Per."
"; $DisPer = $name[$k][5]; } else { $val2 = $val - $name[$k][5]; $Per=$name[$k][5]; $DisPer = '0'; // No % Disc so 0 } echo $DisPer."---".$Per."
"; if($name[$k][2] == "Ct") { $IndPrice = $name[$k][7] / $name[$k][3]; $qry5 = "SELECT * from FRegCnt where `TypeCode` = 'Ct'"; //echo $qry5; $result5 = mysql_db_query("ScpFinance", $qry5) or die ("could not query" . mysql_error()); while ($re5 = mysql_fetch_array($result5)) { $TypeCode = $re5["TypeCode"]; $CCBType = $re5["CCBType"]; //echo $CCBType; $SNumber = $re5["SNumber"]; //echo $SNumber; $Ptr = $re5["Ptr"]; //echo $Ptr; } // $name[$k][3] has Capital Qty $Ptr++; $NStock = $Ptr+($name[$k][3]-1); if($name[$k][3] > 1) { $Stock_No = $Ptr."-".$NStock; } else { $Stock_No = $NStock; } $query5 = "INSERT INTO Capitals VALUES ('$UID','$Stock_No','".$name[$k][1]."','".$name[$k][3]."','".$name[$k][10]."','".$name[$k][4]."', '$DisPer','$Per', '".$name[$k][6]."','$GST','".$name[$k][7]."','$Installation_Date','A')"; echo "
".$query5 ; $result5 = mysql_db_query("ScpFinance", $query5) or die ("could not connect to database".mysql_error()); $tung5=mysql_affected_rows(); $query7 = "UPDATE FRegCnt set `Ptr`='$NStock' where `TypeCode` = 'Ct'"; $result7 = mysql_db_query("ScpFinance", $query7) or die ("could not query" . mysql_error()); $tung7=mysql_affected_rows(); } //------------------------------------------------------------------------------------------------------------------------------------------------------------------- // CONSUMABLES INSERTION //------------------------------------------------------------------------------------------------------------------------------------------------------------------- if($name[$k][2] == "Cm") { $query6 = "INSERT INTO Consumables VALUES ('','$UID','$ConsumablePtr','".$name[$k][1]."','".$name[$k][3]."','".$name[$k][10]."','".$name[$k][4]."','$DisPer','$Per', '".$name[$k][6]."','$GST','".$name[$k][7]."', '$Installation_Date','A')"; echo "
".$query6 ; $result6 = mysql_db_query("ScpFinance", $query6) or die ("could not connect to database".mysql_error()); $tung6=mysql_affected_rows(); $query8 = "UPDATE FRegCnt set `Ptr`='$ConsumablePtr' where `TypeCode` = 'Cm'"; $result8 = mysql_db_query("ScpFinance", $query8) or die ("could not query" . mysql_error()); $tung8=mysql_affected_rows(); } } } //------------------------------------------------------------------------------------------------------------------------------------------------------------------- $_SESSION['UID']= $UID; header( 'Location: ShowBill.php' ) ; } else echo "Error found!!! Please fill the form correctly"; } //else close } else { $formValues = $_POST; $formErrors = array(); DisplayForm($formValues, $formErrors); }//echo $_POST["a_addr1"]; }//} ////////$_SESSIOM['H_HCBL'] = $H_HCBL; } else { DisplayForm(null, null); //echo "here1"; // } } } else { header( 'Location: ../Access_Denied.html' ) ; } ?>