0byt3m1n1
Path:
C:
/
wamp64
/
www
/
cpms_new
/
USER
/
[
Home
]
File: daybook_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) { $fromdate_dd= @$_POST['cmbdayfromdd']; $fromdate_mm=@$_POST['cmbdayfrommm']; $fromdate_yy=@$_POST['txtdayfromyy']; $from_date=$fromdate_yy."-".$fromdate_mm."-".$fromdate_dd; $todate_mm= @$_POST['cmbdaytomm']; $todate_dd=@$_POST['cmbdaytodd']; $todate_yy=@$_POST['txtdaytoyy']; $to_date=$todate_yy."-".$todate_mm."-".$todate_dd; if (!is_numeric(@$_POST['txtdayfromyy'])) { $error['fdate_numeric']="Please enter valid year"; $error_flag=1; } if (!is_numeric(@$_POST['txtdaytoyy'])) { $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) { echo "<script>window.location='http://localhost/CPFMS/USER/daybook.php</script>"; /* $url="http://".$server_ip."/CPFMS/USER/daybook.php?pcode=".$p_code_value; echo "<script>window.location='$url'</script>";*/ } //-------------- // if(isset($_POST['show'])) // { if($error_flag==0) { $p_id=@$_SESSION['project_id']; $u_id=@$_SESSION['user_id']; if($completeday==fullday) { $sql="select * from ledger where user_id='$u_id' and project_id='$p_id' ORDER BY date "; daybookreport::printdaybookDetails($sql,"",""); } else { $sql="select * from ledger where user_id='$u_id' and project_id='$p_id' and date between '$from_date' and '$to_date'" ; daybookreport::printdaybookDetails($sql,$from_date,$to_date); } } //} //-------------- } class daybookreport { //7 public function printdaybookDetails($sql1,$from_date,$to_date) {//10 $sql=mysql_query($sql1); if(mysql_affected_rows()>0) {//14 ?> <div align="center"><b><?php $p_code=@$_SESSION['project_code_s'];echo "Daybook of project:$p_code"?> <?php echo"From:$from_date"?> <?php echo "To:$to_date";?></b></div> <table width="1107" height="72" border="1" align="center"> <tr> <th width="31" height="42"> S No </th> <th width="91">Date </th> <th width="56">Ledger id</th> <th width="160">By Account</th> <th width="167">To Account</th> <th width="103">Debit</th> <th width="103">Credit</th> <th width="159"> Description </th> <th width="108">Reference</th> <th width="65">Refer-<br /> ence id</th> </tr> <?php $i=0;$debit=0;$credit=0; $deb_day=0;$cred_day=0;$j=0; while($row=mysql_fetch_array($sql)) {//32 ?> <tr> <td height="22"><div align="center"> <?php @$_SESSION['sl_no']=@$_SESSION['sl_no']+1; echo @$_SESSION['sl_no']; ?> </div></td> <td><div align="center"> <?php $datedb=$row['date']; echo $datedb; ?> </div></td> <td><div align="center"> <?php echo $row['ledg_id']; ?> </div></td> <td><div align="center"> <?php echo $row['group_name']; ?> </div></td> <td><div align="center"> <?php echo $row['account_name']; ?> </div></td> <td><div align="center"> <?php $debit_db=$row['debit']; echo $debit_db; $debit=$debit+$debit_db; ?> </div></td> <td><div align="center"> <?php $credit_db=$row['credit']; echo $credit_db; $credit=$credit+$credit_db; ?> </div></td> <td><div align="center"> <?php echo $row['description']; ?> </div></td> <td><div align="center"> <?php echo $row['ledger_type']; ?> </div></td> <td><div align="center"> <?php echo $row['type_id']; ?></div></td> </tr> <?php }//32 ?> </table> <table width="938" align="center"> <tr> <td width="137"><div align=""><strong>Grand total</strong></div></td> <td width="256"> </td> <td width="117"><div align="center"><b><?php echo $debit;?></b></div></td> <td width="100"><div align="center"><b><?php echo $credit;?></b></div></td> <td width="304"> </td> </tr> </table> <b>Balance :<?php echo $credit-$debit;?></b> <?php }//14 else {//14 ?><font color="#CC0000"><b><?php echo "No Details to display"; ?></b></font><?php }//14 }//10 }//7 if(isset($_POST['show'])) { ?> </p> <p><a href="#" class="projectboldtxt style2" onclick="window.print()">Print</a> <a href="task.php">Back</a></p> </blockquote> <?php } ?>