<style type="text/css">
    .sambox{
        display:none;
    }
    .amount{
        text-align: right;
    }

    .quantity {
        text-align: center;
    }

    .btn-group button {
        height:30px; }

    #content .wrap #grid_content_1 .row-fluid.scRow .row-fluid.scRow .span12.scCol #grid_block_5 .content.np #listDetails tbody #trInfos td .row-fluid .controls-row .span3 {
        font-size: 11px;
        color: #000;
        font-weight: bold;
    }
    .test {
        font-size: 10px;
    }
    .span3 {
        font-size: 10px;
    }
    tbody {
        font-size: 10px;
    }
    #content .wrap #grid_content_1 .row-fluid.scRow .row-fluid.scRow .span12.scCol #grid_block_6 .content.np #listCharge tbody #trInfosCharge td .row-fluid .controls-row .span3 {
        font-weight: bold;
    }
</style>

<script type="application/javascript">
$(document).ready(function() {
	$('select').select2();
	jQuery('.datepicker2').datepicker({
			dateFormat : 'dd-mm-yy',
			changeMonth : true,
			changeYear : true
			});


	selectshipto($('#customerID'));
});
function selectshipto(obj){
		var customerID = obj.val();
		var effdate = $("#effdate").val();
//		alert(year);
			postData = {
				customerID : customerID,
				effdate : effdate
			};
			$.ajax({
  				type: "POST",
	  			dataType: "json",
				url: "<?php echo base_url()?>sotransaction/shipto",
				data: postData,
	  			async: false,
  				success: function(content){
					if(content.status == "success") {
					var items = [];
					//items.push('<option>-Please Select-</option>');
					for ( var i = 0; i < content.message.length; i++) {
					items.push('<option value="'+content.message[i].ID+'">'
						+ content.message[i].addressCode + ' [ ' +content.message[i].addressName + ' ]</option>');
					}  //end for
					jQuery("#deliveryToID").empty();
					jQuery("#deliveryToID").append(items.join('</br>'));
					$('#deliveryToID').select2('val','<?php echo $headerSO->deliveryToID; ?>');
				} else {
					$("#error").html('<p>'+content.message+'</p>');
				} //end if
					$('#currencyID').val(content.message1.currencyID).change();
					$('#exchangeRate').val(parseFloat(content.exchangeRate).toFixed(5));
			} //end success
				
			}); //end ajax

}
function addRow(){
var rowCount = document.getElementById('oTable').rows.length - 1 ;
var rowArrayId = rowCount ;
var toBeAdded = 1;
if (toBeAdded=='')
    { toBeAdded = 2; }	
else if(toBeAdded>100)
{
  toBeAdded = 100;
}
  for (var i = 1; i <= toBeAdded; i++) {
    var rowToInsert = '';
    rowToInsert = "<td class='span2'><select id='itemID' style='width: 200px;' onChange='selectDesc(this)'></select></td>";
    rowToInsertUM = "<td id='unitOfMeasureID' class='span1'><input type='text' placeholder='UM' /></td>";
	rowDaterequired = "<td class='span1 tar'><input type='text' name='requiredDate' class='input-mini datepicker2 financhk' value='<?php echo date("d-m-Y")?>'/></td>";
    $("#oTable tbody").append(
		"<tr><td style='display:none'></td>" +
		rowToInsert +
        "<td class='span5'><input type='text' name='description' class='span12 description'/>"+
        rowDaterequired +
        rowToInsertUM +
        "<td class='span1 tar'><input type='text' name='unitprice' class='span12 validate[custom[integer]] tar' onBlur='calculate_amount(this)'/></td>"+
        "<td class='span1 tar'><input type='text' name='qtyOrd' class='span12 validate[custom[integer]] tar' onBlur='calculate_amount(this)' value='0' /></td>"+
        "<td class='span1 tar'><input type='text' name='amount' class='span12 validate[custom[integer]] tar' disabled/></td>"+
        "<td class='tac'>" + 
		"<button class='btn-icon btn-mini btn-success-form' title='<?php echo $this->lang->line('save') ?>' onClick='saveDetails(this)'><span class='i-checkmark-3'></button><button class='btn-icon btn-mini btn-danger-form remove' title='<?php echo $this->lang->line('cancel') ?>' onClick='cancelRow(this)'><span class='i-cross'></button></td>"+
        "</tr>");

//	$('select').select2();
	rowArrayId = rowArrayId + 1;
  }
  selectoption(toBeAdded);
  //selectUnitmeasure();
	$('select').select2({
		placeholder: 'Please',
	});
	jQuery('.datepicker2').datepicker({
			dateFormat : 'dd-mm-yy',
			changeMonth : true,
			changeYear : true
			});
	$("#addLine").hide(); 
	$("#mysubmit").show(); 
//	$("#savedetails").show(); 
}

function unitofmesure(){
	$.ajax({
		type: "POST",
        data : {
            option :'sale',
            itemID : $("#itemID").select2('val'),
            datePrice : $("#effdate").val(),
            customerID : $("#customerID").select2('val')
        },
        url: "<?php echo base_url() ?>aptransaction/getUmList",
        dataType:'JSON',
		success: function(data){
			var option = '<option value="'+data['items'][0].unitOfMeasureID+'" >'+data['items'][0].umCode+'</option>';
            if(data['umConv']){
                for(i = 0; i<data['umConv'].length; i++){
                    option += '<option value="'+data['umConv'][i].from_um+'">'+data['umConv'][i].fromCode+'</option>';
                }
            }
            $('#unitOfMeasureID').text('').append('<select class="umIDlist span12">'+
                                    option+
                                    '</select>');
            $('#unitOfMeasureID select').select2();	
		}
	});
}

function selectoption(toBeAdded){
//	var numrows = $("#numberofrows").val();
//	var tablerows = $("#oTable > tbody >tr").length;
//	var startrows = parseInt($("#oTable > tbody >tr").length) - numrows;
		$.ajax({
			type: "POST",
        	url: '<?php echo base_url();?>sotransaction/itemSearch',
			dataType:"json",
			success: function(content){
				if(content.status == "success") {
					var items = [];
					items.push('<option value=""><?php echo $this->lang->line('pleaseselect')?></option>');
					for ( var i = 0; i < content.message.length; i++) {
					items.push('<option value="'+content.message[i].ID+'">'
						+ content.message[i].itemCode + ' [ '+ content.message[i].name + ' ]</option>');
					}
//					for (var x = startrows; x < tablerows ; x++) {
 						var rowId = "#itemID";
						jQuery(rowId).empty();
						jQuery(rowId).append(items.join('</br>'));
//					}
				} else {
					$("#error").html('<p>'+content.message+'</p>');
				}
					return false;
			}
		});
}
function selectCustomer(){
		$.ajax({
			type: "POST",
        	url: '<?php echo base_url();?>sotransaction/customerSearch',
			dataType:"json",
			success: function(content){
				if(content.status == "success") {
					var items = [];
//					items.push('<option value=""><?php echo $this->lang->line('pleaseselect')?></option>');
					for ( var i = 0; i < content.message.length; i++) {
					items.push('<option value="'+content.message[i].ID+'">'
//						+ content.message[i].code + ' [ '+ content.message[i].desc + ' ]</option>');
						+ content.message[i].customerName + ' [ ' + content.message[i].accountCode + ' ]</option>');
					}
//					for (var x = startrows; x < tablerows ; x++) {
 						var rowId = "#customerID";
						jQuery(rowId).empty();
						jQuery(rowId).append(items.join('</br>'));
//					}
				} else {
					$("#error").html('<p>'+content.message+'</p>');
				}
					return false;
			}
		});
}

function selectUnitmeasure(){
		$.ajax({
			type: "POST",
        	url: '<?php echo base_url();?>sotransaction/umSearch',
			dataType:"json",
			success: function(content){
				if(content.status == "success") {
					var items = [];
//					items.push('<option value=""><?php echo $this->lang->line('pleaseselect')?></option>');
					for ( var i = 0; i < content.message.length; i++) {
					items.push('<option value="'+content.message[i].fldid+'">'
//						+ content.message[i].code + ' [ '+ content.message[i].desc + ' ]</option>');
						+ content.message[i].code + '</option>');
					}
//					for (var x = startrows; x < tablerows ; x++) {
 						var rowId = "#unitOfMeasureID";
						jQuery(rowId).empty();
						jQuery(rowId).append(items.join('</br>'));
//					}
				} else {
					$("#error").html('<p>'+content.message+'</p>');
				}
					return false;
			}
		});
}
function selectDesc(obj){
    var eRow   = $(this).parents('tr');
	var ID = obj.value;
	var customerID = $("#customerID option:selected").val();
	var currencyID = $("#currencyID option:selected").val();
	var effdate = $("#effdate").val();
	postData = {
		ID : ID,
		customerID : customerID,
		currencyID : currencyID,
		effdate : effdate
	};
	
		$.ajax({
			type: "POST",
        	url: '<?php echo base_url();?>sotransaction/itemSearch2',
			dataType:"json",
			data: postData,
	  				async: false,
			success: function(content){
				unitofmesure(obj);
				if(content.status == "success") {
					$('td:eq(2)', $(obj).parents('tr')).find("input").val(content.message.description);
 					$('td:eq(5)', $(obj).parents('tr')).find("input").val(content.price);
 					$('#unitOfMeasureID').val(content.message.unitOfMeasureID).change();
				}
			}
		});

}
function saveDetails(obj){
    var eRow   = $(obj).parents('tr');
	var customerID = $("#customerID option:selected").val();
	if(customerID == 0){
		alert("<?php echo $this->lang->line('msj_custID')?>");
		$('#customerID').focus();
		return;
	}else{
		var itemID = $('td:eq(1) option:selected', $(obj).parents('tr')).val();
		if(itemID == 0){
			alert("<?php echo $this->lang->line('msj_itemID')?>");
			$('td:eq(1)', $(obj).parents('tr')).focus();
			return;
		}else{
			var amount = $('td:eq(7)', $(obj).parents('tr')).find("input").val();
			if(amount == 0){
				alert("<?php echo $this->lang->line('msj_totalamount')?>");
				$('td:eq(5)', $(obj).parents('tr')).focus();
				return;
			}else if(amount == ''){
				alert("<?php echo $this->lang->line('msj_totalamount')?>");
				$('td:eq(5)', $(obj).parents('tr')).focus();
				return;
			}else{
				var OrderNo = $("#OrderNo").val();
				var ID = $("#ID").val();
				var effdate = $("#effdate").val();
				var exchangeRate = $("#exchangeRate").val();
				var memo = $("#memo").val();
				var totalAmount = accounting.unformat($("#totalAmount").val()) + accounting.unformat(amount);
				var currencyID = $("#currencyID option:selected").val();
				var salesPerson = $("#salesPerson option:selected").val();
				var deliveryToID = $("#deliveryToID option:selected").val();
				var description = $('td:eq(2)', $(obj).parents('tr')).find("input").val();
				var requiredDate = $('td:eq(3)', $(obj).parents('tr')).find("input").val();
				var unitmeasure = $('td:eq(4) option:selected', $(obj).parents('tr')).val();
				var unitPrice = $('td:eq(5)', $(obj).parents('tr')).find("input").val();
				var ordQty = $('td:eq(6)', $(obj).parents('tr')).find("input").val();
//				alert('2');
				postData = {
					customerID : customerID,
					ID : ID,
					currencyID : currencyID,
					effdate : effdate,
					memo : memo,
					deliveryToID : deliveryToID,
					totalAmount : totalAmount,
					exchangeRate : exchangeRate,
					salesPerson : salesPerson,
					itemID : itemID,
					amount : amount,
					OrderNo : OrderNo,
					description : description,
					unitmeasure : unitmeasure,
					unitPrice : unitPrice,
					ordQty : ordQty,
					requiredDate : requiredDate
				};
                                $(obj).attr("disabled","disabled");
				$.ajax({
					type: "POST",
        			url: '<?php echo base_url();?>sotransaction/sodetails_save',
					dataType:"json",
					data: postData,
	  				async: false,
					success: function(content){
						if(content.status == "success") {
  							$('#ID').val(content.salesID);
							eRow.remove();
							$("#addLine").show(); 
							$("#customerID").attr('readonly','readonly');
							$("#OrderNo").val(content.OrderNo);
							$("#OrderNo").attr('readonly','readonly');
							$("#totalAmount").val(accounting.formatNumber(totalAmount,2));
    						$("#oTable tbody").append(
							"<tr><td style='display:none'>"+content.message1+"</td>" +
        					"<td>"+content.items+"</td>" +
        					"<td>"+description+"</td>" +
        					"<td>"+requiredDate+"</td>" +
        					"<td class='tac'>"+content.um+"</td>" +
        					"<td class='tar'>"+accounting.formatNumber(unitPrice,2)+"</td>" +
        					"<td class='tar'>"+ordQty+"</td>" +
        					"<td class='tar'>"+accounting.formatNumber(amount,2)+"</td>" +
        					"<td class='tac'><button class='btn-icon btn-mini btn-danger-form remove' title='<?php echo $this->lang->line('remove') ?>' onClick='saveRemove(this)'><span class='i-trashcan'></button></td>" +
					        "</tr>");
							alertbox(content.message,1);
						}
					}
				});
			}
		}
	}
}
function calculate_amount(obj){
	var amount = parseFloat($('td:eq(5)', $(obj).parents('tr')).find("input").val()) * parseFloat($('td:eq(6)', $(obj).parents('tr')).find("input").val());
	$('td:eq(7)', $(obj).parents('tr')).find("input").val(amount.toFixed(2));
}

function cancelRow(obj){
    var eRow   = $(obj).parents('tr');
	eRow.remove();
	$("#addLine").show(); 
}
function saveRemove(obj){
    var eRow   = $(obj).parents('tr');
	var totalAmount = accounting.unformat($("#totalAmount").val());
	var lineAmount = accounting.unformat($('td:eq(7)', $(obj).parents('tr')).text());
	var Amount = totalAmount - lineAmount;
	var ID = $('td:eq(0)', $(obj).parents('tr')).text();
				postData = {
					OrderNo: $("#ID").val(),
					ID : ID,
					amount:Amount
				};
				$.ajax({
					type: "POST",
        			url: '<?php echo base_url();?>sotransaction/sodetails_delete',
					dataType:"json",
					data: postData,
	  				async: false,
					success: function(content){
						if(content.status == "success") {
							alert(content.message);
							$("#totalAmount").val(accounting.formatNumber(Amount,2));
							eRow.remove();
						}
					}
				});
}
function refreshEmployee(){
		$.ajax({
			type: "POST",
        	url: '<?php echo base_url();?>sotransaction/employeeSearch',
			dataType:"json",
			success: function(content){
				if(content.status == "success") {
					var items = [];
//					items.push('<option value=""><?php echo $this->lang->line('pleaseselect')?></option>');
					for ( var i = 0; i < content.message.length; i++) {
					items.push('<option value="'+content.message[i].ID+'">'
//						+ content.message[i].code + ' [ '+ content.message[i].desc + ' ]</option>');
						+ content.message[i].employeeName + '</option>');
					}
//					for (var x = startrows; x < tablerows ; x++) {
 						var rowId = "#salesPerson";
						jQuery(rowId).empty();
						jQuery(rowId).append(items.join('</br>'));
//					}
				} else {
					$("#error").html('<p>'+content.message+'</p>');
				}
					return false;
			}
		});
}
</script>
<div id="content"> 
	<div class="wrap">
		<div class="head">
			<div class="info">
				<!--<h1><?php echo element('compName', $this->session->userdata('logged_in')) ?> [ 
					<?php echo element('compNo', $this->session->userdata('logged_in')) ?> ]</h1>-->
				<ul class="breadcrumb">
					<li><a href='<?php echo base_url()."home" ?>'><?php echo $this->lang->line('dashboard') ?></a> <span class="divider">-</span></li>
					<li><a href='<?php echo base_url()."so/home" ?>'> <?php echo $this->lang->line('module') ?></a> <span class="divider">-</span></li>
					<li class="active"><?php echo $this->lang->line('title') ?></li>
				</ul>
			</div>
			<div class="search">
				<form action="<?php echo base_url() ?>admin/search" method="post">
					<input name="search_text" type="text" placeholder="search..."/>                                
					<button type="submit"><span class="i-magnifier"></span></button>
				</form>
			</div>                                         
		</div><!-- head --> 
		<div class="content" ><!--id="grid_content_1">-->
			<div class="block">
				<div class="head">
					<h2><strong><?php echo $this->lang->line('title') ?></strong></h2>
				</div>
				<div class="content np">
					<div class="row-fluid scRow">                            
						<div class="span6 scCol">
							<div class="block ns" id="grid_block_1">
								<div class="controls-row"> <!-- row 1 -->
									<div class="span3"><?php echo $this->lang->line('customer') ?></div>
									<div class="span9">
										<?php
											$preselcust = $headerSO->customerID;
											$options[] = $this->lang->line('pleaseselect');
											if($customers){
												foreach($customers as $row){
													$options[$row->ID] = $row->customerName.' [ '.$row->accountCode.' ]';
													}
												}
											$js='class="span8" id="customerID" disabled';
												echo form_dropdown('customerID', $options, $preselcust, $js);
										?>       
									<div class="btn-group span2">
										<button class="btn-icon btn-small dropdown-toggle" data-toggle="dropdown">
											<span class="i-arrow-down-2"></span>
										</button>
										<ul class="dropdown-menu">
										<!-- dropdown menu links -->
											<li><a target="_blank" href="<?php echo base_url() ?>CustomerSetup/CustomerNew"  id="btnNewCustomer">
												<i class="icon-plus-sign"></i> <?php echo $this->lang->line('addNewCustomer')?></a></li>
											<li><a href="#" onclick="selectCustomer()">
												<i class="icon-refresh"></i> <?php echo $this->lang->line('refreshlist')?></a></li>
										</ul>
									</div><!-- btn group -->
								</div>                
							</div><!-- End Row 1 -->
							<div class="controls-row"><!-- Row 4-->
								<div class="span3"><?php echo form_label($this->lang->line('orderNo'),'OrderNo');?></div>
								<div class="span9">
								<?php 								
									$data = array(
										'name'=>'OrderNo', 
										'id'=>'OrderNo', 
										'disabled'=>'disabled', 
										'class'=>'input-medium',); 
									echo form_input($data, $headerSO->OrderNo); ?>
								<?php 								
									$data = array(
										'name'=>'ID', 
										'id'=>'ID', 
										'type'=>'hidden',); 
									echo form_input($data,$headerSO->salesID); ?>
								</div>
							</div><!-- End Row 4-->
							<div class="controls-row"><!-- Row 3 -->
								<div class="span3"><?php echo form_label($this->lang->line('effective_date'),'effdate');?></div>
								<div class="span9">
									<div class="input-prepend">
										<span class="add-on"><i class="i-calendar"></i></span>
										<?php 								
										$data = array(
											'type'=>'text',
											'name'=>'effdate', 
											'id'=>'effdate', 
											'class'=>'input-medium datepicker2 financhk',); 
										echo form_input($data, date("d-m-Y", strtotime($headerSO->salesOrderDate))); ?>
									</div>                                                                                                
								</div>
							</div><!-- End Row 3 -->
							<div class="controls-row"> <!-- row 1 -->
								<div class="span3"><?php echo $this->lang->line('salesperson') ?></div>
								<div class="span9">
									<?php
										$preselperson = $headerSO->salesPerson;
										$options = '';
										$options[] = $this->lang->line('pleaseselect');
										if($employees){
											foreach($employees as $row){
												$options[$row->ID] = $row->employeeName;
												}
											}
										$js='class="span8" id="salesPerson"';
											echo form_dropdown('salesPerson', $options, $preselperson, $js);
									?>       
									<div class="btn-group span2">
										<button class="btn-icon btn-small dropdown-toggle" data-toggle="dropdown">
											<span class="i-arrow-down-2"></span>
										</button>
										<ul class="dropdown-menu">
											<!-- dropdown menu links -->
											<li><a target="_blank" href="<?php echo base_url() ?>employeeSetup/EmployeeNew"  id="btnNewEmpoyee">
												<i class="icon-plus-sign"></i> <?php echo $this->lang->line('addNewEmployee')?></a></li>
											<li><a href="#" onclick="refreshEmployee()" id="btnNewEmpoyee">
												<i class="icon-refresh"></i> <?php echo $this->lang->line('refreshlist')?></a></li>
										</ul>
									</div><!-- btn group -->
								</div>                
							</div><!-- End Row 1 -->
						</div><!--grid_block_1 -->
					</div><!--span6 scCol -->
					<div class="span6 scCol">
						<div class="block ns" id="grid_block_2">
							<div class="controls-row"> <!-- row 1 -->
								<div class="span3"><?php echo $this->lang->line('shipto') ?></div>
								<div class="span9">
								<?php
									$preselshipto = $headerSO->deliveryToID;
									$options ='';
									$options[] = $this->lang->line('pleaseselect');
									$js='class="span8" id="deliveryToID"';
										echo form_dropdown('deliveryToID', $options, $preselshipto, $js);
								?>       
								</div>                
							</div><!-- End Row 1 -->
							<div class="controls-row"> <!-- row 1 -->
								<div class="span3"><?php echo $this->lang->line('currency') ?></div>
								<div class="span9">
									<?php
										$preselcurrency = $headerSO->currencyID;
										$options[] = $this->lang->line('pleaseselect');
										if($employees){
											foreach($currency as $row){
												$options[$row->fldid] = $row->fldcurr_code.' [ '.$row->fldcurr_desc.' ]';
											}
										}
										$js='class="span8" id="currencyID" disabled';
											echo form_dropdown('currencyID', $options, $preselcurrency, $js);
									?>       
								</div>                
							</div><!-- End Row 1 -->
							<div class="controls-row"><!-- Row 4-->
								<div class="span3"><?php echo form_label($this->lang->line('exchangerate'),'exchangeRate');?></div>
								<div class="span9">
                            	<?php 								
									$data = array(
										'name'=>'exchangeRate', 
										'id'=>'exchangeRate', 
										'class'=>'input-medium tar',); 
									echo form_input($data, number_format($headerSO->exchangeRate,5)); ?>
								</div>
							</div><!-- End Row 4-->
							<div class="controls-row"><!-- Row 4-->
								<div class="span3"><?php echo form_label($this->lang->line('amount'),'totalAmount');?></div>
								<div class="span9">
								<?php 								
									$data = array(
										'name'=>'totalAmount', 
										'id'=>'totalAmount', 
										'disabled'=>'disabled', 
										'class'=>'input-medium tar',); 
										echo form_input($data, number_format($headerSO->totalAmount,2)); ?>
								</div>
							</div><!-- End Row 4-->
						</div><!--grid_block_2 -->
					</div><!--span6 scCol -->
				</div><!--row-fluid scRow -->
				<div class="row-fluid scRow">                            
					<div class="span12 scCol">
						<div class="block ns" id="grid_block_3">
							<div class="controls-row"><!-- Row 4-->
								<div class="span1"><?php echo form_label($this->lang->line('memo'),'memo');?></div>
								<div class="span11">
                            	<?php 								
									$data = array(
										'name'=>'memo', 
										'id'=>'memo', 
										'class'=>'span12',); 
									echo form_input($data, $headerSO->memo); ?>
								</div>
							</div><!-- End Row 4-->
						</div><!--grid_block_3 -->
					</div><!--span6 scCol -->
				</div><!--row-fluid scRow -->
			</div><!--content -->
		</div><!--block -->
		<div class="row-fluid scRow">                            
			<div class="span12 scCol">
				<div class="block" id="grid_block_4">
					<div class="head">
						<h2><?php echo $this->lang->line('orderdetails')?></h2>
					</div><!-- head -->
					<div class="content np">
						<table id="oTable" cellpadding="0" cellspacing="0" width="100%">
							<thead>
								<tr>
									<th style='display:none'></th>
									<th><?php echo $this->lang->line('itemCode')?></th>
									<th><?php echo $this->lang->line('description')?></th>
									<th><?php echo $this->lang->line('daterequired')?></th>
									<th><?php echo $this->lang->line('um')?></th>
									<th class="tar"><?php echo $this->lang->line('unitPrice')?></th>
									<th class="tar"><?php echo $this->lang->line('qtyOrd')?></th>
									<th class="tar"><?php echo $this->lang->line('amount')?></th>
									<th class="tac"><?php echo $this->lang->line('action')?></th>
								</tr>
							</thead>
							<tbody>
								<?php $bil = 0; 
								if($datatbls){
									foreach($datatbls as $datatbl):
										$bil++?>
								<tr>
									<td style="display:none" ><?php echo $datatbl->ID; ?></td>
									<td class="tac"><?php echo $datatbl->itemCodeName; ?></td>
									<td><?php echo $datatbl->description ?></td>
									<td class="tac"><?php echo date("d-m-Y", strtotime($datatbl->requiredDate))?></td>
									<td class="tac"><?php echo $datatbl->code?></td>
									<td class="tar"><?php echo number_format($datatbl->unitPrice,2); ?></td>
									<td class="tar"><?php echo $datatbl->quantityOrder; ?></td>
									<td class="tar"><?php echo number_format($datatbl->amount,2); ?></td>
									<td class="tac"><?php
														$js = 'class="btn-icon btn-mini btn-danger-form remove" title="'.$this->lang->line('delete').'"  onClick="saveRemove(this)"';
															echo form_button('remove','<span class="i-trashcan">',$js);
													?></td>
								</tr>
									<?php endforeach; }?>
							</tbody>
						</table>
					</div><!--content -->
						<div class="footer">
							<div class="side fr">
								<div class="btn-group">
									<button class="btn-icon btn-warning-form" onClick="addRow()" id="addLine">
									<span class="i-plus-2"></span> <?php echo $this->lang->line('addnewline')?></button>
								</div>
							</div>
						</div>                                    
					</div><!--grid_block_3 -->
				</div><!--span6 scCol -->
			</div><!--row-fluid scRow -->
		</div><!--grid_content_1 -->
	</div><!--wrap -->
</div><!--content -->
