session_start(); global $scode; $linkID = mysql_connect("localhost", "root", "zangtang"); mysql_select_db("SciPark"); function findexts ($filename) { $filename = strtolower($filename) ; $exts = split("[/\\.]", $filename) ; $n = count($exts)-1; $exts = $exts[$n]; return $exts; } //------------------------------------------------------------------------------------------------------------------------------------ // VERIFY FORM FUNCTION //--------------------------------------------------------------------------------------------------------------------------------------- function VerifyForm(&$values, &$errors) { if(strlen($values['Bill_No'])== 0) $errors['Bill_No'] = "Bill No. Required"; list($day, $month , $year) = explode('-',$values["Bill_Date"]); if(strlen($values["Bill_Date"]) != 10 || !checkdate( $month , $day , $year )) $errors['Bill_Date'] = "Correct Format Reqd."; $Bill_No = htmlentities($values['Bill_No']); $BillDate = date('Y-m-d',strtotime(htmlentities($values['Bill_Date']))); $query0 = "SELECT * FROM RegisterMaster where `Bill_No` = '$Bill_No' "; echo $query0; $r00 = mysql_db_query("ScpFinance", $query0) or die ("could not query" . mysql_error()); $tung0=mysql_affected_rows(); if($tung0 != 0) { while ($r = mysql_fetch_array($r00)) { $Bill_No_Db = $r["Bill_No"]; //echo $Bill_No; $Bill_Date_Db = $r["Bill_Date"]; //echo $Bill_Date; } } if($Bill_No_Db == $Bill_No && $Bill_Date_Db == $BillDate ) $errors['Bill_Entry'] = "THIS BILL HAS ALREADY BEEN ENTERED INTO THE SYSTEM..."; if(strlen($values['PO_No']) != 0) { list($day, $month , $year) = explode('-',$values["PO_Date"]); if(strlen($values["PO_Date"]) != 10 || !checkdate( $month , $day , $year )) $errors['PO_Date'] = "Correct Format Reqd."; } $Qty = htmlentities($values['qty']); for($j=0;$j<=$Qty;$j++) { $Type = "Item".$j."_Type"; if(htmlentities($values[$Type]) == "Ct") { $CaptitalEntry ="Y"; } } if(strlen($values['Order_No']) > 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.'), ); ?>