<!doctype html>
<html>
<head>
	<meta charset="utf-8">
	<title>Stock Card</title>
	<link rel="stylesheet" href="<?php echo asset('https://fonts.googleapis.com/css?family=Athiti&display=swap'); ?>">
	<link href="https://fonts.googleapis.com/css?family=Athiti&display=swap" rel="stylesheet">
	<style type="text/css">
		* {
			margin:0;
			padding:0;

			font-size:12px;
		}
		html {

			font-size:12px;
			color:#000000;
		}
		body {

			font-size:12px;
			padding:0;
			margin:0;
			color:#000000;
			padding-left: 5px;
		}
		.headTitle {
			font-size:12px;
			font-weight:bold;
			text-transform:uppercase;
		}
		.headerTitle01 {
			border:1px solid #333333;
			border-bottom-width:1px;
			border-top-width:1px;
			font-size:11px;
		}
		.headerTitle01_r {
			border:1px solid #333333;
			border-left:1px solid #000;
			border-right:1px solid #000;
			border-bottom-width:1px;
			border-top-width:1px;
			font-size:11px;
		}
		/* สำหรับช่องกรอกข้อมูล  */
		.box_data1 {
			
			height:18px;
			border:0px dotted #333333;
			border-bottom-width:1px;
		}
		/* กำหนดเส้นบรรทัดซ้าย  และด้านล่าง */
		.left_bottom {
			border-left:1px solid #000;
			border-bottom:1px solid #000;
		}
		/* กำหนดเส้นบรรทัดซ้าย ขวา และด้านล่าง */
		.left_right_bottom {
			border-left:1px solid #000;
			border-bottom:1px solid #000;
			border-right:1px solid #000;
		}
		/* สร้างช่องสี่เหลี่ยมสำหรับเช็คเลือก */
		.chk_box {
			display:block;
			width:10px;
			height:10px;
			overflow:hidden;
			border:1px solid #000;
		}
		/* This is what simulates a checkmark icon */
		.checkbox.checked:after {
			content: '';
			display: block;
			width: 4px;
			height: 7px;
			border:1px solid #000;

			/* "Center" the checkmark */
			position:relative;


			border: solid #000;
			border-width: 0 2px 2px 0;
			transform: rotate(45deg);
		}
		/* css ส่วนสำหรับการแบ่งหน้าข้อมูลสำหรับการพิมพ์ */
		@media  all
		{
			.page-break { display:none; }
			.page-break-no{ display:none; }
		}
		@media  print
		{
			.page-break { display:block;height:1px; page-break-before:always; }
			.page-break-no{ display:block;height:1px; page-break-after:avoid; } 
		}
		@page
		{
			size: landscape;
			margin-bottom: 0;
			margin-top: 0;
		}
	</style>
</head>

<body  style=" font-family: 'Athiti', sans-serif; padding-top: 60px" onload="window.print();">

	<?php

	function m2t($number){
	$number = number_format($number, 2, '.', '');
	$numberx = $number;
	$txtnum1 = array('ศูนย์','หนึ่ง','สอง','สาม','สี่','ห้า','หก','เจ็ด','แปด','เก้า','สิบ'); 
	$txtnum2 = array('','สิบ','ร้อย','พัน','หมื่น','แสน','ล้าน','สิบ','ร้อย','พัน','หมื่น','แสน','ล้าน'); 
	$number = str_replace(",","",$number); 
	$number = str_replace(" ","",$number); 
	$number = str_replace("บาท","",$number); 
	$number = explode(".",$number); 
	if(sizeof($number)>2){ 
	return 'ทศนิยมหลายตัวนะจ๊ะ'; 
	exit; 
} 
$strlen = strlen($number[0]); 
$convert = ''; 
for($i=0;$i<$strlen;$i++){ 
$n = substr($number[0], $i,1); 
if($n!=0){ 
if($i==($strlen-1) AND $n==1){ $convert .= 'เอ็ด'; } 
elseif($i==($strlen-2) AND $n==2){  $convert .= 'ยี่'; } 
elseif($i==($strlen-2) AND $n==1){ $convert .= ''; } 
else{ $convert .= $txtnum1[$n]; } 
$convert .= $txtnum2[$strlen-$i-1]; 
} 
} 

$convert .= 'บาท'; 
if($number[1]=='0' OR $number[1]=='00' OR 
$number[1]==''){ 
$convert .= 'ถ้วน'; 
}else{ 
$strlen = strlen($number[1]); 
for($i=0;$i<$strlen;$i++){ 
$n = substr($number[1], $i,1); 
if($n!=0){ 
if($i==($strlen-1) AND $n==1){$convert 
.= 'เอ็ด';} 
elseif($i==($strlen-2) AND 
$n==2){$convert .= 'ยี่';} 
elseif($i==($strlen-2) AND 
$n==1){$convert .= '';} 
else{ $convert .= $txtnum1[$n];} 
$convert .= $txtnum2[$strlen-$i-1]; 
} 
} 
$convert .= 'สตางค์'; 
}
//แก้ต่ำกว่า 1 บาท ให้แสดงคำว่าศูนย์ แก้ ศูนย์บาท
if($numberx < 1)
{
	$convert = "ศูนย์" .  $convert;
}

//แก้เอ็ดสตางค์
$len = strlen($numberx);
$lendot1 = $len - 2;
$lendot2 = $len - 1;
if(($numberx[$lendot1] == 0) && ($numberx[$lendot2] == 1))
{
	$convert = substr($convert,0,-10);
	$convert = $convert . "หนึ่งสตางค์";
}

//แก้เอ็ดบาท สำหรับค่า 1-1.99
if($numberx >= 1)
{
	if($numberx < 2)
	{
		$convert = substr($convert,4);
		$convert = "หนึ่ง" .  $convert;
	}
}
return $convert; 
}

function DateThai($strDate)
{
	$strYear = date("Y",strtotime($strDate))+543;
	$strMonth= date("n",strtotime($strDate));
	$strWeek= date("w",strtotime($strDate));
	$strDay= date("j",strtotime($strDate));
	$strMonthCut = Array("","มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม");
	$thai_day_arr = Array("อา","จ","อ","พ","พฤ","ศ","ส");
	$strMonthThai=$strMonthCut[$strMonth];
	$strWeekThai=$thai_day_arr[$strWeek];
	return "$strDay $strMonthThai $strYear";
}


function Numphon($strNum)
{
	
	$n3 = substr($strNum,6,4);
	$n2 = substr($strNum,3,3);
	$n1 = substr($strNum,0,3);
	$nump = $n1."-".$n2."-".$n3;
	return "$nump";
}

?>

<div class="page-break">&nbsp;</div>
<table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
	<tr>
		<td align="left"></td>
	</tr>
	<tr>
		<td align="left" class="headTitle" style="font-size:18px;">รายงานข้อมูลสต๊อกการ์ด</td>
	</tr>
	<tr>
		<td align="left"  style="font-size:14px; ">บริษัท เนเจอร์ พลัส (ประเทศไทย) จำกัด</td>
	</tr>
	<tr>
		<td align="left"  style="font-size:14px; ">ประจำปี 2562 </td>
	</tr>


	<tr>
		<td align="left"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
			<tr>		
			</tr>
			<tr>
				<td align="left"style="font-size:14px;">ผู้สั่งพิมพ์: <?php echo e(Cookie::get('name')); ?></td>
				<td align="right"><table width="300" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td align="right" style="font-size:14px;"> </td>
					</td>
				</tr>
			</table></td>
		</tr>
	</table></td>
</tr>


<tr>
	<td>&nbsp;</td>
</tr>
<tr>
	<td align="left">
		<?php
		$totalqt = 0;
		$qq1 = "";
		$qq2 = "";
		$first = true;
		$numnewpage = 0;
		$AmountRec = 0;
		$AmountRecAll =0;
		$idlot  = null;
		$row = 1;
		$rowpage = 30;
		?>
		<?php $__currentLoopData = $m; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $v): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
		<?php if($numnewpage%$rowpage == 0): ?>
		<?php if(!$first): ?>
		<tr>
			<td align="left">&nbsp;</td>
			<td align="left">&nbsp;</td>
		</tr>
		<tr>
			<td align="left">&nbsp;</td>
			<td align="left">&nbsp;</td>
		</tr>
		<tr>
			<td align="left">&nbsp;</td>
			<td align="left">&nbsp;</td>
		</tr>
		<tr>
			<td align="left">&nbsp;</td>
			<td align="left">&nbsp;</td>
		</tr>
		<tr>
			<td align="left">&nbsp;</td>
			<td align="left">&nbsp;</td>
		</tr>
		<tr>
			<td align="left">&nbsp;</td>
			<td align="left">&nbsp;</td>
		</tr>
		<tr>
			<td align="left">&nbsp;</td>
			<td align="left">&nbsp;</td>
		</tr>
	
	</table>
	<?php endif; ?>
	<table width="1024" border="0" align="left" cellpadding="0" cellspacing="0">

		<tr>
			<td width="20" rowspan="2" class="headerTitle01"  align="center" valign="middle">ลำดับ</td>
			<td width="540" rowspan="2" class="headerTitle01"    align="center" valign="middle">รายการสินค้า</td>
			<td width="130" rowspan="2" class="headerTitle01"    align="center" valign="middle">รับเข้า</td>
			<td width="100" rowspan="2" class="headerTitle01"   align="center" valign="middle">เบิกออก</td>
			<td width="100" rowspan="2" class="headerTitle01"    align="center" valign="middle">คงเหลือ</td>
			<td width="100" colspan="2" class="headerTitle01"    align="center" valign="bottom">วันที่</td>
		</tr>
		<tr>	

		</tr>
		
		<?php endif; ?>

		<?php if($idlot != $v->idlot): ?>
		<tr>
			<td height="20" align="center" ><?php echo e($row++); ?> .</td>
			<td height="20" align="left" ><h6 >LOT-NUMBER: <?php echo e($v->lotnum); ?> :: <?php echo e($v->PdName); ?></h6></td>	
			<?php
			$totalqt = 0;
			?>

		</tr>
	<?php
	$numnewpage++;
	?>
	<?php endif; ?>
	<?php
	  if($v->status == "IN"){ $totalqt += $v->quantity;$qq1 = $v->quantity;$qq2 = 0; $text1 = "รับเข้าคลัง";}else{$totalqt -= $v->quantity;$qq1 = 0;$qq2 = $v->quantity;$text1 = "ขายจาก ".$v->DocCode." ".$v->CusName." ".$v->LastName;}
	?>
	<tr>
		<td height="" align="center" class=""></td>
		<td align="left" class="">&nbsp;รายการ : <?php echo e($text1); ?> </td>
		<td align="center" class="" style="padding-right: 3px;">&nbsp; <?php echo e(number_format($qq1)); ?> </td>
		<td align="center" class="">&nbsp; <?php echo e(number_format($qq2)); ?></td>
		<td align="center" class="" style="padding-right: 3px;">&nbsp;<?php echo e(number_format($totalqt)); ?></td>
		<td align="right" colspan="2" class="" style="padding-right: 3px;">&nbsp;<?php echo e(DateThai($v->date)); ?>  </td>
	</tr>
	<?php
	
	$numnewpage++;
	$first = false;
	$idlot = $v->idlot;
	?>
	<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
	<tr>
		<td align="left">&nbsp;</td>
	</tr>
	<tr>
		<td width="20"  class="headerTitle01"  align="center" valign="middle"></td>
		<td width="540"  class="headerTitle01"    align="center" valign="middle"></td>
		<td width="130"  class="headerTitle01"    align="center" valign="middle"></td>
		<td width="100"  class="headerTitle01"   align="center" valign="middle"></td>
		<td width="100" class="headerTitle01"    align="center" valign="middle"></td>
		<td width="100"  class="headerTitle01"    align="center" valign="bottom"></td>
	</tr>
	<!-- <tr>
		<td colspan="4">

		</td>
		<td align="right" style="padding-right: 4px">ยอดขาย
		</td>
		<td height="20" colspan="2" align="right" class="left_right_bottom" style="padding-right: 3px;">&nbsp; </td>


	</tr>
	<tr>
		<td colspan="4" align="left" style="">

		</td>
		<td align="right" style="padding-right: 4px"> ส่วนลดจากโปรโมชั่น
		</td>
		<td height="20" colspan="2" align="right" class="left_right_bottom" style="padding-right: 3px;">&nbsp; </td>


	</tr>
	<tr>
		<td colspan="4">

		</td>
		<td align="right" style="padding-right: 4px">รวมเป็นเงิน
		</td>
		<td height="20" colspan="2" align="right" class="left_right_bottom" style="padding-right: 3px;">&nbsp; <h5></h5></td>


	</tr> -->
</table></td>
</tr>



<tr>
	<td align="left">&nbsp;</td>
</tr>

</table>
</body>
</html><?php /**PATH /home/cp325668/public_html/erp/resources/views/stock/pdfStockCard.blade.php ENDPATH**/ ?>