0byt3m1n1
Path:
C:
/
wamp64
/
www
/
cpms_new
/
USER
/
[
Home
]
File: advance_settlement_report_ctrl.php
<?php require_once "../lib/config.php"; require_once BASE_DIR."/lib/db/connection.php"; $error_flag=0; $completeday= @$_POST['checkcompletedays']; if(isset($_POST['show'])) { if($completeday!=fullday) { $name= @$_POST['txtname']; $fromdate_dd= @$_POST['cmbfromdd']; $fromdate_mm=@$_POST['cmbfrommm']; $fromdate_yy=@$_POST['txtfromyy']; $from_date=$fromdate_yy."-".$fromdate_mm."-".$fromdate_dd; $todate_mm= @$_POST['cmbtomm']; $todate_dd=@$_POST['cmbtodd']; $todate_yy=@$_POST['txttoyy']; $to_date=$todate_yy."-".$todate_mm."-".$todate_dd; if (!is_numeric(@$_POST['txtfromyy'])) { $error['fdate_numeric']="Please enter valid year"; $error_flag=1; } if (!is_numeric(@$_POST['txttoyy'])) { $error['todate_numeric']="Please enter valid year"; $error_flag=1; } if ($fromdate_yy="") { $error['fdate_yy']="Please enter year"; $error_flag=1; } if ($todate_yy="") { $error['todate_yy']="Please enter year"; $error_flag=1; } } if($error_flag==1) { $url=$server_ip."/USER/search_advancetakenentry.php"; echo "<script>window.location='$url'</script>"; } $name=@$_POST['txtname']; //$u_name=@$_SESSION['username']; $p_id=@$_SESSION['project_id']; $u_id=@$_SESSION['user_id']; $nodetails_flag=0; if($error_flag==0) {//156 search_advanceSettelmententry::printadvanceSettelmententrysheader($from_date,$to_date); if($completeday==fullday) {//157 $sql1="select distinct(advance_taken_entry_no) from advance_settelment where vender_name LIKE '%$name%'"; $sql1=mysql_query($sql1); while($row_base=mysql_fetch_array($sql1)) { // 159 $advance_taken_entry_no_db=$row_base['advance_taken_entry_no']; $sql2="select * from advance_taken_entry where user_id='$u_id' and advance_id ='$advance_taken_entry_no_db' and (project_id ='$p_id' or project_id ='0')"; if(mysql_affected_rows()>0) {//69 $sql2=mysql_query($sql2); while($row_inner=mysql_fetch_array($sql2)) {//172 $advance_id_var=$row_inner['advance_id']; /*$proj_id_ate_db=$row_inner['project_id']; if ($proj_id_ate_db==0) // means Imprest {*/ $sql3="select * from advance_settelment where advance_taken_entry_no='$advance_id_var' and vender_name LIKE '%$name%' "; /*} else { $sql3="select * from advance_settelment where advance_taken_entry_no='$advance_id_var' and project_id ='$p_id' and vender_name LIKE '%$name%' "; }*/ search_advanceSettelmententry::printsearch_advanceSettelmentDetails($sql3,"",""); }//172 }//69 else {//69 ?><font color="#CC0000"><b><?php if($nodetails_flag==0) { echo "No Details to display"; } ?></b></font><?php }//69 }// 159 }//157 else {//157 $sql1="select distinct(advance_taken_entry_no) from advance_settelment where vender_name LIKE '%$name%' "; $sql1=mysql_query($sql1); while($row_base=mysql_fetch_array($sql1)) { // 84 $advance_taken_entry_no_db=$row_base['advance_taken_entry_no']; $sql2="select * from advance_taken_entry where user_id='$u_id' and project_id ='$p_id' and advance_id ='$advance_taken_entry_no_db' and (project_id ='$p_id' or project_id ='0') "; $sql2=mysql_query($sql2); if(mysql_affected_rows()>0) {//101 while($row_inner=mysql_fetch_array($sql2)) {//172 $advance_id_var=$row_inner['advance_id']; /*$proj_id_ate_db=$row_inner['project_id']; if ($proj_id_ate_db==0) // means Imprest {*/ $sql3="select * from advance_settelment where advance_taken_entry_no='$advance_id_var' and (invoice_date between '$from_date' and '$to_date') ORDER BY invoice_date "; /*} else { $sql3="select * from advance_settelment where advance_taken_entry_no='$advance_id_var' and project_id ='$p_id' and (invoice_date between '$from_date' and '$to_date') ORDER BY invoice_date "; } */ $nodetails_flag=$nodetails_flag+1; search_advanceSettelmententry::printsearch_advanceSettelmentDetails($sql3); }//172 }//101 else {//101 ?><font color="#CC0000"><b><?php if($nodetails_flag==0) { echo "No Details to display"; } ?></b></font><?php }//101 }// 84 }//157 }//156 } class search_advanceSettelmententry { //50 public function printadvanceSettelmententrysheader($from_date,$to_date) { ?> <div align="center"> <p><b>Advance Taken Entry <?php echo"From:$from_date"?> <?php echo "To:$to_date";?></b></p> </div> <table width="502" height="83" border="1" align="center"> <tr> <th width="17" height="42">S no</th> <th width="60"><p>Voucher No:</p> </th> <th width="41">From entry</th> <th width="39">Type of item</th> <th width="53">Vender name</th> <th width="49">Invoice</th> <th width="54">Invoice Date</th> <th width="50">Bill amount</th> <th width="81">Descreption</th> </tr> <?php } public function printsearch_advanceSettelmentDetails($sql2) {//53 $sql=mysql_query($sql2); if(mysql_affected_rows()>0) {//57 ?> <tr><?php $i=0;$sum=0; while($row=mysql_fetch_array($sql)) {//75 ?> <td ><div align="center"> <?php @$_SESSION['sl_no']=@$_SESSION['sl_no']+1; echo @$_SESSION['sl_no']; ?> </div></td> <td><div align="center"> <?php echo $row['voucher_no']; ?> </div></td> <td><div align="center"> <?php echo $row['advance_taken_entry_no'];; ?> </div></td> <td><div align="center"> <?php echo $row['type_of_item']; ?> </div></td> <td><div align="center"> <?php echo $row['vender_name']; ?> </div></td> <td><div align="center"> <?php echo $row['invoice_no']; ?> </div></td> <td><div align="center"> <?php echo $row['invoice_date']; ?> </div></td> <td><div align="center"> <?php echo $row['bill_amount']; $sum=$sum+$row['bill_amount']; ?> </div></td> <td><div align="center"> <?php echo $row['description']; ?> </div></td> <!-- <th><a href="../USER/edit_payment.php?id=</?php echo $row['payment_id']; ?>"><img src="../images/edit.png" alt="edit" width="25" height="25" /></a></th> <th> <a href="../USER/delete_payment.php?id=</?php echo $row['payment_id']; ?>"><img src="../images/delete.jpg" alt="Delete" width="25" height="25" /></a></th>--> </tr> <?php }//75 ?> </table> <table width="672" border="0"> <th width="666" align="right"> <?php echo $sum;?></th> </table> <?php }//57 else {//57 ?><font color="#CC0000"><b><?php echo "No Details to display"; ?></b></font><?php }//57 }//53 }//50 if(isset($_POST['show'])) { ?> </p> <p><a href="#" class="projectboldtxt style2" onclick="window.print()">Print</a> <a href="advance_settlement_report.php">Back</a></p> </blockquote> <?php } ?>