D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
thread-self
/
root
/
home
/
shubmkcj
/
urbane.createerp.com
/
admin-report
/
Filename :
monthly-invoice-report.php
back
Copy
<?php // include '../config.php'; $servername = "localhost"; $username = "shubmkcj_urbane"; $password = "admin@123##"; $dbname = "shubmkcj_urbane"; $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } mysqli_set_charset($conn,'utf8'); $amtMessg=''; $todayDate=date('j F Y'); $PreviousDate = date('j F Y', strtotime($todayDate.' - 1 day')); // $to = date("Y-m-d", strtotime($todate)); // date("Y-m-d", strtotime($row["date"])) // $form_formate_date = date_format($from_date,"Y-m-d"); $to='gurmeet@urbanemerchandising.cn'; // $to='designpitara1@gmail.com'; $from = 'admin@urbane.createerp.com'; $prevmonth = date("F", strtotime ( '-1 month' , strtotime ( $todayDate ) )) ; // echo "<br>"; $prevmonthFirstDate = date("Y-m-1", strtotime ( '-1 month' , strtotime ( $todayDate ) )) ; // echo "<br>"; $prevmonthLastDate = date("Y-m-t", strtotime ( '-1 month' , strtotime ( $todayDate ) )) ; $from_date = date_create($prevmonthFirstDate); $to_date = date_create($prevmonthLastDate); $form_formate_date = date_format($from_date,"Y-m-d"); $to_formate_date = date_format($to_date,"Y-m-d"); $subject = $prevmonth." Month Invoice Report "; $rowsv=''; $total_amt=0; $sql = "SELECT * FROM `generate_invoice` WHERE STR_TO_DATE(`date`, '%d %M %Y') BETWEEN '$form_formate_date' AND '$to_formate_date' AND data_delete != 'yes' order by `date` ASC"; $result = mysqli_query($conn,$sql); if (mysqli_num_rows($result) > 0){ while( $row = mysqli_fetch_array($result)){ $helping_id = $row['bill_pay_name']; $proforma_id=$row['invoice_Id']; $p_date=$row['date']; $due_date=$row['due_date']; $get_bpn = mysqli_query($conn,"SELECT * FROM `contact` where id='$helping_id'"); $get_bpn_row = mysqli_fetch_assoc($get_bpn); $final_bill_pay_name = $get_bpn_row['bill_display_name']; $total_amt += sprintf('%0.2f', $row["amount_paid"]); $rowsv.=' <tr class="gradeX" style="font-size:13px"> <td>'.$p_date.'</td> <td style="width:15%">'.$proforma_id.'</td> <td>'. $final_bill_pay_name.'</td> <td>'. $row['amount_paid'] .'</td> </tr> '; $amtMessg='<tr> <th colspan="3" style="text-align:right;">Total Amount</th> <th>'.$total_amt.'</th> </tr>'; } }else{ $rowsv=' <tr class="gradeX" style="font-size:13px"> <td colspan="4" style="text-align:center;">No Records of '.$prevmonth.' Month</th> </tr> '; $amtMessg=""; } $htmlContent=' <!DOCTYPE html> <html lang="en" xmlns="https://www.w3.org/1999/xhtml" xmlns:o="urn:schemas-microsoft-com:office:office"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <meta name="x-apple-disable-message-reformatting"> <style> .table { width: 100%; margin-left: 5px; border: 1px solid #CDCDCD; /*border-style:solid; border-width:1px; border-color:#000000;*/ margin: 15px; } .table th { background: none repeat scroll 0 0 #EEEEEE; padding: 10px; font-size: 14px; color: #000; border: 1px solid #CDCDCD; font-weight: 700; } .table tr { padding: 10px; font-size: 11px; height: 30px; border: 1px solid #CDCDCD; } .table tr td:first-child { font-weight: bold; text-align: left; border: 1px solid #CDCDCD; text-align: center; } .table td { padding-left: 3px; border: 1px solid #CDCDCD; color: #333333; text-align: center; } </style> </head> <body style="margin:0;padding:0;word-spacing:normal;"> <div role="article" aria-roledescription="email" lang="en" style="text-size-adjust:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;"><br> <h3 style="text-align:center"><b>Urbane Merchandising</b> '.$prevmonth.' Month <strong>Invoice</strong> Report </h3><br> <table role="presentation" style="" class="table table-bordered"> <thead> <tr class="theme-bg"> <th>Date</th> <th>Invoice Id</th> <th>Bill Pay Name</th> <th>Total Amount</th> </tr> </thead> <tbody> '.$rowsv.' '.$amtMessg.' </tbody> </table> </div> </body> </html> '; $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; // More headers $headers .= "From: $from" . "\r\n"; // $headers .= "Reply-To: <$to>" . "\r\n"; // $headers .= 'Cc: ravindra@designpitara.com' . "\r\n"; $headers.="X-Mailer: PHP/" . phpversion(); $mail = mail( $to, $subject, $htmlContent, $headers ); ?>