D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
thread-self
/
root
/
home
/
shubmkcj
/
urbane.createerp.com
/
admin-report
/
Filename :
montly-po-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 Purchase Order Report "; $rowsv=''; $total_amt=0; echo $sql = "SELECT * FROM `purchase_order` WHERE STR_TO_DATE(`order_date`, '%d %M %Y') BETWEEN '$form_formate_date' AND '$to_formate_date' AND data_delete != 'yes' order by `order_date` ASC"; $result = mysqli_query($conn,$sql); if (mysqli_num_rows($result) > 0){ while( $row = mysqli_fetch_array($result)){ $helping_id = $row['manufacturer']; $po_id=$row['po_id']; $p_date=$row['order_date']; $ee = $row["amount_paind"]; $get_bpn = mysqli_query($conn,"SELECT * FROM `manufacturer` where id='$helping_id'"); $get_bpn_row = mysqli_fetch_assoc($get_bpn); $final_bill_pay_name = $get_bpn_row['manufacturer_display_name']; $manufacturer_currency = $get_bpn_row["currency"]; if($manufacturer_currency=='RMB'){ $ee = $ee/16; }else{ $ee=$ee; } $total_amt += sprintf('%0.2f', $ee); $rowsv.=' <tr class="gradeX" style="font-size:13px"> <td>'.$p_date.'</td> <td>'.$po_id.'</td> <td>'. $final_bill_pay_name.'</td> <td>'. sprintf('%0.2f', $ee) .'</td> </tr> '; $amtMessg='<tr> <th colspan="3" style="text-align:right;">Total Amount (in USD)</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>Order Report</strong> Report </h3><br> <table role="presentation" style="" class="table table-bordered"> <thead> <tr class="theme-bg"> <th>Date</th> <th>Purchase Order Id</th> <th>Manufacturer Name</th> <th>Total Amount (in USD)</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 ); ?>