function initializeWorkOrderMaterials() {
    var productionType = $("#prodType").val();
    var fromDailyPlan = productionType === "MF" ? localStorage.getItem('WoFromDailyPlan') : "false";
    
    $itemsTable = $('#mainGridProcessing');
    var itemsTable = $itemsTable.DataTable({
        initComplete: function () {
            var api = this.api();
        },
        ajax: {
            url: $itemsTable.attr('data-url'),
            data: function (d) {
                d.Key = $("#AcKey").val();
                d.ItemType = $("#itemType").val();
                d.DataFromDailyPlan = fromDailyPlan;
            }
        },
        columns: [
            {
                class: 'border-bottom',
                data: function (data) {
                    var image = data.Picture !== '' ? " <img style='max-width:100%'  src='" + data.Picture + "' />" : "<i class='fal fa-image fa-3x text-muted' style='opacity:0.5'></i>";
                    return  "<span style='width:100rem;position: relative;text-align: center;vertical-align: middle;display: table-cell;height: 150px;'>" + image + "</span>";
                },
                orderable: false,
                render: function (data) {
                    return data;
                }
            },

            {
                data: "IdentDescr",
                name: "IdentDescr",
                filtertype: "text",
                className: "dt-body-left",
                render: function (data, type, full) {
                    return type === 'display' ?
                        '<div class="margin-top-10">' +
                        '   <div>' +
                        '       <span class="card-caption"  data-toggle="tooltip"  data-original-title="' + data + '">' + data + '</span>' +
                            '</div>' +
                        '</div >' : data;

                }
            },
            {
                data: "AnNo",
                name: "AnNo",
                filtertype: "text",
                className: "dt-body-left",
                render: function (data, type, full) {
                    return type === 'display' ?
                        '<span style="margin-right:2px"> <i class="fa fa-hashtag"></i> </span> <span>' + data + '</span>' : data;
                }
            },
            {
                data: 'CompletedPrcQty',
                render: function (data, type, full) {
                    var status = $.fn.dataTable.render.number('.', ',', 0, '', "").display(full.Status);
                    var completedPrc = $.fn.dataTable.render.number('.', ',', 0, '', " ").display(full.CompletedPrcQty);
                    var planQty = $.fn.dataTable.render.number('.', ',', 2, '', "").display(full.PlanPcs);
                    var qty = $.fn.dataTable.render.number('.', ',', 2, '', "").display(full.DonePcs);
                    var color = data >= 100 ? "bg-c-green" : "bg-c-yellow"
                    var value = data > 100 ? 100 : data
                    return type === 'display' ?
                        '<div class="progress-card">' +
                        '<div class="progress">' +
                        '    <div class="progress-bar ' + color + '" style="width:' + value + '%" aria-valuenow="' + data + '" aria-valuemin="0" aria-valuemax="100"></div>' +
                        '</div>' +
                        '</div>' +
                        '<span>' + status + ' (' + completedPrc + '%)</span>  <span class="pull-right">' + qty + '/' + planQty + ' ' + full.UM + '</span>' : data;

                }
            }

        ],
        createdRow: function (row, data, dataIndex) {
            $(row).css('cursor', 'pointer');
        },
        drawCallback: function () {
            $("[data-toggle='tooltip']").tooltip({
                container: 'body'
            });
        }
    })

    itemsTable.on('click', 'tr', function () {
        var data = itemsTable.row($(this)).data();
        window.location.href = "EditMat?key=" + data.AcKey + '&no=' + data.AnNo + '&type=' + productionType;
    });
   

};

function initializeWorkOrderOperations() {
    var productionType = $("#prodType").val();
    var operMatUrl = $("#operMatURL").val();
    var operRegUrl = $("#operRegURL").val();
    var fromDailyPlan = productionType === "MF" ? localStorage.getItem('WoFromDailyPlan') : "false";

    $itemsTable = $('#mainGridProcessing');
    var itemsTable = $itemsTable.DataTable({
        initComplete: function () {
            var api = this.api();
            api.column(1).visible(productionType === "MF" ? true : false);
            api.column(2).visible(fromDailyPlan === "true" ? true : false);
            api.column(3).visible(fromDailyPlan === "true" ? true : false);
            api.column(4).visible(productionType === "MF" ? true : false);
        },
        ajax: {
            url: $itemsTable.attr('data-url'),
            data: function (d) {
                d.Key = $("#AcKey").val();
                d.ItemType = $("#itemType").val();
                d.DataFromDailyPlan = fromDailyPlan;
            }
        },
        columns: [
            {
                data: "IdentDescr",
                name: "IdentDescr",
                filtertype: "text",
                className: "dt-body-left",
                render: function (data, type, full) {
                    var hidden = full.WoExRegCount == "0" ? 'hidden' : '';
                    return type === 'display' ?
                        '<div class="margin-top-10">' +                        

                        '<a id="operMat" class="fa fa-eye fa-lg text-muted clickable-icon pull-right text-success" href="#" data-url="' + operMatUrl +
                        '" role="button" data-original-title="' + $("#materialsForOperation").val() + '" data-toggle="popover" data-no="' + full.AnNo + '"></a>' +

                        '<a id="operReg" class="fas fa-spinner fa-spin fa-lg pull-right ' + hidden + '" href="#" role="button" data-toggle="popover" data-url="' + operRegUrl +
                        '" data-original-title="' + $("#workRegistration").val() + '" data-no="' + full.AnNo +
                        '" style = "color: #7EAF3F"></a>' +

                        '   <div>' +
                        '       <span class="card-caption" data-toggle="tooltip"  data-original-title="' + data + '"  >' + data + '</span>' +
                        '   </div>' +
                        '</div >' : data;

                }
            },

            {
                data: "ResursID",
                name: "ResursID",
                filtertype: "text",
                className: "card-label",
                render: function (data, type, full) {
                    return type === 'display' ?
                        '<h3 class="card-header text-success">' +
                        '<span class="card-caption" data-toggle="tooltip"  data-original-title="' + data + ' - ' + full.ResourceName + '" >' +
                        '<i class="fas fa-cogs"></i> ' + data + ' - ' + full.ResourceName +
                        '</span>' +
                        '</h3 > ' : data;
                }
            },
            {
                data: "AcKeyDisplay",
                name: "AcKeyDisplay",
                filtertype: "text",
                className: "dt-body-left",
                render: function (data, type, full) {
                    return type === 'display' ?
                        '<span style="margin-right:2px"> <i class="fa fa-hashtag"></i> </span> <span>' + full.DPKeyView + '</span>' : data;
                }
            },
            {
                data: "ShiftName",
                name: "ShiftName",
                render: function (data, type, full) {
                    return type === 'display' ?
                        '<span style="margin-right:2px"></span> <span>' + data + '</span>' : data;
                }
            },
            {
                data: "StartEnd",
                name: "StartEnd",
                render: function (data, type, full) {
                    return type === 'display' ?
                        '<span style="margin-right:2px"> <i class="far fa-clock"></i> </span> <span>' + data + '</span>' : data;
                }
            },
            {
                data: 'CompletedPrcTime',
                render: function (data, type, full) {
                    var status = $.fn.dataTable.render.number('.', ',', 0, '', "").display(full.Status);
                    var completedPrc = $.fn.dataTable.render.number('.', ',', 0, '', " ").display(full.CompletedPrcTime);
                    var planQty = $.fn.dataTable.render.number('.', ',', 2, '', "").display(full.PlanTime);
                    var qty = $.fn.dataTable.render.number('.', ',', 2, '', "").display(full.DoneTime);
                    var color = data >= 100 ? "bg-c-green" : "bg-c-yellow"
                    var value = data > 100 ? 100 : data
                    return type === 'display' ?
                        '<div class="progress-card">' +
                        '<div class="progress">' +
                        '    <div class="progress-bar ' + color + '" style="width:' + value + '%" aria-valuenow="' + data + '" aria-valuemin="0" aria-valuemax="100"></div>' +
                        '</div>' +
                        '</div>' +
                        '<span>' + status + ' (' + completedPrc + '%)</span>  <span class="pull-right">' + qty + '/' + planQty + ' ' + full.UM + '</span>' : data;
                }
            }

        ],
        createdRow: function (row, data, dataIndex) {
            $(row).css('cursor', 'pointer');
        },
        drawCallback: function () {             
            $("[data-toggle='tooltip']").tooltip({
                container: 'body'
            }),
            $("[data-toggle=popover]").popover({
                html: true,
                container: "body",
                trigger: 'hover',
                content: function () {
                    var id = $(this).attr('id');
                    $.ajax({
                        url: $(this).attr('data-url'),
                        type: 'POST',
                        async: false,
                        data: {
                            Key: $("#AcKey").val(),
                            No: $(this).attr('data-no'),
                            ItemType: ""
                        },
                        success: function (response) {                            
                            if (id == 'operMat') {
                                getOperMatTable(response);
                            }
                            else {
                                getOperRegTable(response);
                            }
                        }
                    });

                    return $('#operPopover').html();
                }

            }).click(function (event) {
                event.preventDefault();
                event.stopPropagation();
            });
        }

    })

    itemsTable.on('click', 'tr', function () {
        var data = itemsTable.row($(this)).data();
        window.location.href = "WorkReg?key=" + data.AcKey + '&no=' + data.AnNo + '&resID=' + data.ResursID + '&type=' + productionType;
    });


};

function getOperMatTable(response) {

    $("#popoverTable").empty();
    var trHTML = '';
    $.each(response.data, function (i, item) {

        var completedPrc = $.fn.dataTable.render.number('.', ',', 0, '', " ").display(item.CompletedPrcQty);
        var planQty = $.fn.dataTable.render.number('.', ',', 2, '', "").display(item.PlanPcs);
        var qty = $.fn.dataTable.render.number('.', ',', 2, '', "").display(item.DonePcs);

        var image = item.Picture !== '' ? " <img src='" + item.Picture + "' />" : "<i class='fal fa-image fa-3x text-muted' style='opacity:0.5'></i>";

        trHTML +=
            '<tr>' +
            '   <td style="width:150px"> <span style="position: relative; text-align: center; vertical-align: middle; display: table-cell; height: 150px;">' +
                    image +
            '   </td>' +
            '   <td style="width:300px">' +
            '       <div class="margin-top-10">' +
            '           <label class="control-label">' + $("#materialCaption").val() + '  <i class="fa fa-hashtag"></i><span>' + item.AnNo + '</span></label>' +
            '           <div>' +
            '               <span style="font-size: 14px; display: inline-block; overflow:hidden; text-overflow: ellipsis;">' + item.IdentDescr + '</span>' +
            '           </div>' +
            '       </div >' +
            '   </td>' +
            '   <td style="width:150px">  ' +
            '       <div class="margin-top-10">' +
            '       <span>' + item.Status + ' (' + completedPrc + '%)</span>' +
            '       <span class="pull-right">' + qty + '/' + planQty + ' ' + item.UM + '</span>' +
            '       <progress value = ' + item.CompletedPrcQty + ' max = "100" style = "width: 100%" ></progress >' +
            '           </div>' +
            '   </td > ' +
            '</tr>';
    });
    $('#popoverTable').append(trHTML);    
}

function getOperRegTable(response) {

    var icon = '';
    var color = '';
    var caption = '';

    $("#popoverTable").empty();
    var trHTML = '';
    $.each(response.data, function (i, item) {

        switch (item.EventType) {
            case 'OB':
                icon = "fad fa-2x fa-play";
                color = "#7EAF3F";
                caption = $("#operationStart").val();
                break;
            case 'OP':
                icon = "fad fa-2x fa-pause-circle";
                color = "goldenrod";
                caption = $("#operationPause").val();
                break;
            case 'OC':
                icon = "fad fa-2x fa-play-circle";
                color = "#7EAF3F";
                caption = $("#operationContinue").val();
                break;
            case 'OE':
                icon = "fad fa-2x fa-stop-circle";
                color = "#BB5534";
                caption = $("#operationEnd").val();
                break;

            default:
                icon = "fa fa-clock-o";
                break;
        }


        trHTML +=
            '<tr>' +
            '   <td style="width:50px"> ' +
            '       <i class="' + icon + '" style= "color:' + color+'"></i>' +
            '   </td>' +

            '   <td style="width:300px">' +
        '           <label class="control-label">' + caption + ' </label>' +
            '           <div>' +
            '               <span style="font-size: 14px; display: inline-block; overflow:hidden; text-overflow: ellipsis;">' + item.EventTimeStr + '</span>' +
            '       </div >' +
            '   </td>' +

            '   <td style="width:100px">  ' +
            '       <span>' + item.Worker + '</span>' +
            '   </td > ' +

            '</tr>';
    });
    $('#popoverTable').append(trHTML);
}

function saveOperation(validate) {

    var receiveURL = $("#receiveURL").val();
    var buttonText = $("#buttonText").val();
    var succesText = $("#succesText").val();

    if (validate) {
        var qty = $("#qty").val();
        var worker = $('#selectWorker :selected').text();
        var requiedText = "";
        if (worker === "")
            requiedText = $("#requiedWorker").val();
        else
            if (qty === 0 || qty === "")
                requiedText = $("#requiedQty").val();


        if (qty === "" || qty === 0 || worker === "") {
            $().customModal({
                destroyOnClose: true,
                showCloseButton: true,
                id: "requiedInput",
                type: "alert",
                text: requiedText,
                buttons: [
                    {
                        icon: 'fa fa-check',
                        text: buttonText,
                        closeOnAction: true,
                        type: 'primary'
                    }
                ]
            });
            customModalForMobile(isMobile);
            return false;
        };
    }

    var formData = $("#workOrderEditOper").serializeArray();

    $.each(formData, function () {
        if (!isNaN(this.value)) {
            this.value = this.value.replace('.', ',');
        }
    });

    swapLoadingIcon(true, "confirmButton", "fa fa-check");

    $.post(receiveURL, formData)
        .done(function (response) {

            if (response.Success) {

                $().customModal({
                    destroyOnClose: true,
                    showCloseButton: true,
                    id: "displayPopupSuccessModal",
                    type: "success",
                    text: succesText,
                    buttons: [
                        {
                            icon: 'fa fa-check',
                            text: buttonText,
                            closeOnAction: true,
                            type: 'primary',
                            action: function () {
                                location.reload();
                            }
                        }
                    ]
                });
                customModalForMobile(isMobile);

            } else {

                let errorText = response.Error;

                $().customModal({
                    destroyOnClose: true,
                    showCloseButton: true,
                    id: "displayPopupErrorModal",
                    type: "alert",
                    text: errorText,
                    buttons: [
                        {
                            icon: 'fa fa-check',
                            text: buttonText,
                            closeOnAction: true,
                            type: 'primary'
                        }
                    ]
                });
                customModalForMobile(isMobile);
            }

            swapLoadingIcon(false, "confirmButton", "fa fa-check");
        });

}

function saveMaterial(isMobile) {

    var receiveURL = $("#receiveURL").val();
    var buttonText = $("#buttonText").val();
    var succesText = $("#succesText").val();
    var qty = $("#qty").val();

    if (qty === "" || qty == 0) {

         $().customModal({
            destroyOnClose: true,
            showCloseButton: true,
            id: "requiedInput",
            type: "alert",
            text: $("#requiedQty").val(),
            buttons: [
                {
                    icon: 'fa fa-check',
                    text: buttonText,
                    closeOnAction: true,
                    type: 'primary'
                }
            ]
        });
        customModalForMobile(isMobile);
        return false;
    }; 

    var formData = $("#workOrderEditMat").serializeArray();

    $.each(formData, function () {
        if (!isNaN(this.value)) { 
            this.value = this.value.replace('.', ',');
        }
    });

    swapLoadingIcon(true, "confirmButton", "fa fa-check");

    $.post(receiveURL, formData)
        .done(function (response) {

            if (response.Success) {

                $().customModal({
                    destroyOnClose: true,
                    showCloseButton: true,
                    id: "displayPopupSuccessModal",
                    type: "success",
                    text: succesText,
                    buttons: [
                        {
                            icon: 'fa fa-check',
                            text: buttonText,
                            closeOnAction: true,
                            type: 'primary',
                            action: function () {
                                location.reload();
                            }
                        }
                    ]
                });
                customModalForMobile(isMobile);

            } else {

                let errorText = response.Error;

                $().customModal({
                    destroyOnClose: true,
                    showCloseButton: true,
                    id: "displayPopupErrorModal",
                    type: "alert",
                    text: errorText,
                    buttons: [
                        {
                            icon: 'fa fa-check',
                            text: buttonText,
                            closeOnAction: true,
                            type: 'primary'
                        }
                    ]
                });
                customModalForMobile(isMobile);

            }

            swapLoadingIcon(false, "confirmButton", "fa fa-check");
        });

}

function initializeWorkOrderMaterialsMobile() {
    var productionType = $("#prodType").val();
    var fromDailyPlan = productionType === "MF" ? localStorage.getItem('WoFromDailyPlan') : "false";

    $itemsTable = $('#mainGridProcessing');
    var itemsTable = $itemsTable.DataTable({
        initComplete: function () {
            var api = this.api();
        },
        ajax: {
            url: $itemsTable.attr('data-url'),
            data: function (d) {
                d.Key = $("#AcKey").val();
                d.ItemType = $("#itemType").val();
                d.DataFromDailyPlan = fromDailyPlan;
            }
        },
        columns: [
            {
                class: 'border-bottom',
                data: function (data) {
                    var image = data.Picture !== '' ? " <img style='max-width:100%' src='" + data.Picture + "' />" : "<i class='fal fa-image fa-3x text-muted' style='opacity:0.5'></i>";
                    return "<span style='width:100rem;position: relative;text-align: center;vertical-align: middle;display: table-cell;height: 150px;'>" + image + "</span>";
                },
                orderable: false,
                render: function (data) {
                    return data;
                }
            },

            {
                data: "IdentDescr",
                name: "IdentDescr",
                filtertype: "text",
                className: "dt-body-left",
                render: function (data, type, full) {
                    return type === 'display' ?                                             
                        '    <span data-toggle="tooltip"  class="card-caption"  data-original-title="' + data + '" >' + data + '</span>' : data;

                }
            },
            {
                data: "AnNo",
                name: "AnNo",
                filtertype: "text",
                className: "dt-body-left",
                render: function (data, type, full) {
                    return type === 'display' ?
                        '<span style="margin-right:2px"> <i class="fa fa-hashtag"></i> </span> <span>' + data + '</span>' : data;
                }
            },
            {
                data: 'CompletedPrcQty',
                render: function (data, type, full) {
                    var status = $.fn.dataTable.render.number('.', ',', 0, '', "").display(full.Status);
                    var completedPrc = $.fn.dataTable.render.number('.', ',', 0, '', " ").display(full.CompletedPrcQty);
                    var planQty = $.fn.dataTable.render.number('.', ',', 2, '', "").display(full.PlanPcs);
                    var qty = $.fn.dataTable.render.number('.', ',', 2, '', "").display(full.DonePcs);
                    var color = data >= 100 ? "bg-c-green" : "bg-c-yellow"
                    return type === 'display' ?
                        '<div class="progress-card">' +
                        '<div class="progress">' +
                        '    <div class="progress-bar ' + color + '" style="width:' + data + '%" aria-valuenow="' + data + '" aria-valuemin="0" aria-valuemax="100"></div>' +
                        '</div>' +
                        '</div>' +
                        '<span>' + status + ' (' + completedPrc + '%)</span>  <span class="pull-right">' + qty + '/' + planQty + ' ' + full.UM + '</span>' : data;

                }
            }

        ],
        createdRow: function (row, data, dataIndex) {
            $(row).css('cursor', 'pointer');
        },
        drawCallback: function () {
            $("[data-toggle='tooltip']").tooltip({
                container: 'body'
            });
        }
    })

    itemsTable.on('click', 'tr', function () {
        var data = itemsTable.row($(this)).data();
        window.location.href = "EditMat?key=" + data.AcKey + '&no=' + data.AnNo + '&type=' + productionType;
    });


};

function initializeWorkOrderOperationsMobile() {
    var productionType = $("#prodType").val();
    var operMatUrl = $("#operMatURL").val();
    var operRegUrl = $("#operRegURL").val();
    var fromDailyPlan = productionType === "MF" ? localStorage.getItem('WoFromDailyPlan') : "false";

    $itemsTable = $('#mainGridProcessing');
    var itemsTable = $itemsTable.DataTable({
        initComplete: function () {
            var api = this.api();
            api.column(2).visible(productionType === "MF" ? true : false);
            //api.column(3).visible(fromDailyPlan === "true" ? true : false);
            api.column(4).visible(fromDailyPlan === "true" ? true : false);
            api.column(5).visible(productionType === "MF" ? true : false);
        },
        ajax: {
            url: $itemsTable.attr('data-url'),
            data: function (d) {
                d.Key = $("#AcKey").val();
                d.ItemType = $("#itemType").val();
                d.DataFromDailyPlan = fromDailyPlan;
            }
        },
        columns: [
            {
                class: 'border-bottom',
                orderable: false,
                render: function (data) {
                    return "<span style='width:100rem;position: relative;text-align: right;vertical-align: middle;display: table-cell;height: 50px;'><i class='far fa-newspaper fa-3x'></i></span>";
                }
            },
            {
                data: "IdentDescr",
                name: "IdentDescr",
                render: function (data, type) {
                    return type === 'display' ?
                        '<span data-toggle="tooltip" class="card-caption" data-original-title = "' + data + '">' + data + ' </span> ' : data;
                }
            },

            {
                data: "ResursID",
                name: "ResursID",
                filtertype: "text",
                className: "card-label",
                render: function (data, type, full) {
                    return type === 'display' ?
                        '<h4 class="text-success">' +
                        '<span  class="card-caption" data-toggle="tooltip" data-original-title="' + data + ' - ' + full.ResourceName + '" >' +
                        '<i class="fas fa-cogs"></i> ' + data + ' - ' + full.ResourceName +
                        '</span>' +
                        '</h4 > ' : data;
                }
            },
            {
                data: "AnNo",
                name: "AnNo",
                filtertype: "text",
                className: "dt-body-left",
                render: function (data, type, full) {
                    return type === 'display' ?
                        '<span style="margin-right:2px"> <i class="fa fa-hashtag"></i> </span> <span>' + full.AnNo + '</span>' : data;
                }
            },
            {
                data: "ShiftName",
                name: "ShiftName",
                render: function (data, type, full) {
                    return type === 'display' ?
                        '<span style="margin-right:2px"></span> <span>' + data + '</span>' : data;
                }
            },
            {
                data: "StartEnd",
                name: "StartEnd",
                render: function (data, type, full) {
                    return type === 'display' ?
                        '<span style="margin-right:2px"> <i class="far fa-clock"></i> </span> <span>' + data + '</span>' : data;
                }
            },
            {
                data: 'CompletedPrcTime',
                render: function (data, type, full) {
                    var status = $.fn.dataTable.render.number('.', ',', 0, '', "").display(full.Status);
                    var completedPrc = $.fn.dataTable.render.number('.', ',', 0, '', " ").display(full.CompletedPrcTime);
                    var planQty = $.fn.dataTable.render.number('.', ',', 2, '', "").display(full.PlanTime);
                    var qty = $.fn.dataTable.render.number('.', ',', 2, '', "").display(full.DoneTime);
                    var color = data > 100 ? "bg-c-red" : (data < 100 ? "bg-c-yellow" : "bg-c-green")
                    var value = data > 100 ? 100 : data
                    return type === 'display' ?

                        '<div class="progress-card">' +
                        '<div class="progress">' +
                        '    <div class="progress-bar ' + color + '" style="width:' + value + '%" aria-valuenow="' + data + '" aria-valuemin="0" aria-valuemax="100"></div>' +
                        '</div>' +
                        '</div>' +
                        '<span>' + status + ' (' + completedPrc + '%)</span>  <span class="pull-right">' + qty + '/' + planQty + ' ' + full.UM + '</span>' : data;
                }
            }

        ],
        createdRow: function (row, data, dataIndex) {
            $(row).css('cursor', 'pointer');
        },
        drawCallback: function () {
            $("[data-toggle='tooltip']").tooltip({
                container: 'body'
            }),
                $("[data-toggle=popover]").popover({
                    html: true,
                    container: "body",
                    trigger: 'hover',
                    content: function () {
                        var id = $(this).attr('id');
                        $.ajax({
                            url: $(this).attr('data-url'),
                            type: 'POST',
                            async: false,
                            data: {
                                Key: $("#AcKey").val(),
                                No: $(this).attr('data-no'),
                                ItemType: ""
                            },
                            success: function (response) {
                                if (id == 'operMat') {
                                    getOperMatTable(response);
                                }
                                else {
                                    getOperRegTable(response);
                                }
                            }
                        });

                        return $('#operPopover').html();
                    }

                }).click(function (event) {
                    event.preventDefault();
                    event.stopPropagation();
                });
        }

    })

    itemsTable.on('click', 'tr', function () {
        var data = itemsTable.row($(this)).data();
        window.location.href = "WorkReg?key=" + data.AcKey + '&no=' + data.AnNo + '&resID=' + data.ResursID + '&type=' + productionType;
    });


};

