@php $common = \App\Models\Common::class; $type = 'sell'; $reference_id = $sell_id; if($receipt_id) { $type = 'sell_receipt'; $reference_id = $receipt_id; } if($payment_voucher_id){ $type = 'payment_voucher'; $reference_id = $payment_voucher_id; } $document = \App\Models\DocumentPrint::where('document_name',$document_name)->first(); $document_details = \App\Models\DocumentPrintDetails::where('document_id',$document->id)->get(); $field_bank = $common::getDesignerFieldsBank($reference_id,$type); @endphp @php $background_img = ($document->img_url); $page_size = $document->document_height*96; $page_fields = []; $pages = $pages ?? []; foreach (range(1,$document->no_of_pages) as $page ) { $page_fields[$page] = []; } foreach ($document_details as $key => $document_detail) { $y_coordinate = $document_detail->y_coordinate; $page = floor($y_coordinate / $page_size)+1; $page_fields[$page][] = $document_detail; } if(count($pages) > 0){ foreach($page_fields as $key => $value){ if(!in_array($key , $pages)){ unset($page_fields[$key]); } } } @endphp {{ $title }}
@foreach ($page_fields as $page_number => $fields)
iteration != count($page_fields)) style="page-break-after:always" @endif> @php $img_url = App\Models\VoucherAttachmentDetail::where('reference_id',$document->id)->where('voucher_type','TEMPLATE_DESIGNER_BACKGROUND') ->where('type',$page_number)->first()->file_path ?? null; @endphp @if ($document->show_background_image_on_pdf == 1 && !empty($img_url) && file_exists(public_path($img_url) )) @endif @foreach ($fields as $document_detail) @php $alignment_top = "6"; $alignment_left = "3"; $width = $document_detail->width."px"; $height = $document_detail->height."px"; $y_cordinate = $document_detail->y_coordinate + $alignment_top; $x_cordinate = $document_detail->x_coordinate + $alignment_left; $top = $y_cordinate."px"; if($page_number >1){ $top = $y_cordinate - (($page_number -1)*$page_size) ."px"; } $left = $x_cordinate."px"; $font_size = $document_detail->font_size."px"; $text_align = $document_detail->alignment; $letter_spacing = $document_detail->letter_spacing."px"; $is_bold = $document_detail->is_bold; $is_italic = $document_detail->is_italic; $is_underline = $document_detail->is_underline; $is_uppercase = $document_detail->is_uppercase; $font_family = "Arial, sans-serif"; if($document_detail->letter_spacing > 0){ $font_family = "Courier New, monospace"; } $is_image = strpos($document_detail->name, 'image_') !== false; $is_qr = $is_image && strpos($document_detail->name, 'qr') !== false; $is_barcode = $is_image && strpos($document_detail->name, 'barcode') !== false; $is_content = strpos($document_detail->name, 'content_') !== false; $position = 'absolute'; // if($is_content){ // $position = 'relative'; // } @endphp @if($is_image)
@if($is_qr || $is_barcode || $common::checkRemoteFileExists($field_bank[$document_detail->name]??'')) @endif
@else
{!! $field_bank[$document_detail->name]??'' !!}
@endif @endforeach
@endforeach