* SPDX-License-Identifier: AGPL-3.0-only ************************************/ require_once('include/utils/utils.php'); global $app_strings,$current_user,$theme,$adb,$table_prefix; $image_path = 'themes/'.$theme.'/images/'; $language = VteSession::get('authenticated_user_language'); $pdf_strings = return_module_language($language, "PDFMaker"); $id = $_REQUEST["return_id"]; $sql="SELECT CASE WHEN ".$table_prefix."_products.productid != '' THEN ".$table_prefix."_products.productname ELSE ".$table_prefix."_service.servicename END AS productname, ".$table_prefix."_inventoryproductrel.sequence_no, ".$table_prefix."_inventoryproductrel.productid FROM ".$table_prefix."_inventoryproductrel LEFT JOIN ".$table_prefix."_products ON ".$table_prefix."_products.productid=".$table_prefix."_inventoryproductrel.productid LEFT JOIN ".$table_prefix."_service ON ".$table_prefix."_service.serviceid=".$table_prefix."_inventoryproductrel.productid WHERE id=? order by sequence_no"; $res=$adb->pquery($sql,array($id)); $saved_sql="SELECT productid, sequence, show_header, show_subtotal FROM ".$table_prefix."_pdfmaker_breakline WHERE crmid=?"; $saved_res=$adb->pquery($saved_sql,array($id)); $saved_products=array(); while($saved_row=$adb->fetchByAssoc($saved_res)){ $saved_products[$saved_row["productid"]."_".$saved_row["sequence"]] = $saved_row["sequence"]; $header_checked=""; $subtotal_checked=""; if($saved_row["show_header"]=="1") $header_checked=' checked="checked"'; if($saved_row["show_subtotal"]=="1") $subtotal_checked=' checked="checked"'; } $products=""; $num_rows = $adb->num_rows($res); $checked_no=0; for($i=0;$i<$num_rows;$i++) { $seq=$adb->query_result($res,$i,"sequence_no"); $productid = $adb->query_result($res,$i,"productid"); $checked=""; if(isset($saved_products[$productid."_".$seq])) { $checked=' checked="checked" '; $checked_no++; } $product_name= $adb->query_result($res,$i,"productname"); $products.='