<commit_before><script type="text/javascript" charset="utf-8">
    var detailTable;
    $(function() {        
        $('#datetimepicker1').datetimepicker({
            format: 'YYYY-MM-DD HH:mm:ss'
        });

        fillClientes();
        fillProductos();
        detailTable = $("#detalleTable").DataTable({
            destroy: true,
            info: false,
            paging: false,
            searching: false,
			ordering: false
        });             
        totalsTable = $("#totalsTable").DataTable({
            destroy: true,
            info: false,
            paging: false,
            searching: false,
			ordering: false
        });
    });

    function addNewOrderData() {
        detailTable = $("#detalleTable").DataTable();
        var dataDetail = detailTable.$("input").serializeArray();

        var dataOrder = {
            numPedido: $("#numPedido").val(),
            idCliente: $("#clientes").val(),
            productos: $("#productos").val(),
            idUser: '1',
            fecha: $("#datetimepicker1").data('date'),
            detalle: JSON.stringify(dataDetail),
        };

        var url = "<?=site_url('pedido/jsonGuardarNuevo')?>";

        $.ajax({
            url: url,
            data: dataOrder,
            dataType: "json",
            type: 'POST',
            success: function(json) {
                var n = noty({
                    type: "success",
                    text: json.message,
                    animation: {
                        open: {
                            height: 'toggle'
                        },
                        close: {
                            height: 'toggle'
                        },
                        easing: 'swing',
                        speed: 500 // opening & closing animation speed
                    }
                });
            },
            error: function() {
                var n = noty({
                    type: "error",
                    text: "Error al guardar, compruebe que los datos esten correctos",
                    animation: {
                        open: {
                            height: 'toggle'
                        },
                        close: {
                            height: 'toggle'
                        },
                        easing: 'swing',
                        speed: 500 // opening & closing animation speed
                    }
                });

            }
        });
    }

    function fillProductos() {
        $.ajax({
            url: "<?=site_url('producto/ajaxGetProductos')?>",
            dataType: "json",
            type: 'GET',
            success: function(json) {
                var options = '';
                for (var x = 0; x < json.length; x++) {
                    options += '<option value="' + json[x].idProducto + '">' + json[x].descripcion + '</option>';
                }

                $('#productos').html(options);
                $('#productos').selectpicker('refresh');
            },
            error: function() {
                alert(options);
            }
        });
    }

    function fillClientes() {
        $.ajax({
            url: "<?=site_url('cliente/ajaxGetClientes')?>",
            dataType: "json",
            type: 'GET',
            success: function(json) {
                var options = '';
                for (var x = 0; x < json.length; x++) {
                    options += '<option value="' + json[x].idCliente + '">' + json[x].apellidos + " " + json[x].nombres + '</option>';
                }

                $('#clientes').html(options);
                $('#clientes').selectpicker('refresh');
            },
            error: function() {
                alert(options);
            }
        });
    }

    function addProducts() {
        var dataProduct = {
            products: $("#productos").val(),
        };
        $.ajax({
            url: "<?=site_url('producto/ajaxGetProductosByIds')?>",
            data: dataProduct,
            dataType: "json",
            type: 'POST',
            success: function(json) {                
                detailTable.clear();
                var totalBruto = 0;
                var valorTotal = 0;
                for (x=0; x< json.length; x++) {
                    total = json[x].cantidad * json[x].precioUnitario;
                    totalBruto +=  total;
				detailTable.row.add([
                    json[x].idProducto,
                    json[x].codigoExterno,<commit_msg>clientes codigo<commit_after><script type="text/javascript" charset="utf-8">
    var detailTable;
    $(function() {        
        $('#datetimepicker1').datetimepicker({
            format: 'YYYY-MM-DD HH:mm:ss'
        });

        fillClientes();
        fillProductos();
        detailTable = $("#detalleTable").DataTable({
            destroy: true,
            info: false,
            paging: false,
            searching: false,
			ordering: false
        });             
        totalsTable = $("#totalsTable").DataTable({
            destroy: true,
            info: false,
            paging: false,
            searching: false,
			ordering: false
        });
    });

    function addNewOrderData() {
        detailTable = $("#detalleTable").DataTable();
        var dataDetail = detailTable.$("input").serializeArray();

        var dataOrder = {
            numPedido: $("#numPedido").val(),
            idCliente: $("#clientes").val(),
            productos: $("#productos").val(),
            idUser: '1',
            fecha: $("#datetimepicker1").data('date'),
            detalle: JSON.stringify(dataDetail),
        };

        var url = "<?=site_url('pedido/jsonGuardarNuevo')?>";

        $.ajax({
            url: url,
            data: dataOrder,
            dataType: "json",
            type: 'POST',
            success: function(json) {
                var n = noty({
                    type: "success",
                    text: json.message,
                    animation: {
                        open: {
                            height: 'toggle'
                        },
                        close: {
                            height: 'toggle'
                        },
                        easing: 'swing',
                        speed: 500 // opening & closing animation speed
                    }
                });
            },
            error: function() {
                var n = noty({
                    type: "error",
                    text: "Error al guardar, compruebe que los datos esten correctos",
                    animation: {
                        open: {
                            height: 'toggle'
                        },
                        close: {
                            height: 'toggle'
                        },
                        easing: 'swing',
                        speed: 500 // opening & closing animation speed
                    }
                });

            }
        });
    }

    function fillProductos() {
        $.ajax({
            url: "<?=site_url('producto/ajaxGetProductos')?>",
            dataType: "json",
            type: 'GET',
            success: function(json) {
                var options = '';
                for (var x = 0; x < json.length; x++) {
                    options += '<option value="' + json[x].idProducto + '">' + json[x].descripcion + '</option>';
                }

                $('#productos').html(options);
                $('#productos').selectpicker('refresh');
            },
            error: function() {
                alert(options);
            }
        });
    }

    function fillClientes() {
        $.ajax({
            url: "<?=site_url('cliente/ajaxGetClientes')?>",
            dataType: "json",
            type: 'GET',
            success: function(json) {
                var options = '';
                for (var x = 0; x < json.length; x++) {
                    options += '<option value="' + json[x].idCliente + '" data-subtext="' + json[x].codigoCliente + '">' + json[x].apellidos + " " + json[x].nombres + '</option>';
                }

                $('#clientes').html(options);
                $('#clientes').selectpicker('refresh');
            },
            error: function() {
                alert(options);
            }
        });
    }

    function addProducts() {
        var dataProduct = {
            products: $("#productos").val(),
        };
        $.ajax({
            url: "<?=site_url('producto/ajaxGetProductosByIds')?>",
            data: dataProduct,
            dataType: "json",
            type: 'POST',
            success: function(json) {                
                detailTable.clear();
                var totalBruto = 0;
                var valorTotal = 0;
                for (x=0; x< json.length; x++) {
                    total = json[x].cantidad * json[x].precioUnitario;
                    totalBruto +=  total;
				detailTable.row.add([
                    json[x].idProducto,
                    json[x].codigoExterno,
{'fraction_non_alphanumeric': 0.13744910311433917, 'fraction_numerical': 0.003301419610432486, 'mean_word_length': 1.101271676300578, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3090055', 'n_tokens_mistral': 2359, 'n_tokens_neox': 2205, 'n_words': 452}