VaKeR CYBER ARMY
Logo of a company Server : Apache
System : Linux host44.registrar-servers.com 4.18.0-513.18.1.lve.2.el8.x86_64 #1 SMP Sat Mar 30 15:36:11 UTC 2024 x86_64
User : vapecompany ( 2719)
PHP Version : 7.4.33
Disable Function : NONE
Directory :  /home/vapecompany/demo.vapecompany.com.bd/resources/views/backend/reports/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/vapecompany/demo.vapecompany.com.bd/resources/views/backend/reports/stock_imei.blade.php
@extends('backend.layout.app')
@section('content')
      <style type="text/css">

@media screen and (max-width: 767px){
    #dtables_filter{
        margin-top: 10px;
    }
}

</style>

        <!-- ============================================================== -->
        <!-- Page wrapper  -->
        <!-- ============================================================== -->
        <div class="page-wrapper">
            <!-- ============================================================== -->
            <!-- Bread crumb and right sidebar toggle -->
            <!-- ============================================================== -->
            <div class="page-breadcrumb">
                <div class="row">
                    <div class="col-5 align-self-center">
                        <h4 class="page-title">Stock IMEI</h4>
                        <div class="d-flex align-items-center">
                            <nav aria-label="breadcrumb">
                                <ol class="breadcrumb">
                                    <li class="breadcrumb-item"><a href="#">Home</a></li>
                                    <li class="breadcrumb-item active" aria-current="page">Reports</li>
                                </ol>
                            </nav>
                        </div>
                    </div>

                </div>
            </div>
            <!-- ============================================================== -->
            <!-- End Bread crumb and right sidebar toggle -->
            <!-- ============================================================== -->
            <!-- ============================================================== -->
            <!-- Container fluid  -->
            <!-- ============================================================== -->
            <div class="container-fluid">
                <!-- ============================================================== -->
                <!-- Start Page Content -->
                <!-- ============================================================== -->
                <div class="row">
                    <div class="col-md-12">
                        <div class="card">
                            <div class="card-body">
                                <h4 class="card-title">Search Stock IMEI Report</h4>
                                <div id="education_fields" class=" m-t-20"></div>
                                <form id="search" method="GET" class="row">
                                    <div class="col-sm-12 col-lg-4">
                                            <div class="form-group row">
                                                <label for="email2" class="col-sm-4 text-right control-label col-form-label">Start Date</label>
                                                <div class="col-sm-8">
                                                  <input autocomplete="off" id="start_date" value="{{$s_date}}" name="start_date" type="text" class="form-control mydatepicker" placeholder="dd/mm/yyyy">
                                                </div>
                                            </div>
                                    </div>
                                    <div class="col-sm-12 col-lg-4">
                                            <div class="form-group row">
                                                <label for="email2" class="col-sm-3 text-right control-label col-form-label">End Date</label>
                                                <div class="col-sm-9">
                                                  <input value="{{$e_date}}" autocomplete="off" id="end_date" name="end_date" type="text" class="form-control mydatepicker" placeholder="dd/mm/yyyy">
                                                </div>
                                            </div>
                                    </div>
                                    <div class="col-sm-12 col-lg-4">
                                            <div class="form-group row">
                                                <label for="email2" class="col-sm-3 text-right control-label col-form-label">Supplier</label>
                                                <div class="col-sm-9">
                                                  <select id="supplier" name="supplier" class="form-control select2">
                                                    <option value="" >Select Supplier</option>
                                                    @foreach($suppliers as $supplier)
                                                    <option value="{{$supplier->supplier_id}}" >{{$supplier->supplier_name}}</option>
                                                    @endforeach

                                                </select>
                                                </div>
                                            </div>
                                    </div>
                                   <!--  <div class="col-sm-12 col-lg-4">
                                        <div class="form-group row">
                                            <label for="email2" class="col-sm-3 text-right control-label col-form-label">Category</label>
                                            <div class="col-sm-9">
                                              <select id="by_duration" name="by_duration" class="form-control select2">
                                                <option value="Y-m-d" >Select Category</option>
                                                <option value="Y-W" >Weekly</option>
                                                <option value="Y-M" >Monthly</option>
                                                <option value="Y">Yearly</option>
                                            </select>
                                            </div>
                                        </div>
                                    </div> -->
                                    <div class="col-sm-12 col-lg-4">
                                        <div class="form-group row">
                                            <label for="email2" class="col-sm-3 text-right control-label col-form-label">Brand</label>
                                            <div class="col-sm-9">
                                              <select onchange="get_product();" id="brand" name="brand" class="form-control select2">
                                                <option value="" >Select Brand</option>
                                                @foreach($brands as $brand)
                                                <option value="{{$brand->brand_id}}" >{{$brand->brand_name}}</option>
                                                @endforeach

                                            </select>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-sm-12 col-lg-4">
                                        <div class="form-group row">
                                            <label for="email2" class="col-sm-3 text-right control-label col-form-label">Product</label>
                                            <div class="col-sm-9">
                                              <select id="product" onchange="get_product_color();" name="product" class="form-control select2">
                                                <option value="" >Select Product</option>

                                            </select>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-sm-12 col-lg-4">
                                        <div class="form-group row">
                                            <label for="email2" class="col-sm-3 text-right control-label col-form-label">Color</label>
                                            <div class="col-sm-9">
                                              <select id="color" name="color" class="form-control select2">
                                                <option value="" >Select Color</option>

                                            </select>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-sm-12 col-lg-4">
                                        <div class="form-group row">
                                            <label for="email2" class="col-sm-3 text-right control-label col-form-label">IMEI</label>
                                            <div class="col-sm-9">
                                             <input type="text" placeholder="Enter IMEI" name="imei" id="imei">
                                            </div>
                                        </div>
                                    </div>


                                    <div class="col-sm-2">
                                        <div class="form-group">
                                            <button onclick="createpdf();" id="btnsearch" class="btn btn-success" type="button" >Search</button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                    <div class="col-12" id="search_result">
                     @include('backend.reports.tables.stock_imei_table')


                    </div>
                    <div id="pdflentt" style="display: none;"></div>

                </div>
                <!-- ============================================================== -->
                <!-- End PAge Content -->
                <!-- ============================================================== -->
                <!-- ============================================================== -->
                <!-- Right sidebar -->
                <!-- ============================================================== -->
                <!-- .right-sidebar -->
                <!-- ============================================================== -->
                <!-- End Right sidebar -->
                <!-- ============================================================== -->
            </div>
            <!-- ============================================================== -->
            <!-- End Container fluid  -->
            @endsection
            @section('script')

 <link rel="stylesheet" type="text/css" href="{{url('/public/css/bootstrap-datepicker.min.css')}}">

            <script src="{{url('/public/js/bootstrap-datepicker.min.js')}}"></script>
            <script src="{{url('/public/js/jquery.validate.min.js')}}"></script>


             <script type="text/javascript">
                function get_product_color(){
                        var id=$('#product').val();

                        $.ajax({

                            type : 'POST',
                            url  : "{{url('get_productById')}}",
                            data:{id:id},
                             //dataType: 'json',
                            success :  function (data)
                            {

                                $('#color').html(data);

                            },
                            error :  function (data)
                            {
                                console.log(data);
                            }
                        });
                    }
                 function get_product(){
                        var id=$('#brand').val();
                            //console.log("{{url('get_productById')}}/"+id);
                        $.ajax({

                            type : 'POST',
                            url  : "{{url('get_productById')}}",
                            data:{brand_id:id},
                             dataType: 'json',
                            success :  function (data)
                            {

                                //var d=JSON.parse(data);

                                var color="<option value=''>Select Product</option>";
                                $.each(data,function(){
                                    console.log(this.product_id);
                                    color +="<option value='"+this.product_id+"'> "+this.product_name+" </option>";
                                });
                               // console.log(color);
                                $('#product').html(color);

                            },
                            error :  function (data)
                            {
                                //console.log(data);
                            }
                        });
                    }
                $('.mydatepicker').datepicker({
                    format: 'yyyy-mm-dd',
        autoclose: true,
        todayHighlight: true
    });
            $(document).ready(function() {


            });

            //search
            $("#search").validate({

                    rules:
                   {
                        start_date: {
                            required: true,

                        },


                   },
                    submitHandler: submitForm
                  });
            function submitForm(url='') {

                event.preventDefault();
                getdata();

                return false;
            }
            $('#brand,#cnf,#supplier,#product,#imei,#color,#by_duration,#category,#start_date,#end_date').change(function(){
                getdata();
            });
            //end search
            function getdata(page = 1){
                //var data1 = new FormData(document.getElementById('search'));
                var s_date= $('#start_date').val();
                var e_date= $('#end_date').val();

                var supplier= $('#supplier').val();
                var brand= $('#brand').val();
                var product= $('#product').val();
                var imei= $('#imei').val();
                var color= $('#color').val();
                //if(url == ''){

                  var  url="{{url('reports/stock_imei')}}?page="+page+"&s_date="+s_date+"&e_date="+e_date+"&supplier="+supplier+"&brand="+brand+"&product="+product+"&imei="+imei+"&color="+color;
               // }

                  $('#search_result').css('text-align','center');
                $('#search_result').html('<img style="width: 100px;" src="http://rpg.drivethrustuff.com/shared_images/ajax-loader.gif"/>');
                $.ajax({

                    type : 'GET',
                    url  : url,
                    data : {s_date:s_date},
                    cache:false,
                    //datatype: "json",
                    contentType: false,
                    processData: false,
                    success :  function (data)
                    {
                       // console.log(data);
                        $('#search_result').css('text-align','initial');
                        $("#search_result").html(data);


                    },error: function(response) {
                        console.log(response);
                    }
                });
            }

            $(document).on('click', '.pagination a',function(event)
                {
                    event.preventDefault();

                    $('li').removeClass('active');
                    $(this).parent('li').addClass('active');

                    var myurl = $(this).attr('href');
                    var page=$(this).attr('href').split('page=')[1];

                    getdata(page);
                });
            </script>
            <script src="{{url('/public/js/jspdf.debug.js')}}"></script>
            <script type="text/javascript">
            var currentHeight = 20;
             let logo = null;
            function exportSaleIemi(arg,type){
                $(arg).prop('disabled', true);
                //console.log($(arg).parent().serialize());
                 // var  url="{{url('reports/sales_imei_report_pdf')}}?"+$(arg).parent().serialize();
                 // $.ajax({

                 //    type : 'GET',
                 //    url  : url,
                 //    cache:false,
                 //    //datatype: "json",
                 //    contentType: false,
                 //    processData: false,
                 //    success :  function (data)
                 //    {
                        //console.log($('#dtables'));
                       // console.log(document.getElementById('dtables').rows);
                        //console.log(findhtml(data));
                        var pdf = new jsPDF('landscape', 'pt', 'letter');
                        pdf.setFontSize(10);
                        pdf.addImage(logo, 2,20, 130, 25);
                        addtext(pdf,"MAKTEL LIMITED");
                        addtext(pdf,"House-277(Level-4),Lane-4,Baridhara DOHS,Dhaka-1206.");
                        addtext(pdf,"Hotline:+88 01844241530");
                        addtext(pdf,"Mobile:+88 01844241530");
                        addtext(pdf,"Email:info@maktel.com.bd");
                        addtext(pdf,"Web:www.maktel.com.bd");
                        addtext(pdf,"Web:www.maktel.com.bd");
                        addtext(pdf,"Facebook:www.facebook.com/maktel");
                        pdf.setFontSize(12);
                        var star_date = $('#start_date').val().split("-");
                        var end_date = $('#end_date').val().split("-");
                        pdf.text(10,currentHeight,"Stock IMEI Report");
                        currentHeight += txtLenth("Stock IMEI Report",0);
                       // addtext(pdf,"Sales IMEI Report");
                        var dateTex="Date: "+star_date[2]+'-'+star_date[1]+'-'+star_date[0]+" to "+end_date[2]+'-'+end_date[1]+'-'+end_date[0];
                        pdf.text(10,currentHeight,dateTex);
                        currentHeight += txtLenth(dateTex,0)-5;
                       // addtext(pdf,dateTex);
                        t_data = [];
                        headers = [];
                        //var element1 = findhtml(data);
                        //var ss= element1;

                        var table = document.getElementById('dtables');
                        var tableRow,cell,rowData,i = 0,j = 0;
                        while (i < table.rows[0].cells.length) {
                             cell = table.rows[0].cells[i];
                            if(i == table.rows[0].cells.length-1){
                                 headers[i] = {
                                    name : cell.textContent.toLowerCase().replace(/\s+/g, ''),
                                    prompt : cell.textContent.replace(/\r?\n/g, ''),
                                    width : (parseInt($(cell).attr('width'))/100) * pdf.internal.pageSize.width-1.5
                                };
                            }else{
                                 headers[i] = {
                                    name : cell.textContent.toLowerCase().replace(/\s+/g, ''),
                                    prompt : cell.textContent.replace(/\r?\n/g, ''),
                                    width : (parseInt($(cell).attr('width'))/100) * pdf.internal.pageSize.width
                                };
                            }
                            i++;
                        }
                        i=1;
                        while (i < table.rows.length) {
                            tableRow = table.rows[i];
                            rowData = {};
                            j = 0;
                            while (j < tableRow.cells.length) {
                                rowData[headers[j].name] = tableRow.cells[j].textContent.replace(/\r?\n/g, '');
                                j++;
                            }
                            t_data.push(rowData);
                            i++;
                        }
                        pdf.setFontSize(8);
                        pdf.table_font_size=8;
                        // console.log(t_data);
                        // console.log(headers);
                        pdf.table(1.5, currentHeight, t_data, headers, {
                            autoSize : false,
                            printHeaders : true,
                            fontSize : 8,
                        });

                        if(type == 'pdf'){
                            $(arg).prop('disabled', false);
                            pdf.save('stock_imei_report.pdf');
                        }else{
                            $(arg).prop('disabled', false);
                            window.open(pdf.output('bloburl'));
                            //pdf.output();
                        }

                        //currentHeight=0;

                //     }
                // });
                //createpdf();
            }
            function findhtml(element){
                element = (function (element) {
                var $frame,
                    $hiddendiv,
                    framename,
                    visuallyhidden;
                    framename = "jsPDFhtmlText" + Date.now().toString() + (Math.random() * 1000).toFixed(0);
                    visuallyhidden = "position: absolute !important;" + "clip: rect(1px 1px 1px 1px); /* IE6, IE7 */" + "clip: rect(1px, 1px, 1px, 1px);" + "padding:0 !important;" + "border:0 !important;" + "height: 1px !important;" + "width: 1px !important; " + "top:auto;" + "left:-100px;" + "overflow: hidden;";
                    $hiddendiv = document.createElement('div');
                    $hiddendiv.style.cssText = visuallyhidden;
                    $hiddendiv.innerHTML = "<iframe style=\"height:1px;width:1px\" name=\"" + framename + "\" />";
                    document.body.appendChild($hiddendiv);
                    $frame = window.frames[framename];
                    $frame.document.body.innerHTML = element;
                    return $frame.document.body;
                })(element.replace(/<\/?script[^>]*?>/gi, ''));
               // console.log(element.childNodes);
                return element;
            }

            var imgUrl="{{url('/public/images/text_logo.png')}}";
            getDataUri(imgUrl, function(dataUri) {
                logo = dataUri;
               // console.log("logo=" + logo);
            });
            function getDataUri(url, cb)
            {
                var image = new Image();
                image.setAttribute('crossOrigin', 'anonymous'); //getting images from external domain

                image.onload = function () {
                    var canvas = document.createElement('canvas');
                    canvas.width = this.naturalWidth;
                    canvas.height = this.naturalHeight;

                    //next three lines for white background in case png has a transparent background
                    var ctx = canvas.getContext('2d');
                    ctx.fillStyle = '#fff';  /// set white fill style
                    ctx.fillRect(0, 0, canvas.width, canvas.height);

                    canvas.getContext('2d').drawImage(this, 0, 0);

                    cb(canvas.toDataURL('image/jpeg'));
                };

                image.src = url;
            }
            function txtLenth(str,is_w=1){
                $('#pdflentt').css('font-size','10px');
                $('#pdflentt').text(str);
                if(is_w == 1){
                    return $('#pdflentt').width();
                }else{
                    return $('#pdflentt').height();
                }

            }
            function addtext(pdf,text){
                var h= txtLenth(text,0)-5;
                 pdf.text((pdf.internal.pageSize.width-txtLenth(text))/2,currentHeight,text);
                 currentHeight += h;
            }
            function createpdf(){

               var pdf = new jsPDF('p', 'pt', 'letter');
               var str = 'This is a title';
                pdf.setFontSize(10);
                pdf.addImage(logo, 2,20, 130, 25);
                console.log(currentHeight);
                addtext(pdf,"MAKTEL LIMITED");
                addtext(pdf,"House-277(Level-4),Lane-4,Baridhara DOHS,Dhaka-1206.");
                addtext(pdf,"Hotline:+88 01844241530");
                console.log(currentHeight);
                addtext(pdf,"Mobile:+88 01844241530");
                console.log(currentHeight);
                addtext(pdf,"Email:info@maktel.com.bd");
                addtext(pdf,"Web:www.maktel.com.bd");
                addtext(pdf,"Web:www.maktel.com.bd");
                addtext(pdf,"Facebook:www.facebook.com/maktel");
            console.log(pdf);
            console.log(currentHeight);

               //pdf.text((pdf.internal.pageSize.width-txtLenth(str))/2, 20,str);

               pdf.save('Tesst.pdf');

               //var source = $('#search_result')[0];
               // pdf.fromHTML(
               //       source // HTML string or DOM elem ref.
               //      ,2 // x coord
               //      , 2 // y coord
               //      , {
               //          'width': 522 // max width of content on PDF
               //      },
               //      function (dispose) {
               //        // dispose: object with X, Y of the last line add to the PDF
               //        //          this allow the insertion of new lines after html
               //        pdf.save('Tesst.pdf');
               //      }

               //  );
            }
            </script>
            @endsection

VaKeR 2022