File: //proc/thread-self/cwd/pm/plugins/Manufacturing/Views/products/barcode_pdf.php
<style type="text/css">
.font_td_cpn{
font-weight: 500;
width: 30%;
}
.td_ali_font{
text-align: center;
font-weight: 500;
}
.h2_style{
font-size: 35px;
margin-top: 20px;
margin-bottom: 10px;
}
.align_cen{
text-align: center;
}
.font_500{
font-weight: 500;
}
.th_width_7{
border:1px solid black;
font-weight: bold;
font-size: 11px;
}
.th_style{
border:1px solid black;
font-size: 10px;
}
.th_width_25{
border:1px solid black;
width: 25%;
}
.th_width_20{
border:1px solid black;
width: 20%;
}
.th_width_10{
border:1px solid black;
width: 10%;
}
.th_width_17{
border:1px solid black;
width: 17%;
}
.th_spe{
text-align:center !important;
border:1px solid black;
width: 20%;
}
.th_width_15{
border:1px solid black;
width: 15%;
}
.td_style_r{
text-align: right;
border:1px solid black;
font-size: 10px;
}
.width_27{
width: 27%;
}
.fw_width35{
font-weight: 500; width: 35%;
}
.fw_width30{
font-weight: 500; width: 30%;
}
.ali_r_width30{
text-align: right; width: 30%;
}
.fstyle{
font-style: italic;
}
.width{
width: 21%;
}
.th_style_stk{
text-align:center;
border-top:1px solid black;
border-left:1px solid black;
border-bottom:1px solid black;
font-weight:bold;width: 5%;
}
.th_stk10{
text-align:center;
border-top:1px solid black;
border-left:1px solid black;
border-bottom:1px solid black;
font-weight:bold;
width: 10%;
}
.th_stk7{
text-align:center;
border-top:1px solid black;
border-left:1px solid black;
border-bottom:1px solid black;
font-weight:bold;width: 7%;
}
.th_stk17{
text-align:center;
border-top:1px solid black;
border-left:1px solid black;
border-bottom:1px solid black;
font-weight:bold;width: 17%;
}
.th_r_stk17{
text-align:center;
border-top:1px solid black;
border-left:1px solid black;
border-bottom:1px solid black;
border-right:1px solid black;
font-weight:bold;width: 17%;"
}
.td_w5{
border-left:1px solid black;
border-bottom:1px solid black;
width: 5%;
}
.td_w10{
border-left:1px solid black;
border-bottom:1px solid black;
width: 10%;
}
.td_stk_w7{
border-left:1px solid black;
border-bottom:1px solid black;
width: 7%;"
}
.td_stkw5{
border-left:1px solid black;
border-bottom:1px solid black;
font-weight:bold;width: 5%;
font-size:11px;
text-align:center;
}
.td_stkw12{
border-left:1px solid black;
border-bottom:1px solid black;
font-weight:bold;width: 12%;
font-size:11px;
text-align:center;
}
.td_stkw12s{
border-left:1px solid black;
border-bottom:1px solid black;
border-right:1px solid black;
font-weight:bold;width: 12%;
font-size:11px;
text-align:center;
}
.border_td{
border-left:1px solid black;
border-bottom:1px solid black;
}
.bor_alir{
text-align: right;
border-left:1px solid black;
border-bottom:1px solid black;
}
.bor_r{
text-align: right;
border-left:1px solid black;
border-bottom:1px solid black;
border-right:1px solid black;
}
.th_stk_style{
text-align: right;
border-left:1px solid black;
border-bottom:1px solid black;
font-weight:bold;
}
.th_st_spe{
text-align: right;
border-left:1px solid black;
border-bottom:1px solid black;
border-right:1px solid black;
font-weight:bold;"
}
.wf60{
width: 60%;
font-style: italic;
}
.width60{
width: 60%;
}
.width40{
width: 40%;
}
.td_text{
text-align:center;
border:1px solid black;
font-weight:bold;
}
.border_1{
border:1px solid black;
}
.td_text_r{
text-align:right;
border:1px solid black;
font-weight:bold;
}
.div_disp{
display:flex;
justify-content:flex-end;
}
.th_border_17{
border:1px solid black;
font-size: 11px;
}
.font_td_cpn{
font-weight: 500;width: 40%;
}
img {
width: auto;
height: 34px;
margin-top: 3px;
}
.text_right{
text-align:right;
}
.text_right_weight{
font-weight: 500;
text-align:right;
}
.thead-dark {
background-color: #2d2d2d;
color: #fff;
font-weight: 500;
}
.th_border_ep{
border:1px solid black;
font-size: 13px;
}
.td_style_r_ep{
text-align: right;
font-size: 13px;
}
.td_style_r_ep_c{
text-align: center;
font-size: 13px;
}
.bill_to_color{
color:#424242;
}
.thead-dark-ip {
background-color: #2d2d2d;
color: #fff;
font-weight: 500;
font-size: 14px;
}
.note-align {
text-align: justify;
}
span.print-item {
padding: 0px 70px;
}
span.print-item-code {
padding: 0px 70px;
margin-top: -12px;
}
span.print-item-name {
font-size: 11px;
font-weight: bold;
}
span.print-item-price {
padding: 0px 70px;
margin-top: -8px;
font-size: 12px;
font-weight: bold;
margin-bottom: 3px;
}
span.print-barcode-td-height{
height: 50px;
}
.row.row-print-item {
padding: 50px 0px;
}
.row.row-print-item {
display: flex;
}
.column {
float: left;
width: 20%;
padding: 10px;
height: 300px; /* Should be removed. Only for demonstration */
margin:0px 10px;
}
.width-20{
width: 23%;
}
.width-2{
width: 2%;
}
.line-height-10{
line-height: 10px;
height: 10px;
}
</style>
<div>
<?php
$display_product_name = get_setting('display_product_name_when_print_barcode');
$html ='';
?>
<table class="header-style">
<?php if((int)$select_item == 0){ ?>
<!-- print all items -->
<?php
$Warehouse_model = model("Warehouse\Models\Warehouse_model");
$array_commodity = $Warehouse_model->get_commodity(false, get_db_prefix().'items.id not in ( SELECT distinct parent_id from '.get_db_prefix().'items WHERE parent_id is not null AND parent_id != "0" )');
$html_child='';
$br_tem=1;
?>
<?php
foreach ($array_commodity as $key => $value) {
if($value['commodity_barcode'] != ''){
if(!file_exists(WAREHOUSE_PRINT_ITEM. md5($value['commodity_barcode']).'.svg')){
$Warehouse_model->getBarcode($value['commodity_barcode']);
}
}
/*get frist 25 character */
if(strlen($value['title']) > 30){
$pos=strpos($value['title'], ' ', 30);
$description = substr($value['title'],0, 30 );
}else{
$description = $value['title'];
}
/*get frist 100 character */
$description_sub = nl2br(mrp_convert_accented_characters($value['description']));
if(strlen($description_sub) > 30){
$pos=strpos($description_sub, ' ', 30);
$description_sub = substr($description_sub,0, 30 );
}else{
$description_sub = $description_sub;
}
$description_sub = strip_tags($description_sub, []);
//final price: price*Vat
$tax_value=0;
if($value['tax'] != 0 && $value['tax'] != ''){
$tax_rate = get_tax_rate($value['tax']);
if(!is_array($tax_rate) && isset($tax_rate)){
$tax_value = $tax_rate->percentage;
}
}
$rate_after_tax = (float)$value['rate'] + (float)$value['rate']*$tax_value/100;
$barcode_path = '/plugins/Warehouse/Uploads/print_item/'. md5($value['commodity_barcode']).'.svg';
?>
<?php if($value['commodity_barcode'] != ''){ ?>
<?php if($display_product_name == 1){ ?>
<?php
$html_child .= '<td class="print-barcode-td-height width-20"><span class="print-item-code print-item-name">'.$description.'</span><br><span class="print-item-code print-item-name">'.$description_sub.'</span><br><span class=" print-item-price">'._l('print_barcode_sale_price').': '.to_currency($rate_after_tax).'</span><br/><span class="print-item"><img class="images_w_table" src="' . $barcode_path . '" alt="' . $value['commodity_barcode'] . '" ></span><br/><span class="print-item-code">'.$value['commodity_barcode'].'</span></td><td class="print-barcode-td-height width-2"></td>';
?>
<?php }else{
$html_child .= '<td class="print-barcode-td-height width-20"><span class="print-item-code print-item-name"></span><br><span class="print-item-code print-item-name">'.$description.'</span><br><span class=" print-item-price">'._l('print_barcode_sale_price').': '.to_currency($rate_after_tax).'</span><br/><span class="print-item"><img class="images_w_table" src="' . $barcode_path . '" alt="' . $value['commodity_barcode'] . '" ></span><br/><span class="print-item-code">'.$value['commodity_barcode'].'</span></td><td class="print-barcode-td-height width-2"></td>';
} ?>
<?php }else{ ?>
<?php if($display_product_name == 1){
$html_child .= '<td class="print-barcode-td-height width-20"><span class="print-item-code print-item-name">'.$description.'</span><br><span class="print-item-code print-item-name">'.$description_sub.'</span><br><span class=" print-item-price">'._l('print_barcode_sale_price').': '.to_currency($rate_after_tax).'</span><br/><span class="print-item"><img class="images_w_table" src="" alt="' . $value['commodity_barcode'] . '" ></span><br/><span class="print-item-code">'._l('the_product_has_no_barcode').'</span></td><td class="print-barcode-td-height width-2"></td>';
}else{
$html_child .= '<td class="print-barcode-td-height width-20"><span class="print-item-code print-item-name"></span><br><span class="print-item-code print-item-name">'.$description.'</span><br><span class=" print-item-price">'._l('print_barcode_sale_price').': '.to_currency($rate_after_tax).'</span><br/><span class="print-item"><img class="images_w_table" src="" alt="' . $value['commodity_barcode'] . '" ></span><br/><span class="print-item-code">'._l('the_product_has_no_barcode').'</span></td><td class="print-barcode-td-height width-2"></td>';
} ?>
<?php } ?>
<?php
if(($key+1)%4 == 0 ){
$html .= '<tr>'.$html_child.'</tr><tr>
<td><div class="line-height-10"></div></td>
<td></td>
<td></td>
<td></td>
</tr>';
if($br_tem%36 == 0){
$html .= '<br>';
}
$html_child='';
}elseif(($key+1)%4 != 0 && ($key+1 == count($array_commodity))){
$html .= '<tr>'.$html_child.'</tr>';
if($br_tem%36 == 0){
$html .= '<br>';
}
$html_child='';
}
$br_tem++;
?>
<?php } ?>
<?php }else{
//select item check
if( count($item_select_print_barcode) > 0){
$Warehouse_model = model("Warehouse\Models\Warehouse_model");
$sql_where ='select * from '.db_prefix().'items where id IN ('.implode(", ", $item_select_print_barcode).') order by id desc';
$array_commodity = $Warehouse_model->warehouse_run_query($sql_where);
$html_child='';
$br_tem=1;
foreach ($array_commodity as $key => $value) {
if($value['commodity_barcode'] != ''){
if(!file_exists(base_url('plugins/Warehouse/Uploads/print_item/'. md5($value['commodity_barcode']).'.svg'))){
$Warehouse_model->getBarcode($value['commodity_barcode']);
}
}
/*get frist 100 character */
if(strlen($value['title']) > 30){
$description = substr($value['title'],0, 30 );
}else{
$description = $value['title'];
}
/*get frist 100 character */
$description_sub = nl2br(mrp_convert_accented_characters($value['description']));
if(strlen($description_sub) > 30){
$pos=strpos($description_sub, ' ', 30);
$description_sub = substr($description_sub,0, 30 );
}else{
$description_sub = $description_sub;
}
$description_sub = strip_tags($description_sub, []);
//final price: price*Vat
$tax_value=0;
if($value['tax'] != 0 && $value['tax'] != ''){
$tax_rate = get_tax_rate($value['tax']);
if(!is_array($tax_rate) && isset($tax_rate)){
$tax_value = $tax_rate->percentage;
}
}
$rate_after_tax = (float)$value['rate'] + (float)$value['rate']*$tax_value/100;
$barcode_path = '/plugins/Warehouse/Uploads/print_item/'. md5($value['commodity_barcode']).'.svg';
if($value['commodity_barcode'] != ''){
if($display_product_name == 1){
$html_child .= '<td><span class="print-item-code print-item-name">'.$description.'</span><br><span class="print-item-code print-item-name ">'.$description_sub.'</span><br><span class=" print-item-price">'._l('print_barcode_sale_price').': '.to_currency($rate_after_tax).'</span><br/><span class="print-item"><img class="images_w_table" src="' . $barcode_path . '" alt="' . $value['commodity_barcode'] . '" ></span><br/><span class="print-item-code">'.$value['commodity_barcode'].'</span></td><td class="print-barcode-td-height width-2"></td>';
}else{
$html_child .= '<td><span class="print-item-code print-item-name "></span><br><span class="print-item-code print-item-name">'.$description.'</span><br><span class=" print-item-price">'._l('print_barcode_sale_price').': '.to_currency($rate_after_tax).'</span><br/><span class="print-item"><img class="images_w_table" src="' . $barcode_path . '" alt="' . $value['commodity_barcode'] . '" ></span><br/><span class="print-item-code">'.$value['commodity_barcode'].'</span></td><td class="print-barcode-td-height width-2"></td>';
}
}else{
if($display_product_name == 1){
$html_child .= '<td><span class="print-item-code print-item-name">'.$description.'</span><br><span class="print-item-code print-item-name ">'.$description_sub.'</span><br><span class=" print-item-price">'._l('print_barcode_sale_price').': '.to_currency($rate_after_tax).'</span><br/><span class="print-item"><img class="images_w_table" src="" alt="' . $value['commodity_barcode'] . '" ></span><br/><span class="print-item-code">'._l('the_product_has_no_barcode').'</span></td><td class="print-barcode-td-height width-2"></td>';
}else{
$html_child .= '<td><span class="print-item-code print-item-name "></span><br><span class="print-item-code print-item-name">'.$description.'</span><br><span class=" print-item-price">'._l('print_barcode_sale_price').': '.to_currency($rate_after_tax).'</span><br/><span class="print-item"><img class="images_w_table" src="" alt="' . $value['commodity_barcode'] . '" ></span><br/><span class="print-item-code">'._l('the_product_has_no_barcode').'</span></td><td class="print-barcode-td-height width-2"></td>';
}
}
if(($key+1)%4 == 0 ){
$html .= '<tr>'.$html_child.'</tr>';
if($br_tem%36 == 0){
$html .= '<br>';
}
$html_child='';
}elseif(($key+1)%4 != 0 && ($key+1 == count($array_commodity))){
$html .= '<tr>'.$html_child.'</tr>';
if($br_tem%36 == 0){
$html .= '<br>';
}
$html_child='';
}
$br_tem++;
}
}
} ?>
<?php echo html_entity_decode($html); ?>
</table>
</div>