feat: Implement invoice generation and emailing functionality
- Added invoice generation logic using DomPDF. - Integrated invoice data retrieval from the API. - Implemented language determination for invoices based on customer data. - Added options to email invoices to customers and admin. - Included HTML output option for direct viewing in the browser. - Ensured proper redirection and error handling throughout the process.
This commit is contained in:
@@ -143,6 +143,10 @@ if(isset($get_content) && $get_content!=''){
|
||||
$clause .= ' AND e.serialnumber IN (:'.$v[0].')';
|
||||
}
|
||||
}
|
||||
elseif ($v[0] == 'validate') {
|
||||
// Set validation mode flag
|
||||
$validation_mode = true;
|
||||
}
|
||||
elseif ($v[0] == 'firmware') {
|
||||
//Assets with firmaware upgrade = 0 (1=latest version, 2=No software)
|
||||
$clause .= ' AND e.status != 5 AND e.sw_version_latest = 0';
|
||||
@@ -161,7 +165,7 @@ if(isset($get_content) && $get_content!=''){
|
||||
}
|
||||
}
|
||||
|
||||
if ($sw_version_latest_update == 1){
|
||||
if ($sw_version_latest_update == 1 || $clause == ''){
|
||||
//------------------------------------------
|
||||
//UPDATE SW_STATUS
|
||||
//------------------------------------------
|
||||
@@ -175,6 +179,10 @@ if (isset($criterias['download']) && $criterias['download'] ==''){
|
||||
//Request for download
|
||||
$sql = 'SELECT e.rowID as equipmentID, e.*, p.productcode, p.productname from equipment e LEFT JOIN products p ON e.productrowid = p.rowID '.$whereclause.' ORDER BY equipmentID';
|
||||
}
|
||||
elseif (isset($validation_mode) && $validation_mode === true) {
|
||||
// Validation mode - return count only for serial validation
|
||||
$sql = "SELECT count(rowID) as rowID from equipment e $whereclause";
|
||||
}
|
||||
elseif (isset($criterias['totals']) && $criterias['totals'] =='' && !isset($criterias['type'])){
|
||||
//Request for total rows
|
||||
$sql = 'SELECT count(*) as count from equipment e LEFT JOIN products p ON e.productrowid = p.rowID '.$whereclause.'';
|
||||
@@ -314,7 +322,19 @@ if (debug){
|
||||
//------------------------------------------
|
||||
//Add paging details
|
||||
//------------------------------------------
|
||||
if(isset($criterias['totals']) && $criterias['totals']==''){
|
||||
if (isset($validation_mode) && $validation_mode === true) {
|
||||
$stmt->execute();
|
||||
$messages = $stmt->fetch();
|
||||
|
||||
if ($messages[0] == 1) {
|
||||
echo json_encode(array('SN'=> TRUE));
|
||||
}
|
||||
else {
|
||||
echo json_encode(array('SN'=> FALSE));
|
||||
}
|
||||
return;
|
||||
}
|
||||
elseif(isset($criterias['totals']) && $criterias['totals']==''){
|
||||
$stmt->execute();
|
||||
$messages = $stmt->fetch();
|
||||
$messages = $messages[0];
|
||||
|
||||
Reference in New Issue
Block a user