public/js/create_sale.js
// When btn-print clicked; two actions are done 1- print the cart 2- data is edited into db.
When btn-print clicked; two actions are done 1- print the cart 2- data is edited into db.
When btn - print clicked ; two actions are done 1 - print the cart 2 - data is edited into db .
function onSaveSale() {
    var recieved_amount = $('input#recieved').val();
    var recieveable_amount = $('input#payable').val();
    var pntType = $('#payment_type').val();
    var transCode = $('#transCode').val();
    var custId = $('#select_customer').val();
    var tax = $('input.tax_value').val();
      $.ajax({
        type: "POST",
        url: "sale",
        dataType: "json",
        data: {'custID': custId, 'payment': pntType, 'recieved': recieved_amount, 'recieveable': recieveable_amount, 'transCode': transCode, 'tax': tax, '_token': $('input[name=_token]').val() },
        success: function (response) {
          $('#inv_message').css('display', 'block');
          $('#inv_message').attr('style', response.style);
          $('#inv_message').html(response.sale_msg);
          $('#inv_message').fadeOut(4000);
          setTimeout(function () { location.reload(); }, 5000);
        },
        error: function (error) { 
            console.log(error);
         }
      });
  }
function onSaveSale ( ) { var recieved_amount = $ ( 'input#recieved' ) . val ( ) ; var recieveable_amount = $ ( 'input#payable' ) . val ( ) ; var pntType = $ ( '#payment_type' ) . val ( ) ; var transCode = $ ( '#transCode' ) . val ( ) ; var custId = $ ( '#select_customer' ) . val ( ) ; var tax = $ ( 'input.tax_value' ) . val ( ) ; $ . ajax ( { type : "POST" , url : "sale" , dataType : "json" , data : { 'custID' : custId , 'payment' : pntType , 'recieved' : recieved_amount , 'recieveable' : recieveable_amount , 'transCode' : transCode , 'tax' : tax , '_token' : $ ( 'input[name=_token]' ) . val ( ) } , success : function ( response ) { $ ( '#inv_message' ) . css ( 'display' , 'block' ) ; $ ( '#inv_message' ) . attr ( 'style' , response . style ) ; $ ( '#inv_message' ) . html ( response . sale_msg ) ; $ ( '#inv_message' ) . fadeOut ( 4000 ) ; setTimeout ( function ( ) { location . reload ( ) ; } , 5000 ) ; } , error : function ( error ) { console . log ( error ) ; } } ) ; }
When btn-print clicked; two actions are done 1- print the cart 2- data is edited into db.
When btn - print clicked ; two actions are done 1 - print the cart 2 - data is edited into db .
// data: {'_token': $('input[name=_token]').val()}, // $('#sale_section').load(' #sale_section');