<!DOCTYPE html>
<html lang="en">
    <?php
    use App\Models\Employess;
    $EMP=Employess::find(auth()->guard('admin')->user()->emp);
    use App\Models\DefaultDataShowHide;
    use App\Models\CrmDefaultData;
    use App\Models\CompanyData;
    use App\Models\SalesDefaultData;
$show=DefaultDataShowHide::orderBy('id','desc')->first();
$crm=CrmDefaultData::orderBy('id','desc')->first();
$Default=CompanyData::orderBy('id','desc')->first();
$Def=SalesDefaultData::orderBy('id','desc')->first();    
    $Style='none';
    $credStyle="none";
 use App\Models\StoresDefaultData;
      $FCOST=StoresDefaultData::orderBy('id','desc')->first();
  
    ?>
    <head>
        <meta charset="utf-8">
        <title>
<?php echo e(trans('admin.POS')); ?>     
        </title>
        <meta name="description" content="Analytics Dashboard">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, user-scalable=no, minimal-ui">
        <!-- Call App Mode on ios devices -->
        <meta name="apple-mobile-web-app-capable" content="yes" />
        <!-- Remove Tap Highlight on Windows Phone IE -->
        <meta name="msapplication-tap-highlight" content="no">
        <!-- base css -->
        <link id="vendorsbundle" rel="stylesheet" media="screen, print" href="<?php echo e(asset('Admin/css/vendors.bundle.css')); ?>">
        <link id="appbundle" rel="stylesheet" media="screen, print" href="<?php echo e(asset('Admin/css/app.bundle.css')); ?>">
        <link id="mytheme" rel="stylesheet" media="screen, print" href="#">
        <link id="myskin" rel="stylesheet" media="screen, print" href="<?php echo e(asset('Admin/css/skins/skin-master.css')); ?>">

       
        <link rel="stylesheet" media="screen, print" href="<?php echo e(asset('Admin/css/style.css')); ?>">
        <link rel="stylesheet" media="screen, print" href="<?php echo e(asset('Admin/css/style-ar.css')); ?>">
        <link rel="stylesheet" media="screen, print" href="<?php echo e(asset('Admin/keyboard/keyboard.css')); ?>">
        <link href="https://fonts.googleapis.com/icon?family=Material+Icons"
      rel="stylesheet">
        <!-- Place favicon.ico in the root directory -->
         <link rel="apple-touch-icon" sizes="180x180" href="<?php echo e(URL::to($Default->Icon)); ?>">
      <link rel="icon" type="image/png" sizes="32x32" href="<?php echo e(URL::to($Default->Icon)); ?>">
      <link rel="mask-icon" href="<?php echo e(URL::to($Default->Icon)); ?>" color="#5bbad5">
        <link rel="stylesheet" media="screen, print" href="<?php echo e(asset('Admin/css/miscellaneous/reactions/reactions.css')); ?>">
    <link rel="stylesheet" media="screen, print" href="<?php echo e(asset('Admin/css/formplugins/select2/select2.bundle.css')); ?>">

    </head>
  <style>

      .bt{
              background: none;
    border: none;
    color: red;
      }
      
      #data{      
    position: absolute;
    z-index: 2;
    border: 1px solid black;
    padding: 10px;
    background: #886ab5;
    color: white;
    margin-top: 37px;
    text-align: center;
    margin-left:13px;
    max-height: 497px;
    overflow: auto;
    /*margin-right: 50px;*/
      }
      
      .BUT{
        
              background: none;
    color: white;
    border: none;
          
      }
      
      .BUT:hover{
          cursor: pointer;
          background: #d5cee0;
          
      }
      .second-section table .form-control{
          padding: 0.5rem 0.3rem;
      }
      
    </style>
            <style>
            body{
                direction: rtl!important;
                overflow: hidden;
                /* height: 100%; */
            }
            @media(max-width:600px){
                
                body{
                   overflow:auto; 
                }
            }
        </style>
    
<?php if(app()->getLocale() == 'en'): ?>
<style>
    .ENGLISH{
        
        direction: ltr;
    }    
    
    .TABLEENGLISH{
        
        text-align: left;
    }
    
    
    .modal-header, .modal-body {
    direction: ltr !important;
    text-align: left !important;
    }   
    
 .modal-footer{
    direction: rtl !important;
    }
</style>    
<?php endif; ?>    
    
    
    <body class="mod-bg-1 mod-nav-link ">

        <script>
    
            'use strict';

            var classHolder = document.getElementsByTagName("BODY")[0],
                /** 
                 * Load from localstorage
                 **/
                themeSettings = (localStorage.getItem('themeSettings')) ? JSON.parse(localStorage.getItem('themeSettings')) :
                {},
                themeURL = themeSettings.themeURL || '',
                themeOptions = themeSettings.themeOptions || '';
            /** 
             * Load theme options
             **/
            if (themeSettings.themeOptions)
            {
                classHolder.className = themeSettings.themeOptions;
                console.log("%c✔ Theme settings loaded", "color: #148f32");
            }
            else
            {
                console.log("%c✔ Heads up! Theme settings is empty or does not exist, loading default settings...", "color: #ed1c24");
            }
            if (themeSettings.themeURL && !document.getElementById('mytheme'))
            {
                var cssfile = document.createElement('link');
                cssfile.id = 'mytheme';
                cssfile.rel = 'stylesheet';
                cssfile.href = themeURL;
                document.getElementsByTagName('head')[0].appendChild(cssfile);

            }
            else if (themeSettings.themeURL && document.getElementById('mytheme'))
            {
                document.getElementById('mytheme').href = themeSettings.themeURL;
            }
            /** 
             * Save to localstorage 
             **/
            var saveSettings = function()
            {
                themeSettings.themeOptions = String(classHolder.className).split(/[^\w-]+/).filter(function(item)
                {
                    return /^(nav|header|footer|mod|display)-/i.test(item);
                }).join(' ');
                if (document.getElementById('mytheme'))
                {
                    themeSettings.themeURL = document.getElementById('mytheme').getAttribute("href");
                };
                localStorage.setItem('themeSettings', JSON.stringify(themeSettings));
            }
            /** 
             * Reset settings
             **/
            var resetSettings = function()
            {
                localStorage.setItem("themeSettings", "");
            }

        </script>
            <span id="ex"> <?php echo $__env->make('admin.layouts.messages', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?></span> 
    <form id="form" action="<?php echo e(url('PostPOS')); ?>" method="post">    
        <?php echo csrf_field(); ?>

        
        <input type="hidden" id="priceSale" value="<?php echo e(auth()->guard('admin')->user()->price_sale); ?>">
        <input type="hidden" id="discount" value="<?php echo e(auth()->guard('admin')->user()->discount); ?>">
            <input type="hidden" name="Shift_Code"  value="<?php echo e($shift->Code); ?>">   
                  <input type="hidden" name="Hold" id="HOLD" value="0">
        <div class="start-pos">
            <div class="row">
                
                <?php if(auth()->guard('admin')->user()->pos_product == 1): ?>
                
                <div class="col-md-6 ENGLISH">
                    <div class="second-card card">
                        <div class="first-part">
                        <div class="top-btn">
                            <div class="row">
                                <div class="col-md-4">
                                 <button onclick="Lock()" type="button" class="btn btn-block btn-outline-primary waves-effect waves-themed" data-toggle="modal" data-target="#default-example-modal-center-shiftDetails">
                                     <span class="fal fa-toggle-on "></span>
                                     <?php echo e(trans('admin.Shift_Details')); ?>

                                 </button>  
                                </div>
                                <div class="col-md-4">
                                 <button type="button" class="btn btn-block btn-outline-primary waves-effect waves-themed" data-toggle="modal" data-target="#default-example-modal-center-closeShift">
                                     <span class="fal fa-toggle-off "></span> <?php echo e(trans('admin.Close_Shift')); ?>

                                 </button>
                                </div>
                                <div class="col-md-4">
                                 <a href="<?php echo e(url('KlarAdmin')); ?>" type="button" class="btn btn-block btn-outline-primary waves-effect waves-themed">
                                     <span class="fal fa-home-alt "></span><?php echo e(trans('admin.Home')); ?>


                                 </a>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-4">
                                    <button type="button" class="btn btn-block btn-primary waves-effect waves-themed" data-toggle="modal" data-target="#groups">
                                        <?php echo e(trans('admin.Groups')); ?>

                                    </button>
                                   </div>
                                   <div class="col-md-4">
                                    <button type="button" class="btn btn-block btn-primary waves-effect waves-themed" data-toggle="modal" data-target="#brands">
                                           <?php echo e(trans('admin.Brands')); ?> 
                                    </button>
                                   </div>
                                   <div class="col-md-4">
                                    <button type="button" class="btn btn-block btn-primary waves-effect waves-themed" onclick="AllProductsPOS()">
                                           <?php echo e(trans('admin.All_Products')); ?> 
                                    </button>
                                   </div>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                         <?php if($show->SearchCode == 1): ?>
                        <div class="form-group col-lg-6">
                        <span  id="data" style="display: none">
                            <div class="row Data">
                            </div>
                            </span>    
                            <div class="input-items">
                             <input type="text" id="search" class="form-control" placeholder="   <?php echo e(trans('admin.Search_For_Products')); ?>" autofocus>
                          
                                      <?php if(app()->getLocale() == 'ar' ): ?>
                     <i class="fal fa-barcode-alt" style="position:absolute ;top:5px;left:3px;"></i>
                      <?php else: ?>
                            <i class="fal fa-barcode-alt" style="position:absolute ;top:5px;right: 0;left:auto;"></i>
                      <?php endif; ?>
                            </div>
                         </div>
                        <div class="form-group col-lg-6">  
                            <div class="input-items">
                             <input type="text" id="SearchCode" class="form-control" placeholder="<?php echo e(trans('admin.SearchCode')); ?>" autofocus>
                        
                                      <?php if(app()->getLocale() == 'ar' ): ?>
                     <i class="fal fa-barcode-alt" style="position:absolute ;top:5px;left:3px;"></i>
                      <?php else: ?>
                            <i class="fal fa-barcode-alt" style="position:absolute ;top:5px;right: 0;left:auto;"></i>
                      <?php endif; ?>
                            </div>
                         </div>
                        <?php else: ?>
                    <div class="form-group col-lg-12">
                        <span  id="data" style="display: none">
                            <div class="row Data">

                            </div>
                            </span>    
                            <div class="input-items">
                             <input type="text" id="search" class="form-control" placeholder="   <?php echo e(trans('admin.Search_For_Products')); ?>" autofocus>
                          
                                      <?php if(app()->getLocale() == 'ar' ): ?>
                     <i class="fal fa-barcode-alt" style="position:absolute ;top:5px;left:3px;"></i>
                      <?php else: ?>
                            <i class="fal fa-barcode-alt" style="position:absolute ;top:5px;right: 0;left:auto;"></i>
                      <?php endif; ?>
                            </div>
                         </div>
                        
                        <?php endif; ?>
                    </div>
                    <div class="second-part">
                        
                          <div class="row">
                              
                          <div class="col-md-12">
                              <!--<h4><?php echo e(trans('admin.Products')); ?></h4>-->
                              <div class="items">
                                <audio id="audio"><source src="<?php echo e(asset('Admin/css/click.wav')); ?>" type="audio/ogg" /> </audio>
                                  <div class="row Group">
                                     
                                  </div>
                              </div>
                          </div>
                          
                        </div>
                    </div>
                    </div>
                </div>
                
                <?php endif; ?>
                
                
                <div class="col-md-6 ENGLISH" >
                    <div class="first-card card">
                        <div class="first-section">
                            
                     <?php if(auth()->guard('admin')->user()->pos_product == 1): ?>
                       <div class="row">
                        <div class="form-group col-lg-2 col-4">
                           <label class="form-label" for="simpleinput"><?php echo e(trans('admin.Code')); ?> </label>
                                            <input type="text" value="<?php echo e($Code); ?>" class="form-control " disabled>
                                            <input type="hidden" name="Code" value="<?php echo e($Code); ?>" class="form-control">
                        </div>
                     
                        
                              <?php if(auth()->guard('admin')->user()->emp == 0): ?>
                          <div class="form-group col-lg-2 col-4">
                                                 <label class="form-label" for="simpleinput"><?php echo e(trans('admin.Date')); ?></label>
                           <input type="date" name="Date" value="<?php echo e(date('Y-m-d')); ?>" class="form-control" required>
                        </div>
                                        <?php else: ?>
                                        
                                         <?php if(auth()->guard('admin')->user()->Date == 1): ?>
                   <div class="form-group col-lg-2 col-4">
                                                 <label class="form-label" for="simpleinput"><?php echo e(trans('admin.Date')); ?></label>
                           <input type="date" name="Date" value="<?php echo e(date('Y-m-d')); ?>" class="form-control" required>
                        </div>
                                        <?php else: ?>
                     <div class="form-group col-lg-2 col-4">
                                                 <label class="form-label" for="simpleinput"><?php echo e(trans('admin.Date')); ?></label>
                           <input type="date" name="Date" value="<?php echo e(date('Y-m-d')); ?>" class="form-control" required readonly>
                        </div>
                                        <?php endif; ?>
                                        
                                        <?php endif; ?>
                         
                           <?php if($show->POS_RecivedDate == 1): ?>
                                    <div class="form-group col-lg-2 col-4">
                                                 <label class="form-label" for="simpleinput"><?php echo e(trans('admin.RecivedDate')); ?></label>
                           <input type="date" name="RecivedDate" value="" class="form-control">
                        </div>
                           <?php else: ?>
                           <input type="hidden" name="RecivedDate" value="" class="form-control"> 
                           <?php endif; ?>
                           
      <?php if(auth()->guard('admin')->user()->pos_stores == 0): ?>                        
<input type="hidden" name="Store" id="store" value="<?php echo e(auth()->guard('admin')->user()->store); ?>">
        <?php else: ?>
<div class="form-group col-lg-3 col-4">
        <label class="form-label" for=""><?php echo e(trans('admin.Store')); ?></label>
                                            <select class="select2 form-control w-100" id="store" name="Store" required>
                                            <?php $__currentLoopData = $Stores; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $stor): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>    
            <option value="<?php echo e($stor->Store); ?>" <?php if(auth()->guard('admin')->user()->store == $stor->Store): ?> selected <?php endif; ?>>
                                        <?php if(!empty($stor->Store()->first()->Name)): ?>        
                 <?php echo e(app()->getLocale() == 'ar' ?$stor->Store()->first()->Name :$stor->Store()->first()->NameEn); ?>

                
                <?php endif; ?>
                                                </option>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>    
                                            </select>
                                        </div>                       
        <?php endif; ?>                   
                           
                           
                           
<input type="hidden" name="Safe"  value="<?php echo e(auth()->guard('admin')->user()->safe); ?>">
<input type="hidden" name="Coin"  value="<?php echo e($Def->Coin); ?>">
<input type="hidden" name="Draw"  value="<?php echo e($Def->Draw); ?>">
<input type="hidden" name="Status"  value="1">
            
                           
                           
                           
                           
<?php if(auth()->guard('admin')->user()->emp != 0): ?>    
                           
                           
                               <?php if($show->Executor_Sale == 1): ?>
                           
                           
                                   <?php if($Def->ExecuteEmp == 0): ?>
                             <input type="hidden" name="Executor" value="<?php echo e(auth()->guard()->user()->executor); ?>">  
                           <?php else: ?>
                                         <div class="form-group col-lg-2">
                                            <label class="form-label" for=""><?php echo e(trans('admin.Executor')); ?></label>
                                  <select  class="js-data-example-ajax form-control w-100" id="Emp" name="Executor" >
      <option value="<?php echo e(auth()->guard()->user()->executor); ?>">
                                      
                         <?php echo e(app()->getLocale() == 'ar' ?auth()->guard()->user()->executor()->first()->Name :auth()->guard()->user()->executor()->first()->NameEn); ?>              
                                      </option>
                                            </select>  
                                        </div>
                           
                           <?php endif; ?>
                           
                           
                                        <?php else: ?>
                       <input type="hidden" name="Executor" value="<?php echo e(auth()->guard()->user()->executor); ?>">  
                                        <?php endif; ?>
                                                                   
                                                
                   
<?php endif; ?>                    
                           
                           
                           
                           
                           
                   
                           <?php if($crm->Client_Delegate == 1): ?>
                        <div class="form-group col-lg-3 col-sm-12">
                            <label class="form-label" for="Status"><?php echo e(trans('admin.Account')); ?> (<?php echo e(trans('admin.Client')); ?>)</label>
                       <select  class="select2 form-control w-100" id="client" name="Client" required>

                            
                    
                                            </select>  
                        </div>
                           <?php else: ?>
                                   <div class="form-group col-lg-3 col-sm-12">
                            <label class="form-label" for="Status"><?php echo e(trans('admin.Account')); ?> (<?php echo e(trans('admin.Client')); ?>)</label>
                       <select  class="select2 form-control w-100" id="client" name="Client" required>

                            <option value="<?php echo e($Def->Client); ?>">
                           
                            <?php echo e(app()->getLocale() == 'ar' ?$Def->Client()->first()->Name :$Def->Client()->first()->NameEn); ?>

                           </option>
                    
                                            </select>  
                        </div>
                           <?php endif; ?>
                           
                             <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('خانه رصيد حساب العميل')): ?>   <?php $credStyle="block"; ?> <?php endif; ?>

                         <div class="form-group col-lg-2 col-4" style="display: <?php echo e($credStyle); ?>">
                     <label class="form-label" for="simpleinput"> <?php echo e(trans('admin.Account_Credit')); ?> </label>
                             <input type="text" id="AccountCredit" value="0" class="form-control " disabled>
                        </div>
                        <div class="form-group col-lg-1 col-2">
                            <button style="margin-top: 23px;height: 27px;line-height: 13px;" type="button" class="btn btn-default" data-toggle="modal" data-target="#NewClient">
                                <i class="fal fa-user"></i>          
                         </button>
                        </div>
                       
                           
                          <?php if($EMP->Emp_Type != 'Saller'): ?> 
                        <div class="form-group col-lg-4 col-4">
                   <label class="form-label" for="Status"><?php echo e(trans('admin.Delegate')); ?></label>
                               <select class="select2 form-control w-100 EmpDele" name="Delegate">
                                          <option value=""> <?php echo e(trans('admin.Delegate')); ?></option>
                                            <?php $__currentLoopData = $Employess; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $emp): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>    
                                                <option value="<?php echo e($emp->id); ?>" <?php if($Def->Delegate == $emp->id): ?> selected <?php endif; ?>>
                                  
                                     <?php echo e(app()->getLocale() == 'ar' ?$emp->Name :$emp->NameEn); ?>                
                                                </option>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>  
                                            </select>
                        </div>
                           <?php else: ?>
                     <input type="hidden" name="Delegate"  value="<?php echo e($EMP->id); ?>">      
                           
                           <?php endif; ?>

                           

                                         <?php if($show->Show_File_Sales == 1): ?>
                                     <div class="form-group col-lg-12">
                                    <label class="form-label" for="simpleinput"><?php echo e(trans('admin.File')); ?></label>
                                    <input type="file" name="File"  class="form-control">
                                </div>    
                                <?php endif; ?>         
                           
                            <?php if($show->Note_POS == 1): ?>
                        <div class="form-group col-lg-1 col-2">
                            <button type="button" class="btn btn-default pos-icon" data-toggle="modal" data-target="#Note">
                                 <a data-toggle="tooltip" data-placement="top" title="<?php echo e(trans('admin.Note')); ?>">
                                <img src="<?php echo e(asset('Admin/img/245-edit-document-outline (1).gif')); ?>" alt="">    
                                </a>     
                         </button>
                        </div>
                           <?php endif; ?>
                           
                           <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('اضافه سند قبض')): ?>   
                      <div class="form-group col-lg-1 col-2">
                            <button type="button" class="btn btn-default pos-icon" data-toggle="modal" data-target="#Recipt">
                                 <a data-toggle="tooltip" data-placement="top" title="<?php echo e(trans('admin.Recipt_Voucher')); ?>">
                                <img src="<?php echo e(asset('Admin/img/37-approve-checked-simple-outline.gif')); ?>" alt="">    
                                </a>     
                         </button>
                        </div> 
                           <?php endif; ?> 
                           
                                  <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('سند عميل')): ?>   
                        <div class="form-group col-lg-1 col-2">
                            <button type="button" class="btn btn-default pos-icon" data-toggle="modal" data-target="#ReciptTwo">
                                 <a data-toggle="tooltip" data-placement="top" title="<?php echo e(trans('admin.Client_Voucher')); ?>">
                                <img src="<?php echo e(asset('Admin/img/981-consultation-outline (1).gif')); ?>" alt="">    
                                </a>     
                         </button>
                        </div>
                           <?php endif; ?> 
                           
           
                           
                           
                              <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('اضافه سند صرف')): ?>
                       <div class="form-group col-lg-1 col-2">
                            <button type="button" class="btn btn-default pos-icon" data-toggle="modal" data-target="#PayVouch">
                                 <a data-toggle="tooltip" data-placement="top" title="<?php echo e(trans('admin.Payment_Voucher')); ?>">
                                <img src="<?php echo e(asset('Admin/img/290-coin-outline (1).gif')); ?>" alt="">
                                </a>
                         </button>
                        </div> 
                           <?php endif; ?>
                              <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('سند مصروف')): ?>
                        <div class="form-group col-lg-1 col-2">
                            <button type="button" class="btn btn-default pos-icon" data-toggle="modal" data-target="#PayyVouch">
                                 <a data-toggle="tooltip" data-placement="top" title="<?php echo e(trans('admin.Expenses_Voucher')); ?>">
                                <img src="<?php echo e(asset('Admin/img/12-layes-outline (2).gif')); ?>" alt="">
                                </a>
                         </button>
                        </div>   
                           <?php endif; ?>
                                       <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('سند مورد')): ?>
                    <div class="form-group col-lg-1 col-2">
                            <button type="button" class="btn btn-default pos-icon" data-toggle="modal" data-target="#PayyyVouch">
                                 <a data-toggle="tooltip" data-placement="top" title="<?php echo e(trans('admin.Vendor_Voucher')); ?>">
                                <img src="<?php echo e(asset('Admin/img/955-demand-outline.gif')); ?>" alt="">
                                </a>
                         </button>
                        </div>  
                           <?php endif; ?>
                                 
                           
                                        <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('جدول عرض سعر مصور')): ?> 
                        <div class="form-group col-lg-1 col-2">
                            <button type="button" class="btn btn-default pos-icon" data-toggle="modal" data-target="#">
                                 <a href="<?php echo e(url('QuoteImagesSechdule')); ?>" data-toggle="tooltip" data-placement="top" title="<?php echo e(trans('admin.QuoteImagesSechdules')); ?>" target="_blank">
                               <img src="<?php echo e(asset('Admin/img/56-document-outline (1).gif')); ?>" alt="">
                                </a>
                         </button>
                        </div>
                           <?php endif; ?>   
                           

                           
                              <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('عرض سعر مصور')): ?>
                        <div class="form-group col-lg-1 col-2">
                            <button type="button" class="btn btn-default pos-icon" data-toggle="modal" data-target="#">
                                 <a href="<?php echo e(url('QuoteImages')); ?>" data-toggle="tooltip" data-placement="top" title="<?php echo e(trans('admin.QuoteImages')); ?>" target="_blank">
                               <img src="<?php echo e(asset('Admin/img/62-film-outline.gif')); ?>" alt="">
                                </a>
                         </button>
                        </div>
                           <?php endif; ?>    
                           
                           
                             <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('جدول امر البيع')): ?>
                        <div class="form-group col-lg-1 col-2">
                            <button type="button" class="btn btn-default pos-icon" data-toggle="modal" data-target="#">
                                 <a href="<?php echo e(url('SalesOrderSechdule')); ?>" data-toggle="tooltip" data-placement="top" title="<?php echo e(trans('admin.SalesOrderSechdule')); ?>" target="_blank">
                               <img src="<?php echo e(asset('Admin/img/1384-page-view-array-outline.gif')); ?>" alt="">
                                </a>
                         </button>
                        </div>
                           <?php endif; ?> 
                               <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('جدول المبيعات')): ?>
                        <div class="form-group col-lg-1 col-2">
                            <button type="button" class="btn btn-default pos-icon" data-toggle="modal" data-target="#">
                                 <a   href="<?php echo e(url('SalesSechdule')); ?>" data-toggle="tooltip" data-placement="top" title="<?php echo e(trans('admin.SalesSechdule')); ?>" target="_blank">
                                 <img src="<?php echo e(asset('Admin/img/970-video-conference-outline (1).gif')); ?>" alt="">
                                </a>
                         </button>
                        </div>
                           <?php endif; ?>
                              <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('جدول عرض سعر')): ?>
                        <div class="form-group col-lg-1 col-2">
                            <button  type="button" class="btn btn-default pos-icon" data-toggle="modal" data-target="#">
                                 <a  href="<?php echo e(url('Quote_Sechdule')); ?>" data-toggle="tooltip" data-placement="top" title="<?php echo e(trans('admin.Quote_Sechdule')); ?>" target="_blank">
                                 <img src="<?php echo e(asset('Admin/img/298-coins-outline (1).gif')); ?>" alt=""> 
                                </a>
                         </button>
                            


                        </div>
                           <?php endif; ?>
                              <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('تقفيل اليوميه')): ?>
                        <div class="form-group col-lg-1 col-2">
                                 <a href="<?php echo e(url('DailyClosing')); ?>" class="btn btn-default pos-icon" data-toggle="tooltip" data-placement="top" title="<?php echo e(trans('admin.DailyClosing')); ?>" target="_blank">
                                  <img src="<?php echo e(asset('Admin/img/946-equity-security-outline.gif')); ?>" alt="">
                                </a>
                        </div>
                           <?php endif; ?>
                              <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('تقرير المصاريف')): ?>
                        <div class="form-group col-lg-1 col-2">
                                 <a href="<?php echo e(url('ExpensesReport')); ?>" class="btn btn-default pos-icon" data-toggle="tooltip" data-placement="top" title="<?php echo e(trans('admin.Expenses')); ?>" target="_blank">
                                  <img src="<?php echo e(asset('Admin/img/945-dividends-outline (1).gif')); ?>" alt="">
                                </a>
                        </div>
                           <?php endif; ?>
                              <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('اضافه تحويلات المخازن')): ?>
                        <div class="form-group col-lg-1 col-2">
                                 <a href="<?php echo e(url('StoresTransfers')); ?>" class="btn btn-default pos-icon" data-toggle="tooltip" data-placement="top" title="<?php echo e(trans('admin.Stores_Transfers')); ?>" target="_blank">
                                  <img src="<?php echo e(asset('Admin/img/950-attract-customers-outline (1).gif')); ?>" alt="">
                                </a>
                        </div>
                           <?php endif; ?>
                              <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('اضافه مشتريات')): ?>
                        <div class="form-group col-lg-1 col-2">
                                 <a href="<?php echo e(url('Purchases')); ?>" class="btn btn-default pos-icon" data-toggle="tooltip" data-placement="top" title="<?php echo e(trans('admin.Purchases')); ?>" target="_blank">
                                  <img height="20" src="<?php echo e(asset('Admin/img/526-paper-bag-vegetables-outline.gif')); ?>" alt="">
                                </a>
                        </div>
                           <?php endif; ?>
                              <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('جدول المشتريات')): ?>
                        <div class="form-group col-lg-1 col-2">
                                 <a href="<?php echo e(url('PurchasesSechdule')); ?>" class="btn btn-default pos-icon" data-toggle="tooltip" data-placement="top" title="<?php echo e(trans('admin.PurchasesSechdule')); ?>" target="_blank">
                                  <img height="20" src="<?php echo e(asset('Admin/img/1387-page-view-column-outline.gif')); ?>" alt="">
                                </a>
                        </div>
                           <?php endif; ?>
                                     <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('اضافه سلفه')): ?> 
                        <div class="form-group col-lg-1 col-2">
                                 <a href="<?php echo e(url('AddBorrow')); ?>" class="btn btn-default pos-icon" data-toggle="tooltip" data-placement="top" title="<?php echo e(trans('admin.Add_Borrow')); ?>" target="_blank">
                                  <img height="20" src="<?php echo e(asset('Admin/img/49-plus-circle-outline.gif')); ?>" alt="">
                                </a>
                        </div>
                           <?php endif; ?>
                                <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('الاصناف اليوميه')): ?>     
                        <div class="form-group col-lg-1 col-2">
                                 <a href="<?php echo e(url('DailyProducts')); ?>" class="btn btn-default pos-icon" data-toggle="tooltip" data-placement="top" title="<?php echo e(trans('admin.Products_Daily')); ?>" target="_blank">
                                  <img height="20" src="<?php echo e(asset('Admin/img/948-stock-share-outline (1).gif')); ?>" alt="">
                                </a>
                        </div>
                           <?php endif; ?>
                           
                                <?php if($show->Open_Drawer == 1): ?> 
                        <div class="form-group col-lg-1 col-2">
           
          <button type="button" class="btn btn-default pos-icon" data-toggle="modal" data-target="#OpenSafe">
                                 <a data-toggle="tooltip" data-placement="top" title="<?php echo e(trans('admin.Open_Safe_Drawer')); ?>" >
                                <img src="<?php echo e(asset('Admin/img/1933-vote-elections-outline.gif')); ?>" alt="">
                                </a>
                         </button>                            
                            
                        </div>
                    <?php endif; ?>
                           
                    </div>
                    <?php else: ?>        
                           <div class="row" style="display: none">
                        <div class="form-group col-lg-2 col-4">
                           <label class="form-label" for="simpleinput"><?php echo e(trans('admin.Code')); ?> </label>
                                            <input type="text" value="<?php echo e($Code); ?>" class="form-control " disabled>
                                            <input type="hidden" name="Code" value="<?php echo e($Code); ?>" class="form-control">
                        </div>
                        <div class="form-group col-lg-3 col-4">
                                                 <label class="form-label" for="simpleinput"><?php echo e(trans('admin.Date')); ?></label>
                           <input type="date" name="Date" value="<?php echo e(date('Y-m-d')); ?>" class="form-control" required>
                        </div>
                        
                         
                           
      <?php if(auth()->guard('admin')->user()->pos_stores == 0): ?>                        
<input type="hidden" name="Store" id="store" value="<?php echo e(auth()->guard('admin')->user()->store); ?>">
        <?php else: ?>
<div class="form-group col-lg-3 col-4">
        <label class="form-label" for=""><?php echo e(trans('admin.Store')); ?></label>
                                            <select class="select2 form-control w-100" id="store" name="Store" required>
                                            <?php $__currentLoopData = $Stores; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $stor): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>    
            <option value="<?php echo e($stor->Store); ?>" <?php if(auth()->guard('admin')->user()->store == $stor->Store): ?> selected <?php endif; ?>>
                                        <?php if(!empty($stor->Store)): ?>          
                
                 <?php echo e(app()->getLocale() == 'ar' ?$stor->Store()->first()->Name :$stor->Store()->first()->NameEn); ?>

                <?php endif; ?>
                                                </option>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>    
                                            </select>
                                        </div>                       
        <?php endif; ?>                   
                           
                           
                           
<input type="hidden" name="Safe"  value="<?php echo e(auth()->guard('admin')->user()->safe); ?>">
<input type="hidden" name="Coin"  value="<?php echo e($Def->Coin); ?>">
<input type="hidden" name="Draw"  value="<?php echo e($Def->Draw); ?>">
<input type="hidden" name="Status"  value="1">
                           
<?php if(auth()->guard('admin')->user()->emp != 0): ?>    
        <?php if($show->Executor_Sale == 1): ?>
                                         <div class="form-group col-lg-2">
                                            <label class="form-label" for=""><?php echo e(trans('admin.Executor')); ?></label>
                                  <select  class="js-data-example-ajax form-control w-100" id="Emp" name="Executor" >
      <option value="<?php echo e(auth()->guard()->user()->executor); ?>">
                                      
                             <?php echo e(app()->getLocale() == 'ar' ?auth()->guard()->user()->executor()->first()->Name :auth()->guard()->user()->executor()->first()->NameEn); ?>          
                                      </option>
                                            </select>  
                                        </div>
                                        <?php else: ?>
                       <input type="hidden" name="Executor" value="<?php echo e(auth()->guard()->user()->executor); ?>">  
                                        <?php endif; ?>
                                                                   
                           
                           

<?php else: ?>
        <?php if($show->Executor_Sale == 1): ?>
                                         <div class="form-group col-lg-2">
                                            <label class="form-label" for=""><?php echo e(trans('admin.Executor')); ?></label>
                                  <select  class="js-data-example-ajax form-control w-100" id="Emp" name="Executor" >


                                            </select>  
                                        </div>
                                        <?php else: ?>
                       <input type="hidden" name="Executor" value="">   
                                        <?php endif; ?>                           
                   
<?php endif; ?>                    
                   
                        <div class="form-group col-lg-3 col-4">
                            <label class="form-label" for="Status"><?php echo e(trans('admin.Account')); ?> (<?php echo e(trans('admin.Client')); ?>)</label>
                       <select  class="select2 form-control w-100" id="client" name="Client" required>

                              <option value="<?php echo e($Def->Client); ?>">
                                  
                                   <?php echo e(app()->getLocale() == 'ar' ?$Def->Client()->first()->Name :$Def->Client()->first()->NameEn); ?>

                           </option> 
                          
                    
                                            </select>  
                        </div>
                         <div class="form-group col-lg-2 col-4">
                     <label class="form-label" for="simpleinput"> <?php echo e(trans('admin.Account_Credit')); ?> </label>
                             <input type="text" id="AccountCredit" value="0" class="form-control " disabled>
                        </div>
                        <div class="form-group col-lg-1 col-2">
                            <button style="margin-top: 23px;height: 27px;line-height: 13px;" type="button" class="btn btn-default" data-toggle="modal" data-target="#NewClient">
                                <i class="fal fa-user"></i>          
                         </button>
                        </div>
                       
                           
                          <?php if($EMP->Emp_Type != 'Saller'): ?> 
                        <div class="form-group col-lg-4 col-4">
                   <label class="form-label" for="Status"><?php echo e(trans('admin.Delegate')); ?></label>
                               <select class="select2 form-control w-100" name="Delegate">
                                          <option value=""> <?php echo e(trans('admin.Delegate')); ?></option>
                                            <?php $__currentLoopData = $Employess; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $emp): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>    
                                                <option value="<?php echo e($emp->id); ?>" <?php if($Def->Delegate == $emp->id): ?> selected <?php endif; ?>>
                                   
                                        <?php echo e(app()->getLocale() == 'ar' ?$emp->Name :$emp->NameEn); ?>                
                                                </option>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>  
                                            </select>
                        </div>
                           <?php else: ?>
                     <input type="hidden" name="Delegate"  value="<?php echo e($EMP->id); ?>">      
                           
                           <?php endif; ?>

                               
                        <div class="form-group col-lg-1 col-2">
                            <button type="button" class="btn btn-default pos-icon" data-toggle="modal" data-target="#Note">
                                 <a data-toggle="tooltip" data-placement="top" title="<?php echo e(trans('admin.Note')); ?>">
                                <img src="<?php echo e(asset('Admin/img/245-edit-document-outline (1).gif')); ?>" alt="">    
                                </a>     
                         </button>
                        </div>
                           
                           <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('اضافه سند قبض')): ?>   
                      <div class="form-group col-lg-1 col-2">
                            <button type="button" class="btn btn-default pos-icon" data-toggle="modal" data-target="#Recipt">
                                 <a data-toggle="tooltip" data-placement="top" title="<?php echo e(trans('admin.Recipt_Voucher')); ?>">
                                <img src="<?php echo e(asset('Admin/img/37-approve-checked-simple-outline.gif')); ?>" alt="">    
                                </a>     
                         </button>
                        </div> 
                           <?php endif; ?> 
                           
                                  <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('سند عميل')): ?>   
                        <div class="form-group col-lg-1 col-2">
                            <button type="button" class="btn btn-default pos-icon" data-toggle="modal" data-target="#ReciptTwo">
                                 <a data-toggle="tooltip" data-placement="top" title="<?php echo e(trans('admin.Client_Voucher')); ?>">
                                <img src="<?php echo e(asset('Admin/img/37-approve-checked-simple-outline.gif')); ?>" alt="">    
                                </a>     
                         </button>
                        </div>
                           <?php endif; ?> 
                           
           
                           
                           
                              <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('اضافه سند صرف')): ?>
                       <div class="form-group col-lg-1 col-2">
                            <button type="button" class="btn btn-default pos-icon" data-toggle="modal" data-target="#PayVouch">
                                 <a data-toggle="tooltip" data-placement="top" title="<?php echo e(trans('admin.Payment_Voucher')); ?>">
                                <img src="<?php echo e(asset('Admin/img/290-coin-outline (1).gif')); ?>" alt="">
                                </a>
                         </button>
                        </div> 
                           <?php endif; ?>
                              <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('اضافه سند صرف')): ?>
                        <div class="form-group col-lg-1 col-2">
                            <button type="button" class="btn btn-default pos-icon" data-toggle="modal" data-target="#PayyVouch">
                                 <a data-toggle="tooltip" data-placement="top" title="<?php echo e(trans('admin.Expenses_Voucher')); ?>">
                                <img src="<?php echo e(asset('Admin/img/290-coin-outline (1).gif')); ?>" alt="">
                                </a>
                         </button>
                        </div>   
                           <?php endif; ?>
                                       <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('اضافه سند صرف')): ?>
                    <div class="form-group col-lg-1 col-2">
                            <button type="button" class="btn btn-default pos-icon" data-toggle="modal" data-target="#PayyyVouch">
                                 <a data-toggle="tooltip" data-placement="top" title="<?php echo e(trans('admin.Vendor_Voucher')); ?>">
                                <img src="<?php echo e(asset('Admin/img/290-coin-outline (1).gif')); ?>" alt="">
                                </a>
                         </button>
                        </div>  
                           <?php endif; ?>
                                 
                           
                                        <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('جدول عرض سعر مصور')): ?> 
                        <div class="form-group col-lg-1 col-2">
                            <button type="button" class="btn btn-default pos-icon" data-toggle="modal" data-target="#">
                                 <a href="<?php echo e(url('QuoteImagesSechdule')); ?>" data-toggle="tooltip" data-placement="top" title="<?php echo e(trans('admin.QuoteImagesSechdules')); ?>" target="_blank">
                               <img src="<?php echo e(asset('Admin/img/56-document-outline (1).gif')); ?>" alt="">
                                </a>
                         </button>
                        </div>
                           <?php endif; ?>   
                           
                           
                              <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('عرض سعر مصور')): ?>
                        <div class="form-group col-lg-1 col-2">
                            <button type="button" class="btn btn-default pos-icon" data-toggle="modal" data-target="#">
                                 <a href="<?php echo e(url('QuoteImages')); ?>" data-toggle="tooltip" data-placement="top" title="<?php echo e(trans('admin.QuoteImages')); ?>" target="_blank">
                               <img src="<?php echo e(asset('Admin/img/56-document-outline (1).gif')); ?>" alt="">
                                </a>
                         </button>
                        </div>
                           <?php endif; ?>    
                           
                           
                             <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('جدول امر البيع')): ?>
                        <div class="form-group col-lg-1 col-2">
                            <button type="button" class="btn btn-default pos-icon" data-toggle="modal" data-target="#">
                                 <a href="<?php echo e(url('SalesOrderSechdule')); ?>" data-toggle="tooltip" data-placement="top" title="<?php echo e(trans('admin.SalesOrderSechdule')); ?>" target="_blank">
                               <img src="<?php echo e(asset('Admin/img/56-document-outline (1).gif')); ?>" alt="">
                                </a>
                         </button>
                        </div>
                           <?php endif; ?> 
                               <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('جدول المبيعات')): ?>
                        <div class="form-group col-lg-1 col-2">
                            <button type="button" class="btn btn-default pos-icon" data-toggle="modal" data-target="#">
                                 <a   href="<?php echo e(url('SalesSechdule')); ?>" data-toggle="tooltip" data-placement="top" title="<?php echo e(trans('admin.SalesSechdule')); ?>" target="_blank">
                                 <img src="<?php echo e(asset('Admin/img/970-video-conference-outline (1).gif')); ?>" alt="">
                                </a>
                         </button>
                        </div>
                           <?php endif; ?>
                              <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('جدول عرض سعر')): ?>
                        <div class="form-group col-lg-1 col-2">
                            <button  type="button" class="btn btn-default pos-icon" data-toggle="modal" data-target="#">
                                 <a  href="<?php echo e(url('Quote_Sechdule')); ?>" data-toggle="tooltip" data-placement="top" title="<?php echo e(trans('admin.Quote_Sechdule')); ?>" target="_blank">
                                 <img src="<?php echo e(asset('Admin/img/298-coins-outline (1).gif')); ?>" alt=""> 
                                </a>
                         </button>
                        </div>
                           <?php endif; ?>
                              <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('تقفيل اليوميه')): ?>
                        <div class="form-group col-lg-1 col-2">
                                 <a href="<?php echo e(url('DailyClosing')); ?>" class="btn btn-default pos-icon" data-toggle="tooltip" data-placement="top" title="<?php echo e(trans('admin.DailyClosing')); ?>" target="_blank">
                                  <img src="<?php echo e(asset('Admin/img/946-equity-security-outline.gif')); ?>" alt="">
                                </a>
                        </div>
                           <?php endif; ?>
                              <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('تقرير المصاريف')): ?>
                        <div class="form-group col-lg-1 col-2">
                                 <a href="<?php echo e(url('ExpensesReport')); ?>" class="btn btn-default pos-icon" data-toggle="tooltip" data-placement="top" title=" <?php echo e(trans('admin.Expenses')); ?> " target="_blank">
                                  <img src="<?php echo e(asset('Admin/img/945-dividends-outline (1).gif')); ?>" alt="">
                                </a>
                        </div>
                           <?php endif; ?>
                              <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('اضافه تحويلات المخازن')): ?>
                        <div class="form-group col-lg-1 col-2">
                                 <a href="<?php echo e(url('StoresTransfers')); ?>" class="btn btn-default pos-icon" data-toggle="tooltip" data-placement="top" title="<?php echo e(trans('admin.Stores_Transfers')); ?>" target="_blank">
                                  <img src="<?php echo e(asset('Admin/img/950-attract-customers-outline (1).gif')); ?>" alt="">
                                </a>
                        </div>
                           <?php endif; ?>
                              <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('اضافه مشتريات')): ?>
                        <div class="form-group col-lg-1 col-2">
                                 <a href="<?php echo e(url('Purchases')); ?>" class="btn btn-default pos-icon" data-toggle="tooltip" data-placement="top" title="<?php echo e(trans('admin.Purchases')); ?>" target="_blank">
                                  <img height="20" src="<?php echo e(asset('Admin/img/526-paper-bag-vegetables-outline.gif')); ?>" alt="">
                                </a>
                        </div>
                           <?php endif; ?>
                              <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('جدول المشتريات')): ?>
                        <div class="form-group col-lg-1 col-2">
                                 <a href="<?php echo e(url('PurchasesSechdule')); ?>" class="btn btn-default pos-icon" data-toggle="tooltip" data-placement="top" title="<?php echo e(trans('admin.PurchasesSechdule')); ?>" target="_blank">
                                  <img height="20" src="<?php echo e(asset('Admin/img/1387-page-view-column-outline.gif')); ?>" alt="">
                                </a>
                        </div>
                           <?php endif; ?>
                                     <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('اضافه سلفه')): ?> 
                        <div class="form-group col-lg-1 col-2">
                                 <a href="<?php echo e(url('AddBorrow')); ?>" class="btn btn-default pos-icon" data-toggle="tooltip" data-placement="top" title="<?php echo e(trans('admin.Add_Borrow')); ?>" target="_blank">
                                  <img height="20" src="<?php echo e(asset('Admin/img/49-plus-circle-outline.gif')); ?>" alt="">
                                </a>
                        </div>
                           <?php endif; ?>
                                <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('الاصناف اليوميه')): ?>     
                        <div class="form-group col-lg-1 col-2">
                                 <a href="<?php echo e(url('DailyProducts')); ?>" class="btn btn-default pos-icon" data-toggle="tooltip" data-placement="top" title="<?php echo e(trans('admin.Products_Daily')); ?>" target="_blank">
                                  <img height="20" src="<?php echo e(asset('Admin/img/948-stock-share-outline (1).gif')); ?>" alt="">
                                </a>
                        </div>
                           <?php endif; ?>
                           
                             
                        <div class="form-group col-lg-1 col-2">
           
          <button type="button" class="btn btn-default pos-icon" data-toggle="modal" data-target="#OpenSafe">
                                 <a data-toggle="tooltip" data-placement="top" title="<?php echo e(trans('admin.Open_Safe_Drawer')); ?>" >
                                <img src="<?php echo e(asset('Admin/img/290-coin-outline (1).gif')); ?>" alt="">
                                </a>
                         </button>                            
                            
                        </div>
                    
                           
                    </div>  
                    <?php endif; ?>        
                            
                </div>
                   <div class="second-section">
                    <div class="row">
                        <div class="col-md-12">
                            <table id="dt" class="table table-bordered table-hover table-striped TABLEENGLISH">
                                <thead class="bg-primary-600">
                                    <tr>
                                        <th style="width: 26px"><i class="fal fa-trash-alt"></i></th>
                                        <th style="width: 200px;"><?php echo e(trans('admin.Name')); ?></th>
                                        <th style="width: 70px"><?php echo e(trans('admin.Unit')); ?></th>
                                        <th style="width: 70px;"><?php echo e(trans('admin.Qty')); ?></th>
                                        <th style="width: 70px;"><?php echo e(trans('admin.Price')); ?></th>
                                        <th style="width: 50px;"><?php echo e(trans('admin.Discount')); ?></th>
                                        <th style="width:130px;"><?php echo e(trans('admin.Total')); ?></th>
                                    </tr>
                                </thead>
                                <tbody id="data-dt">

                                    
                                </tbody>
                            </table>
                        </div>
                    </div>
                   </div>
                        <div class="last-section" id="ActionAlert" style="display: none">
                <?php echo e(trans('admin.Cant_Discount_This_Amount_From_That_Product')); ?>

                        </div>
                                  <div class="last-section" id="QTYAlert" style="display: none">
                       <?php echo e(trans('admin.Not_Enough_Qty')); ?>    <?php echo e(trans('admin.or')); ?>  <?php echo e(trans('admin.PriceLowThanCost')); ?> 
                        </div>
                   <div class="last-section" id="Action">
                    <div class="row" >
                       <div class="col-md-12">
                        <table class="table table-bordered table-hover table-striped">
                            
                            <tbody>
                                <tr>
                                   
                                    <td><?php echo e(trans('admin.Product_Numbers')); ?>(<?php echo e(trans('admin.Total_Qty')); ?>)</td>
                                    <td><span id="ProNums">0</span>(<span id="ProQty">0</span>)</td>
                                    <td><?php echo e(trans('admin.Total_Price')); ?>(<?php echo e(trans('admin.Total_Discount')); ?>) (<?php echo e(trans('admin.Total_Taxes')); ?>)</td>
                                    <td><span id="TotalPrice">0</span>(<span id="Total_DiscountTTShow">0</span>)(<span id="Total_TaxesShow">0</span>)</td>
                                         
                                </tr>
                            </tbody>
                        </table>
                    </div> 
                   <?php if(auth()->guard('admin')->user()->pos_product == 1): ?>      
                            <?php if(auth()->guard('admin')->user()->pos_hold == 1 ): ?>    
                    <div class="col-md-3">
                        <button onclick="Hol(1)" type="button" class="btn btn-sm btn-block btn-outline-primary waves-effect waves-themed"  data-toggle="modal" data-target="#default-example-modal-lg-center-bill">
                              <?php echo e(trans('admin.Holding')); ?></button>
                    </div>
                        <?php endif; ?>
                        
             <?php if(auth()->guard('admin')->user()->pos_pay == 1 ): ?>          
                    <div class="col-md-3">
                        <button type="button" onclick="Hol(0)" class="btn btn-sm btn-block btn-outline-success waves-effect waves-themed"  data-toggle="modal" data-target="#default-example-modal-center-payment">
                              <?php echo e(trans('admin.Payment_Method')); ?></button>
                    </div>
                <?php endif; ?>        
                  <?php if(auth()->guard('admin')->user()->pos_hold == 1 ): ?>   
                                   <div class="col-md-3">
                        <td>
                            <button type="button" class="btn btn-sm btn-block btn-outline-dark waves-effect waves-themed"  data-toggle="modal" data-target="#Holddd">
                                 <?php echo e(trans('admin.Holding_Bill')); ?></button>
                    
                    

                        </td>
                    </div>    
                        <?php endif; ?>
                        
                              <div class="col-md-3">
                        <td>
                            <button type="button" class="btn btn-sm btn-block btn-outline-dark waves-effect waves-themed"  data-toggle="modal" data-target="#default-example-modal-center-cancelPayment">
                                <?php echo e(trans('admin.Cancel')); ?></button>
                        </td>
                    </div> 
                <?php else: ?>        
                  <?php if(auth()->guard('admin')->user()->pos_hold == 1 ): ?>   
                                   <div class="col-md-3">
                        <td>
                            <button type="button" class="btn btn-sm btn-block btn-outline-dark waves-effect waves-themed"  data-toggle="modal" data-target="#Holddd">
                                 <?php echo e(trans('admin.Holding_Bill')); ?></button>
                    
                    

                        </td>
                    </div>    
                        <?php endif; ?>        
                        
                <?php endif; ?>  
                        
                    </div>
                   </div>
                    </div>
                </div>
                
                
                  <!-- Note modal -->
   <div class="modal fade" id="Note" tabindex="-1" role="dialog" aria-hidden="true">
            <div class="modal-dialog modal-xl modal-dialog-centered" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h4 class="modal-title">
                               <?php echo e(trans('admin.Notes')); ?>

                        </h4>
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true"><i class="fal fa-times"></i></span>
                        </button>
                    </div>
                    
                    
                    <div class="modal-body">
                        <div class="row">
                  <div class="form-group col-lg-12 col-12">
                            <label class="form-label" for="simpleinput"><?php echo e(trans('admin.Notes')); ?></label>
                         <input type="text" name="Note" value="<?php echo e(old('Note')); ?>" class="form-control">
                        </div>

                        </div>
                    </div>
                    <div class="modal-footer">
             <button type="button" class="btn btn-secondary" data-dismiss="modal">   <?php echo e(trans('admin.Close')); ?></button>
                    </div>
                </div>
            </div>
        </div>
  
                <!-- Hold bill modal -->
                <div class="modal fade" id="default-example-modal-lg-center-bill" tabindex="-1" role="dialog" aria-hidden="true">
                    <div class="modal-dialog  modal-dialog-centered" role="document">
                        <div class="modal-content">
                            <div class="modal-header">
                                <h4 class="modal-title">
                                   <?php echo e(trans('admin.Holding')); ?>

                                </h4>
                                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                    <span aria-hidden="true"><i class="fal fa-times"></i></span>
                                </button>
                            </div>
                            <div class="modal-body">
                                <?php echo e(trans('admin.RUSWHB')); ?> :: <?php echo e($HoldCode); ?>

                           
                              <!--   <div class="row mt-2">
                                <div class="col-md-6">
                                <label class="form-label">    <?php echo e(trans('admin.Paid')); ?></label>    
              <input type="number" class="form-control" step="any" name="CashhHold" id="CashhHold" onkeyup="Diff()" onclick="Diff()">  
                                    </div>
                                        <div class="col-md-6">
                                <label class="form-label">    <?php echo e(trans('admin.Residual')); ?></label>         
                        <input type="number" class="form-control" step="any" id="ResidualHold" disabled>  
                                    </div>        
                               </div> -->
                            </div>
                            <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-dismiss="modal"> <?php echo e(trans('admin.No')); ?></button>
                                  <div id="Submit">    
            <button type="button"  class="btn btn-primary" onclick="SPS()"> <i class="fal fa-folder"></i> <?php echo e(trans('admin.Yes')); ?> </button>
                                        
          <button type="button"  class="btn btn-primary" onclick="SPP()"><i class="fal fa-save"></i>  <?php echo e(trans('admin.YesandPrint')); ?> </button>
                                        
                  <!--     <button type="button"  class="btn btn-primary" onclick="SPP8()"><i class="fal fa-save"></i>  <?php echo e(trans('admin.YesandPrint8')); ?> </button>    -->
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
               
                <!-- Cancel payment modal -->
                <div class="modal fade" id="default-example-modal-center-cancelPayment" tabindex="-1" role="dialog" aria-hidden="true">
                    <div class="modal-dialog modal-dialog-centered" role="document">
                        <div class="modal-content">
                            <div class="modal-header">
                                <h4 class="modal-title">
                              <?php echo e(trans('admin.Cancel')); ?>

                                </h4>
                                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                    <span aria-hidden="true"><i class="fal fa-times"></i></span>
                                </button>
                            </div>
                            <div class="modal-body">
                                
                                 <?php echo e(trans('admin.RUSWCO')); ?> 
                            </div>
                            <div class="modal-footer">
                                <button type="button" class="btn btn-secondary" data-dismiss="modal">  <?php echo e(trans('admin.No')); ?></button>
                                <button type="button" class="btn btn-primary" onclick="window.location.reload();">  <?php echo e(trans('admin.Yes')); ?></button>
                            </div>
                        </div>
                    </div>
                </div>
                
                <!-- Payment modal -->
                <div class="modal fade" id="default-example-modal-center-payment" tabindex="-1" role="dialog" aria-hidden="true">
                    <div class="modal-dialog modal-lg modal-dialog-centered" role="document">
                        <div class="modal-content">
                            <div class="modal-header">
                                <h4 class="modal-title">
                                   <?php echo e(trans('admin.Payment_Method')); ?>

                                </h4>
                                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                    <span aria-hidden="true"><i class="fal fa-times"></i></span>
                                </button>
                            </div>
                            <div class="modal-body">
                                
                               <div class="form-row">
                                        <div class="form-group col-lg-4">
                                 <label class="form-label" for="simpleinput"> <?php echo e(trans('admin.Product_Numbers')); ?> </label>
                      <input type="text" id="Product_Numbers" disabled  class="form-control">
                      <input type="hidden" id="Product_NumbersHide" name="Product_Numbers">
                                        </div>
                                        <div class="form-group col-lg-4">
                         <label class="form-label" for="simpleinput"> <?php echo e(trans('admin.Total_Qty')); ?> </label>
                                           <input type="text" id="Total_Qty" disabled  class="form-control">
                                            <input type="hidden" id="Total_QtyHide" name="Total_Qty">
                                        </div>
                                                     <div class="form-group col-lg-4">
                       <label class="form-label" for="simpleinput">  <?php echo e(trans('admin.Total_Price')); ?></label>
                                   <input type="text" id="Total_Price" disabled  class="form-control">
                                            <input type="hidden" id="Total_PriceHide" name="Total_Price">
                                               <input type="hidden" id="Total_Bf_Taxes" disabled  class="form-control">
                                            <input type="hidden" id="Total_Bf_TaxesHide" name="Total_BF_Taxes">
                                                               <input type="hidden" id="Total_Discount" disabled  class="form-control">
                                            <input type="hidden" id="Total_DiscountHide" name="Total_Discount"> 
                                           <input type="hidden" id="TotalCost" name="Total_Cost">   
                                        </div>

                                        <div class="form-group col-lg-3">
                        <label class="form-label" for="simpleinput">   <?php echo e(trans('admin.Total_Discount')); ?> </label>
                                                       <input type="text" id="Total_DiscountTT" disabled  class="form-control">
                                            <input type="hidden" id="Total_DiscountHideTT" name="Total_Discount">           
                                        </div>
                                                            <div class="form-group col-lg-3">
                           <label class="form-label" for="simpleinput"> <?php echo e(trans('admin.Total_af_Discount')); ?> </label>
                                    <input type="text" class="form-control" id="TAFterD"  disabled>

                                        </div>
                                        <div class="form-group col-lg-3">
                          <label class="form-label" for="simpleinput">   <?php echo e(trans('admin.Total_Taxes')); ?></label>
                                         <input type="text" id="Total_Taxes" disabled  class="form-control">
                                            <input type="hidden" id="Total_TaxesHide" name="Total_Taxes">
                                        </div>
                                       <div class="form-group col-lg-3">
                           <label class="form-label" for="simpleinput"> <?php echo e(trans('admin.Total_Bill')); ?> </label>
                       
         <input type="text" id="Total_Bill" disabled  class="form-control">
                                        </div>  
                                     <?php if($show->TaxOnTotal == 1): ?>
                                  <div class="form-group col-lg-4">
                           <label class="form-label" for="simpleinput"> <?php echo e(trans('admin.TaxOnTotal')); ?> </label>
                           <select class="select2 form-control" name="TaxOnTotal">
                                <option value="No"><?php echo e(trans('admin.No')); ?></option>      
                                <option value="Yes"><?php echo e(trans('admin.Yes')); ?></option>      
                                      </select>
                        </div>
                         
                                      <div class="form-group col-lg-4">
                           <label class="form-label" for="simpleinput"> <?php echo e(trans('admin.TaxOnTotalType')); ?> </label>
                           <select class="select2 form-control" name="TaxOnTotalType" id="TaxOnTotalType" onchange="TaxOn()">
                                <option value=""><?php echo e(trans('admin.TaxOnTotalType')); ?></option>    
                               <?php $__currentLoopData = $TAXESS; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $tax): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <option value="<?php echo e($tax->id); ?>"><?php echo e($tax->Name); ?></option> 
                               <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                      </select>
                        </div>
                         
                         
                            <div class="form-group col-lg-4">
                           <label class="form-label" for="simpleinput"> <?php echo e(trans('admin.ProfitTax')); ?> </label>
                           <input type="text" class="form-control" id="ProfitTax" name="ProfitTax" value="0" readonly>
                        </div>
                         <?php endif; ?>
                                        <div class="form-group col-lg-3">
                           <label class="form-label" for="simpleinput"> <?php echo e(trans('admin.Discount_Bill')); ?> </label>
                           <input type="text" class="form-control" id="resdiual" name="DiscountBill" value="0" onkeyup="Statuss()">

                                        </div>
                                        <div class="form-group col-lg-3">
                           <label class="form-label" for="simpleinput"> <?php echo e(trans('admin.Total_Net')); ?> </label>
                                    <input type="text" class="form-control" id="Total_PriceW"  disabled>

                                        </div>
                                        <div class="form-group col-lg-3">
                           <label class="form-label" for="simpleinput"> <?php echo e(trans('admin.Paid')); ?> </label>
                                    <input type="number" step="any" name="Pay" id="paid" onkeyup="PayInstall()"   class="form-control">

                                        </div>
                                     <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('نسبه الربح')): ?>
                                 <div class="form-group col-lg-3">
                           <label class="form-label" for="simpleinput"> <?php echo e(trans('admin.ProfitPrecent')); ?> </label>
                           <input type="number" step="any" name="ProfitPrecent" id="ProfitPrecent"   class="form-control" value="0" readonly>
                                <span style="color: red" id="proPrecent"></span>  %
                        </div>
                           <?php endif; ?> 
                                   
                                            <?php if($Def->Total_Wight_Bill == 1): ?>
                              <div class="form-group col-lg-3">
                           <label class="form-label" for="simpleinput"> <?php echo e(trans('admin.Total_Wight_Bill')); ?> </label>
                           <input type="number" step="any" name="Total_Wight_Bill" id="Total_Wight_Bill"   class="form-control" value="0" readonly>
                          
                        </div>
                         <?php endif; ?>
                                   
                                    </div>
                            
                                <ul class="nav nav-tabs" role="tablist">
                                   
                                         <?php if(auth()->guard('admin')->user()->Cash == 1): ?> 
                                    <li class="nav-item"><a onclick="Pay('Cash')" id="T1" class="nav-link active" data-toggle="tab" href="#tab_direction-1" role="tab" aria-selected="true"><?php echo e(trans('admin.Cash')); ?></a></li>
                                    <?php endif; ?>
                                         <?php if(auth()->guard('admin')->user()->Later == 1): ?> 
                                    <li class="nav-item"><a onclick="Pay('Later')" id="T2" class="nav-link active" data-toggle="tab" href="#tab_direction-2" role="tab" aria-selected="false"><?php echo e(trans('admin.Later')); ?></a></li>
                                    <?php endif; ?>
                                         <?php if(auth()->guard('admin')->user()->Check == 1): ?> 
                                    <li class="nav-item"><a onclick="Pay('Check')" id="T3" class="nav-link active" data-toggle="tab" href="#tab_direction-3" role="tab" aria-selected="false"><?php echo e(trans('admin.Check')); ?></a></li>
                                    <?php endif; ?>
                                    
                                         <?php if(auth()->guard('admin')->user()->Installment == 1): ?> 
                                    <li class="nav-item"><a onclick="Pay('Installment')" id="T4" class="nav-link active" data-toggle="tab" href="#tab_direction-4" role="tab" aria-selected="false"><?php echo e(trans('admin.Installment')); ?></a></li>
                                    <?php endif; ?>
                                    
                                         <?php if(auth()->guard('admin')->user()->Cash_Visa == 1): ?> 
                            <li class="nav-item"><a onclick="Pay('Cash_Visa')" id="T5" class="nav-link active" data-toggle="tab" href="#tab_direction-5" role="tab" aria-selected="false"><?php echo e(trans('admin.Cash_Visa')); ?></a></li>
                                    <?php endif; ?>
                                         <?php if(auth()->guard('admin')->user()->Cash_Collection == 1): ?> 
                                 <li class="nav-item"><a onclick="Pay('Cash_Collection')" id="T6" class="nav-link active" data-toggle="tab" href="#tab_direction-6" role="tab" aria-selected="false"><?php echo e(trans('admin.Cash_Collection')); ?></a></li>      
                                    <?php endif; ?>
                                    
                                         <?php if(auth()->guard('admin')->user()->Delivery == 1): ?> 
                                    
                                <li class="nav-item"><a onclick="Pay('Delivery')" id="T7" class="nav-link active" data-toggle="tab" href="#tab_direction-7" role="tab" aria-selected="false"><?php echo e(trans('admin.Delivery')); ?></a></li>  
                                    <?php endif; ?>
                                    
                                         <?php if(auth()->guard('admin')->user()->InstallmentCompanies == 1): ?> 
                                
                                 <li class="nav-item"><a onclick="Pay('InstallmentCompanies')" id="T8" class="nav-link active" data-toggle="tab" href="#tab_direction-8" role="tab" aria-selected="false"><?php echo e(trans('admin.InstallmentCompanies')); ?></a></li>         
                                    <?php endif; ?>
                                    
                                    
                                    
                                                        <?php if(auth()->guard('admin')->user()->Visa_Network == 1): ?> 
                            <li class="nav-item"><a onclick="Pay('Visa')" id="T9" class="nav-link active" data-toggle="tab" href="#tab_direction-9" role="tab" aria-selected="false"><?php echo e(trans('admin.Visa')); ?> (<?php echo e(trans('admin.Visa2')); ?>)</a></li>
                                    <?php endif; ?>
                                </ul>
                                <div class="tab-content p-3">
                            <input type="hidden" name="Payment_Method" id="Payment_Method" value="Cash">

                                    <div class="tab-pane fade active show" id="tab_direction-1" role="tabpanel">
                                 
                                    
                                    </div>
                                    <div class="tab-pane fade active show" id="tab_direction-2" role="tabpanel">
                  
                                    </div>
                                    <div class="tab-pane fade active show"  id="tab_direction-3" role="tabpanel">
                                    <div class="row">   
                                                  <div class="form-group col-lg-4">
                                            <label class="form-label" for=""><?php echo e(trans('admin.Check_Type')); ?></label>
                                            <select class="select2 form-control w-100"  name="Check_Type" >
                                                <option value=""> <?php echo e(trans('admin.Check_Type')); ?></option>
                                            <?php $__currentLoopData = $ChecksTypes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $type): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>    
                                                <option value="<?php echo e($type->id); ?>">
                                   
                                             <?php echo e(app()->getLocale() == 'ar' ?$type->Arabic_Name :$type->English_Name); ?>        
                                                </option>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>    
                                            </select>
                                        </div>
                                    
                                                              <div class="form-group col-lg-4">
                                            <label class="form-label" for="simpleinput"><?php echo e(trans('admin.Due_Date')); ?>  </label>
                      <input type="date"  value="<?php echo e(old('Due_Date')); ?>" class="form-control" name="Due_Date">                    
                                        </div>
                                    
                                    
                                      <div class="form-group col-lg-4">
                                   <label class="form-label" for="simpleinput"><?php echo e(trans('admin.Check_Number')); ?>  </label>
             <input type="number" step="any"  value="<?php echo e(old('Check_Number')); ?>" class="form-control" name="Check_Number">                    
                                        </div>
                                </div>
                                    </div>
                                    <div class="tab-pane fade active show"  id="tab_direction-4" role="tabpanel">
                                     <div class="row">   
                                <div class="form-group col-lg-3">
                         <label class="form-label" for="simpleinput"><?php echo e(trans('admin.Presenter')); ?></label>
           <input type="number" onclick="Install()" onkeyup="Install()" step="any" id="presenter" name="presenter" value="<?php echo e(old('presenter')); ?>" class="form-control" >
                                        </div>   
                                    
                                  <div class="form-group col-lg-3">
                           <label class="form-label" for="simpleinput"><?php echo e(trans('admin.annual_interest')); ?></label>
           <input type="number" step="any" onclick="Install()" onkeyup="Install()"  id="annual_interest" name="annual_interest" value="<?php echo e(old('annual_interest')); ?>" class="form-control">
                                        </div>   
                                    
             
                                    
                                         <div class="form-group col-lg-3">
                               <label class="form-label" for="simpleinput"><?php echo e(trans('admin.Years_Number')); ?></label>
     <input type="number" step="any" onclick="Install()" onkeyup="Install()" id="Years_Number" name="Years_Number" value="<?php echo e(old('Years_Number')); ?>" class="form-control">                        
                                        </div>  
                                    
                                     <div class="form-group col-lg-3">
                               <label class="form-label" for="simpleinput"><?php echo e(trans('admin.total')); ?></label>
     <input type="number" onclick="Install()" onkeyup="Install()"  step="any" id="total" name="total" value="<?php echo e(old('total')); ?>" class="form-control" readonly>
                                         
                                        </div>  
                                    
         
                                         <div class="form-group col-lg-4">
                               <label class="form-label" for="simpleinput"><?php echo e(trans('admin.Date_First_installment')); ?></label>
     <input type="date" onchange="Install()"  name="Date_First_installment" value="<?php echo e(old('Date_First_installment')); ?>" class="form-control">
                                        </div>  
                                    
                                           <div class="form-group col-lg-4">
                          <label class="form-label" for="simpleinput"><?php echo e(trans('admin.monthly_installment')); ?></label>
     <input type="number" step="any" id="monthly_installment" value="<?php echo e(old('monthly_installment')); ?>" class="form-control" disabled>
                        
              <input type="hidden" step="any" id="monthly_installmentHide" name="monthly_installment">                            
                                        
                                        </div>  
                             <div class="form-group col-lg-4">
                               <label class="form-label" for="simpleinput"><?php echo e(trans('admin.installment_Num')); ?></label>
     <input type="number" step="any" id="installment_Num"  value="<?php echo e(old('installment_Num')); ?>" class="form-control" disabled>
                            <input type="hidden" step="any" id="installment_NumHide" name="installment_Num">                   
                                        </div>  
                                                    
                                    
                                    
                                    </div> 
                                    </div>
                                    <div class="tab-pane fade active show"  id="tab_direction-5" role="tabpanel">
                                      <div class="row">
                                              <div class="form-group col-md-4">
                                           
                              <label class="form-label" for="example-textarea"> <?php echo e(trans('admin.Cash')); ?> </label>
                                               
                           <input  name="Cash" class="form-control use-keyboard-number" value="0">
                                            </div>
                                       
                                  <div class="form-group col-md-4">
                                           
                              <label class="form-label" for="example-textarea"> <?php echo e(trans('admin.Visa')); ?> </label>
                                              
                               <input  name="Visa" class="form-control use-keyboard-number" value="0">
                                            </div>
                                       
                        
                                                         <div class="form-group col-lg-4">
                                                             <label class="form-label" for="example-textarea"> <?php echo e(trans('admin.Safe')); ?> </label>
                                            <select class="select2 form-control w-100" name="SafeVisa">
                                                 <option value=""> <?php echo e(trans('admin.Safe')); ?></option>
                                            <?php $__currentLoopData = $Safes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $safe): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>    
                                                <option value="<?php echo e($safe->id); ?>" <?php if($Def->Bank == $safe->id): ?> selected <?php endif; ?>>
                                                     <?php echo e(app()->getLocale() == 'ar' ?$safe->Name :$safe->NameEn); ?>

                                                </option>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>    
                                            </select>
                                        </div>
                                          
                                      </div>
                                    </div>
                                    <div class="tab-pane fade active show" id="tab_direction-6" role="tabpanel">
                                        <div class="row form-group">
                                            <div class="col-md-2">
                              <label class="form-label" for="example-textarea"> <?php echo e(trans('admin.Paid')); ?> </label>
                                                </div>
                                            <div class="col-md-12">
                                    <input  name="Cash_Collection" class="form-control use-keyboard-number">
                                            </div> 
                                        </div>
                                    
                                    </div>
                                    <div class="tab-pane fade active show" id="tab_direction-7" role="tabpanel">
                                        <div class="row form-group">
                                            <div class="col-md-6">
                                                 <label><?php echo e(trans('admin.Delivery')); ?></label>   
                              <select class="select2 form-control" name="Delivery" id="Delivery">
                                        <option value=""><?php echo e(trans('admin.Delivery')); ?></option>
                                  <?php $__currentLoopData = $Deliveries; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $del): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <option value="<?php echo e($del->id); ?>" <?php if($Def->Delivery == $del->id): ?> selected <?php endif; ?>>
                                  
                                   <?php echo e(app()->getLocale() == 'ar' ?$del->Name :$del->NameEn); ?>

                                  </option>
                                  <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                </select>
                                                </div>
                                                         <div class="col-md-6">
                                    <label><?php echo e(trans('admin.Client_Address')); ?></label>                         
                              <select class="select2 form-control" name="Client_Address" id="Client_Address">
                                       
                 
                                                </select>
                                                </div>    
                                        
                                        </div>
                                    
                                    </div>
                                    <div class="tab-pane fade active show" id="tab_direction-8" role="tabpanel">
                                <div class="row form-group">
                           <div class="form-group col-lg-4">
                              <label class="form-label" for=""><?php echo e(trans('admin.InstallCompany')); ?></label>
                              <select class="select2 form-control w-100"  name="InstallCompany" id="InstallCompany" onchange="InstaallComp()" >
                                 <option value=""> <?php echo e(trans('admin.InstallCompany')); ?></option>
                                 <?php $__currentLoopData = $InstallmentCompanies; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $inst): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>    
                                 <option value="<?php echo e($inst->id); ?>">
                        
                                      <?php echo e(app()->getLocale() == 'ar' ?$inst->Arabic_Name :$inst->English_Name); ?>

                                 </option>
                                 <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>    
                              </select>
                           </div>
                           
                                     
                                        <div class="form-group col-lg-4">
                           <label class="form-label" for="simpleinput"><?php echo e(trans('admin.ContractNumber')); ?>  </label>
                           <input type="text" name="ContractNumber" value="<?php echo e(old('ContractNumber')); ?>" class="form-control">
                        </div>
                                     
                                     

                                         <div class="form-group col-lg-4">
                              <label class="form-label" for=""><?php echo e(trans('admin.PayFees')); ?></label>
                              <select class="select2 form-control w-100"  name="PayFees"  >
                                 <option value="No"> <?php echo e(trans('admin.No')); ?></option>
                                 <option value="Yes"> <?php echo e(trans('admin.Yes')); ?></option>
                              </select>
                           </div>
                                     
                                              <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('رسوم خدمات شركات التقسيط')): ?>  <?php $Style='block';  ?>   <?php endif; ?>          
                                     
                                                        <div class="form-group col-lg-4" style="display: <?php echo e($Style); ?>">
                           <label class="form-label" for="simpleinput"><?php echo e(trans('admin.ServiceFee')); ?>  </label>
                           <input type="text" name="ServiceFee" id="ServiceFee" value="<?php echo e(old('ServiceFee')); ?>" class="form-control" readonly>
                        </div>
                                  
                                     
                                                                           <div class="form-group col-lg-4" style="display: <?php echo e($Style); ?>">
                           <label class="form-label" for="simpleinput"><?php echo e(trans('admin.CompanyPrecent')); ?>  </label>
                           <input type="text" name="CompanyPrecent" id="CompanyPrecent" value="<?php echo e(old('CompanyPrecent')); ?>" class="form-control" readonly>
                        </div>
                
                                                      <div class="form-group col-lg-4" style="display: <?php echo e($Style); ?>">
                           <label class="form-label" for="simpleinput"><?php echo e(trans('admin.TotalServiceFee')); ?>  </label>
                           <input type="text"  id="TotalServiceFee"  class="form-control" readonly>
                        </div>

                                     
                           </div>
                                    </div>
                                     <div class="tab-pane fade active show"  id="tab_direction-9" role="tabpanel">
                                      <div class="row">
                                              <div class="form-group col-md-4" style="display: none">
                                           
                              <label class="form-label" for="example-textarea"> <?php echo e(trans('admin.Cash')); ?> </label>
                                               
                           <input  name="Cash2" class="form-control use-keyboard-number"  value="0">
                                            </div>
                                       
                                  <div class="form-group col-md-4">
                                           
                              <label class="form-label" for="example-textarea"> <?php echo e(trans('admin.Visa')); ?> </label>
                                              
                               <input  name="Visa2" class="form-control use-keyboard-number" >
                                            </div>
                                       
                        
                                                         <div class="form-group col-lg-4">
                                                             <label class="form-label" for="example-textarea"> <?php echo e(trans('admin.Safe')); ?> </label>
                                            <select class="select2 form-control w-100" name="SafeVisa2">
                                                 <option value=""> <?php echo e(trans('admin.Safe')); ?></option>
                                            <?php $__currentLoopData = $Safes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $safe): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>    
                                                <option value="<?php echo e($safe->id); ?>" <?php if($Def->Bank == $safe->id): ?> selected <?php endif; ?>>
                                                     <?php echo e(app()->getLocale() == 'ar' ?$safe->Name :$safe->NameEn); ?>

                                                </option>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>    
                                            </select>
                                        </div>
                                          
                                      </div>
                                    </div>
                                </div>
                                 
        
        
                            </div>
                            <div class="modal-footer" >
                            <div id="SubmitY" >
                                <button type="button" class="btn btn-secondary mt-2" data-dismiss="modal">      <?php echo e(trans('admin.Close')); ?></button>
                          
                                                    <input type="hidden" id="sp" name="SP">    
                                
                      
            <button type="button"  class="btn btn-primary mt-2" onclick="SPS()"> <i class="fal fa-folder"></i> <?php echo e(trans('admin.Save')); ?> </button>
                     
                                  <?php if($show->A4 == 1): ?>    
          <button type="button"  class="btn btn-primary mt-2" onclick="SPP()"><i class="fal fa-save"></i>  <?php echo e(trans('admin.SaveandPrint')); ?> </button>
                            <?php endif; ?>
                                  <?php if($show->CM8 == 1): ?>    
                       <button type="button"  class="btn btn-primary mt-2" onclick="SPP8()"><i class="fal fa-save"></i>  <?php echo e(trans('admin.SaveandPrint8')); ?> </button>    
                                <?php endif; ?>
                      
                                
                            </div>
                            </div>
                        </div>
                    </div>
                </div>
              
                   <!-- All Hold Bills -->
                   <div class="modal fade" id="Holddd" tabindex="-1" role="dialog" aria-hidden="true">
                    <div class="modal-dialog modal-dialog-centered modal-xl" role="document">
                        <div class="modal-content">
                            <div class="modal-header">
                                <h4 class="modal-title">
                                 <?php echo e(trans('admin.Holding_Bill')); ?>  
                                </h4>
                                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                    <span aria-hidden="true"><i class="fal fa-times"></i></span>
                                </button>
                            </div>
                            <div class="modal-body">
                    <div class="row">
                        
                              <div class="input-items col-md-12 mb-2">
                             <input type="text" id="searchHold" class="form-control" placeholder="   <?php echo e(trans('admin.Code')); ?>">
                          
                                      <?php if(app()->getLocale() == 'ar' ): ?>
                     <i class="fal fa-barcode-alt" style="position:absolute ;top:5px;left:3px;"></i>
                      <?php else: ?>
                            <i class="fal fa-barcode-alt" style="position:absolute ;top:5px;right: 0;left:auto;"></i>
                      <?php endif; ?>
                            </div>      
                        </div>            
                                <div class="row HOLDD" >
                            <?php $__currentLoopData = $HoldSales; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $sal): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
  
          
           
                          <a  href="<?php echo e(url('HoldSale/'.$sal->id)); ?>" class="col-md-6">
                                  
                          <table  style="position:relative;background: #c59cc5;" class="table table-bordered w-100">
                              
                                      <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('حذف امر البيع')): ?>      
                               <a class="btn btn-primary btn-sm" href="<?php echo e(url('DeleteHoldBill/'.$sal->id)); ?>" style="margin-right:11px;height:35px;position:absolute;left:17px;top:5px;z-index:22;"><i class="fal fa-trash"></i></a> 
                                    <?php endif; ?>
                              <tr>
                                  <td> <?php echo e(trans('admin.Code')); ?></td>
                                  <td> <?php echo e($sal->Code); ?></td>
                                 
                                 
                              </tr>
                                 <tr>
                                  <td><?php echo e(trans('admin.Client')); ?></td>
                                  <td>
                                     
                                    <?php echo e(app()->getLocale() == 'ar' ?$sal->Client()->first()->Name :$sal->Client()->first()->NameEn); ?>        
                                     </td>
                                 
                              </tr>
                                    <tr>
                                  <td><?php echo e(trans('admin.User')); ?></td>
                                  <td>
                                        
                            <?php echo e(app()->getLocale() == 'ar' ?$sal->User()->first()->name :$sal->User()->first()->nameEn); ?>                  
                                        </td>
                                 
                              </tr>
                              <tr>
                                  <td><?php echo e(trans('admin.Date')); ?></td>
                                  <td><?php echo e($sal->Date); ?></td>
                                 
                              </tr>
                              <tr>
                                  <td><?php echo e(trans('admin.Total_Price')); ?></td>
                                  <td><?php echo e($sal->Total_Price); ?></td>
                                 
                              </tr>
                          </table>
                 </a>
      
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>          
                            </div>
                            </div>
                            <div class="modal-footer">
                                <button type="button" class="btn btn-secondary" data-dismiss="modal">  <?php echo e(trans('admin.Close')); ?></button>
                            </div>
                        </div>
                    </div>
                </div>

            </div>
        </div>
        
    </form>
                          <!-- Modal New Client -->
            <div class="modal fade" id="NewClient" tabindex="-1" role="dialog" aria-hidden="true">
                        <div class="modal-dialog modal-dialog-centered modal-xl" role="document">              
                            <div class="modal-content">
                                <div class="modal-header">
                                   
                                    <h4 class="modal-body row">
                          
                      
                                        <div class="form-group col-md-3">
                                 <label class="form-label" for="simpleinput">   <?php echo e(trans('admin.Code')); ?></label>
                                 <input type="text" id="CODE"  value="<?php echo e($CodeUser); ?>" disabled class="form-control">
                             
                                                                    </div>
                                                   <div class="form-group col-md-3">
                <label class="form-label" for="simpleinput"> <?php echo e(trans('admin.Arabic_Name')); ?>  </label><span class="strick">*</span>
                        <input type="text" id="Name" value="<?php echo e(old('Name')); ?>" class="form-control">
                                                                    </div>           
                                        
                                        <div class="form-group col-md-3">
                <label class="form-label" for="simpleinput"> <?php echo e(trans('admin.English_Name')); ?>  </label><span class="strick">*</span>
                        <input type="text" id="NameEn" value="<?php echo e(old('NameEn')); ?>" class="form-control">
                                                                    </div>   
                                                     
                                                     <div class="form-group col-md-3">
                <label class="form-label" for="simpleinput"> <?php echo e(trans('admin.Phone')); ?>  </label><span class="strick">*</span>
                        <input type="number" id="Phone" value="<?php echo e(old('Phone')); ?>" class="form-control">
                                                                    </div>   
                                                               <div class="form-group col-md-3">
                <label class="form-label" for="">   <?php echo e(trans('admin.Price_Level')); ?> </label><span class="strick">*</span>
                             <select class="select2 form-control w-100" id="PriceLevel">
                                    <option value="1"> <?php echo e(trans('admin.Level1')); ?> </option>
                                    <option value="2"> <?php echo e(trans('admin.Level2')); ?> </option>
                                    <option value="3"> <?php echo e(trans('admin.Level3')); ?> </option>
                                                              
                                                                        </select>
                                                                    </div>
                                        
                                     <div class="row">
                  <div class="form-group col-md-2">
                    <label><?php echo e(trans('admin.Address_Name')); ?></label> 
                    <input type="text" id="NaameAddress" class="form-control" value="العنوان الرئيسي">                       
                                    </div>                         
                  <div class="form-group col-md-2">
                      <label><?php echo e(trans('admin.Governrate')); ?></label> 
                      <select class="select2 form-control w-100" id="Governrate" >
                     <option value=""><?php echo e(trans('admin.Governrate')); ?></option>
                     <?php $__currentLoopData = $Governrates; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $gov): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                     <option value="<?php echo e($gov->id); ?>">
                     
                         
                 <?php echo e(app()->getLocale() == 'ar' ?$gov->Arabic_Name :$gov->English_Name); ?>         
                     </option>
                     <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>      
                  </select>                     
                    </div>
                  <div class="form-group col-md-2">
                      <label><?php echo e(trans('admin.City')); ?></label> 
                           <select class="select2 form-control w-100" id="City" >
                                
                                       </select>                 
                                        </div>                         
                  <div class="form-group col-md-2"><label><?php echo e(trans('admin.Place')); ?></label> 
                           <select class="select2 form-control w-100" id="Place" >
                                
                                       </select>                     
                                         </div>                         
                  <div class="form-group col-md-2"><label><?php echo e(trans('admin.Street')); ?></label> 
                            <input type="text" id="Street" class="form-control">               
                                         </div>                         
                  <div class="form-group col-md-2"><label><?php echo e(trans('admin.Buliding')); ?></label> 
                                <input type="text" id="Buliding" class="form-control">           
                                         </div>                         
                  <div class="form-group col-md-2"><label><?php echo e(trans('admin.Floor')); ?></label> 
                             <input type="text" id="Floor" class="form-control">             
                                         </div>                         
                  <div class="form-group col-md-2"><label><?php echo e(trans('admin.Flat')); ?></label> 
                               <input type="text" id="Flat" class="form-control">          
                                         </div>                         
                  <div class="form-group col-md-2"><label><?php echo e(trans('admin.Special_Mark')); ?></label> 
                            <input type="text" id="Special_Mark" class="form-control">             
                                         </div>
                  <div class="form-group col-md-2"><label><?php echo e(trans('admin.Location')); ?></label> 
                           <input type="text" id="Location" class="form-control">               
                                         </div>                         
                  <div class="form-group col-md-4"><label><?php echo e(trans('admin.Address_Details')); ?></label> 
                   <input type="text"  id="Address_Details" class="form-control" value="العنوان بتفصيل">          
                                         </div>                   
   
                                        </div>   
                                        
        
                                    </h4>
                                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                        <span aria-hidden="true"><i class="fal fa-times"></i></span>
                                    </button>
                                </div>
                                
                                <div class="modal-footer">
                  <button type="button" class="btn btn-secondary" data-dismiss="modal"> <?php echo e(trans('admin.No')); ?></button>
                   <button type="button" onclick="NewClients()"  class="btn btn-primary"> <?php echo e(trans('admin.AddNew')); ?></button>
                                </div>
                                
                            </div>
                        </div>
                    </div>

       
        <!-- Shift Details -->
         <div class="modal fade" id="default-example-modal-center-shiftDetails" tabindex="-1" role="dialog" aria-hidden="true">
             
            <div class="modal-dialog modal-lg modal-dialog-centered" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h4 class="modal-title"> 
                           <?php echo e(trans('admin.Shift_Details')); ?>  <?php echo e($shift->Code); ?>

                        </h4>
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true"><i class="fal fa-times"></i></span>
                        </button>
                    </div>
                    
                     <div class="modal-body" id="LOCKK">
                      <div class="row">
                        <div class="col-md-10">
                    <label><?php echo e(trans('admin.Password')); ?></label>        
              <input type="password" id="Pass" class="form-control">     
              <input type="hidden" id="RightPass" value="<?php echo e($Def->Shift_Pass); ?>">     
                            </div>
                        <div class="col-md-2">
            <button type="button" onclick="Unlock()" class="'btn btn-primary m-4"><i class="fal fa-lock"></i></button>                
                            </div>
                        </div>
                    </div>
                    
                    
                    <div class="modal-body" id="DETALIS" style="display: none">
                      <table class="table table-bordered">
                          <tbody>
                              <tr>
                                  <td><?php echo e(trans('admin.Total_Cash')); ?> </td>
                                  <td><?php echo e($shift->Total_Cash); ?></td>
                              </tr>
                              <tr>
                                    <td><?php echo e(trans('admin.Total_Later')); ?> </td>
                                  <td><?php echo e($shift->Total_Later); ?></td>
                              </tr>
                              <tr>
                                     <td><?php echo e(trans('admin.Total_Visa')); ?> </td>
                                  <td><?php echo e($shift->Total_Visa); ?></td>
                              </tr>
                                     <tr>
                                     <td><?php echo e(trans('admin.Total_Recipt')); ?> </td>
                                  <td><?php echo e($shift->Total_Recipt); ?></td>
                              </tr>
                              
                                     <tr>
                                     <td><?php echo e(trans('admin.Total_Payment')); ?> </td>
                                  <td><?php echo e($shift->Total_Payment); ?></td>
                              </tr>
                              <tr>
                                  <td><?php echo e(trans('admin.Total')); ?> </td>
                                  <td><?php echo e($shift->Total); ?></td>
                              </tr>
                          </tbody>
                      </table>
                    </div>
                    <div class="modal-footer">

                    </div>
                </div>
            </div>
        </div>

               <!-- Open Safe -->
         <div class="modal fade" id="OpenSafe" tabindex="-1" role="dialog" aria-hidden="true">
             
            <div class="modal-dialog modal-lg modal-dialog-centered" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h4 class="modal-title"> 
<?php echo e(trans('admin.Password_To_Open_SafeDrawer')); ?>

                        </h4>
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true"><i class="fal fa-times"></i></span>
                        </button>
                    </div>
                    
                     <div class="modal-body" id="BLOCKSAFE">
                      <div class="row">
                        <div class="col-md-10">
                    <label><?php echo e(trans('admin.Password')); ?></label>        
              <input type="password" id="PassSafe" class="form-control">     
              <input type="hidden" id="RightPassSafe" value="<?php echo e($Def->Shift_Pass); ?>">     
                            </div>
                        <div class="col-md-2">
            <button type="button" onclick="UnlockSafe()" class="'btn btn-primary m-4"><i class="fal fa-lock"></i></button>                
                            </div>
                        </div>
                    </div>
                    
                    
                 
                    <div class="modal-footer">

                    </div>
                </div>
            </div>
        </div>

         <!-- Close Shift -->
         <div class="modal fade" id="default-example-modal-center-closeShift" tabindex="-1" role="dialog" aria-hidden="true">
            <div class="modal-dialog modal-lg modal-dialog-centered" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h4 class="modal-title">
                          <?php echo e(trans('admin.Close_Shift')); ?>

                        </h4>
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true"><i class="fal fa-times"></i></span>
                        </button>
                    </div>
                    <div class="modal-body">
                      
                    <form action="<?php echo e(url('CloseShift')); ?>" method="post">
                        <?php echo csrf_field(); ?>

                       
                      <input type="hidden" name="ShiftID" value="<?php echo e($shift->id); ?>">
                            <div class="row">
                                <div class="form-group col-lg-2 col-12">
                                    <label class="form-label" for="simpleinput"><?php echo e(trans('admin.Shift_Code')); ?> </label>
                                    <input type="text"  class="form-control " disabled value="<?php echo e($shift->Code); ?>">
                                </div>
                                <div class="form-group col-lg-4 col-12">
                                    <label class="form-label" for="simpleinput"><?php echo e(trans('admin.Amount')); ?> </label>
              <input type="number" step="any" name="AmountShift"  class="form-control use-keyboard-input" required>
                                </div>
                                <div class="form-group col-lg-6 col-12">
                                    <label class="form-label" for="simpleinput"><?php echo e(trans('admin.Notes')); ?> </label>
                                    <input type="text" name="Note"  class="form-control use-keyboard-input">
                                </div>
                                         <div class="form-group col-lg-6 col-6">
                   <button type="submit" class="btn btn-primary"> <?php echo e(trans('admin.Close_Shift')); ?></button>
                                </div>    
                            </div>
                             </form>        
                       
                    </div>
                    <div class="modal-footer">
                      
                    </div>
                </div>
            </div>
        </div>
        
        
        <!-- Groups modal -->
        <div class="modal fade" id="groups" tabindex="-1" role="dialog" aria-hidden="true">
            <div class="modal-dialog modal-xl modal-dialog-centered" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h4 class="modal-title">
                        <?php echo e(trans('admin.Groups')); ?>

                        </h4>
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true"><i class="fal fa-times"></i></span>
                        </button>
                    </div>
                    <div class="modal-body">
                        <div class="row">
                            <?php $__currentLoopData = $ItemsGroups; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $group): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                 
                            <div class="col-md-2">
                                <a data-dismiss="modal" onclick="GROUP(<?php echo e($group->id); ?>)">
                               <div class="group-details">
                                   <?php if(!empty($group->Image)): ?>
                                   <img src="<?php echo e(URL::to($group->Image)); ?>" alt="">
                                   <?php else: ?>
                                      <img src="<?php echo e(asset('Admin/img/demo/gallery/5.jpg')); ?>" alt="">
                                   <?php endif; ?>
                                   
                                  <p>
                                    <?php echo e(app()->getLocale() == 'ar' ?$group->Name :$group->NameEn); ?>

                                   </p>
                                 </div>
                                </a>
                            </div>
                       
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> 
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-secondary" data-dismiss="modal"><?php echo e(trans('admin.Close')); ?></button>
                    </div>
                </div>
            </div>
        </div>
        
        
        <!-- Brands modal -->
        <div class="modal fade" id="brands" tabindex="-1" role="dialog" aria-hidden="true">
            <div class="modal-dialog modal-xl modal-dialog-centered" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h4 class="modal-title">
                               <?php echo e(trans('admin.Brands')); ?>

                        </h4>
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true"><i class="fal fa-times"></i></span>
                        </button>
                    </div>
                    <div class="modal-body">
                        <div class="row">
                                          <?php $__currentLoopData = $Brands; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $brand): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                 
                            <div class="col-md-2">
                                <a data-dismiss="modal" onclick="BRAND(<?php echo e($brand->id); ?>)">
                               <div class="group-details">
                                   <?php if(!empty($brand->Image)): ?>
                                   <img src="<?php echo e(URL::to($brand->Image)); ?>" alt="">
                                   <?php else: ?>
                                      <img src="<?php echo e(asset('Admin/img/demo/gallery/5.jpg')); ?>" alt="">
                                   <?php endif; ?>
                                   
                                  <p>
                                             <?php echo e(app()->getLocale() == 'ar' ?$brand->Name :$brand->NameEn); ?>   
                                   </p>
                                 </div>
                                </a>
                            </div>
                       
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> 
                        </div>
                    </div>
                    <div class="modal-footer">
             <button type="button" class="btn btn-secondary" data-dismiss="modal">   <?php echo e(trans('admin.Close')); ?></button>
                    </div>
                </div>
            </div>
        </div>
        

            <!--         Recipt Voucher modal -->
        <div class="modal fade" id="Recipt" tabindex="-1" role="dialog" aria-hidden="true">
            <div class="modal-dialog modal-xl modal-dialog-centered" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h4 class="modal-title">
                               <?php echo e(trans('admin.Receipt_Voucher')); ?>

                        </h4>
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true"><i class="fal fa-times"></i></span>
                        </button>
                    </div>
                    
                    
                    <div class="modal-body">
                        <div class="row">
                            
                            
                <div class="col-md-6">   
                <label><?php echo e(trans('admin.Creditor')); ?></label>            
                    <input type="number" step="any" class="form-control" id="Creditor">
                        </div>       
                            
                        <div class="col-md-6">   
                <label><?php echo e(trans('admin.Account')); ?></label>            
            <select  class="select2 form-control w-100" id="AccountCode" >
                                             
                          </select>
                        </div>   
                            
                            
                                 <div class="col-md-12">   
                <label><?php echo e(trans('admin.Statement')); ?></label>            
                    <input type="text"  class="form-control" id="STATEMENT">
                        </div> 
                            
                            
<input type="hidden" id="Shift"  value="<?php echo e($shift->id); ?>">    
<input type="hidden" id="Safe"  value="<?php echo e(auth()->guard('admin')->user()->safe); ?>">
<input type="hidden" id="Coin"  value="<?php echo e($Def->Coin); ?>">
<input type="hidden" id="Draw"  value="<?php echo e($Def->Draw); ?>">      
 <input type="hidden" id="STORE" value="<?php echo e(auth()->guard('admin')->user()->store); ?>">                           
                            

                        </div>
                    </div>
                    <div class="modal-footer">
             <button type="button" class="btn btn-secondary" data-dismiss="modal">   <?php echo e(trans('admin.Close')); ?></button>
             <button type="button" class="btn btn-secondary" id="ReciptVoucher">   <?php echo e(trans('admin.Save')); ?></button>
                    </div>
                </div>
            </div>
        </div>
  
                 <!--         Recipt Voucher 2 modal -->
        <div class="modal fade" id="ReciptTwo" tabindex="-1" role="dialog" aria-hidden="true">
            <div class="modal-dialog modal-xl modal-dialog-centered" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h4 class="modal-title">
                                 <?php echo e(trans('admin.Payment_Voucher')); ?>

                        </h4>
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true"><i class="fal fa-times"></i></span>
                        </button>
                    </div>
                    
                    
                    <div class="modal-body">
                        <div class="row">
                            
                            
                <div class="col-md-6">   
                <label><?php echo e(trans('admin.Creditor')); ?></label>            
                    <input type="number" step="any" class="form-control" id="CreditorF">
                        </div>       
                            
                        <div class="col-md-6">   
                <label><?php echo e(trans('admin.Account')); ?></label>            
            <select  class="select2 form-control w-100" id="AccountCodeF" >
                                             
                          </select>
                        </div>   
                            
                            
                                <div class="col-md-12">   
                <label><?php echo e(trans('admin.Statement')); ?></label>            
                    <input type="text"  class="form-control" id="STATEMENTF">
                        </div> 
                                        
<input type="hidden" id="ShiftF"  value="<?php echo e($shift->id); ?>">    
<input type="hidden" id="SafeF"  value="<?php echo e(auth()->guard('admin')->user()->safe); ?>">
<input type="hidden" id="CoinF"  value="<?php echo e($Def->Coin); ?>">
<input type="hidden" id="DrawF"  value="<?php echo e($Def->Draw); ?>">      
 <input type="hidden" id="STOREF" value="<?php echo e(auth()->guard('admin')->user()->store); ?>">                           
                            

                        </div>
                    </div>
                    <div class="modal-footer">
             <button type="button" class="btn btn-secondary" data-dismiss="modal">   <?php echo e(trans('admin.Close')); ?></button>
             <button type="button" class="btn btn-secondary" id="ReciptVoucher">   <?php echo e(trans('admin.Save')); ?></button>
                    </div>
                </div>
            </div>
        </div>
  
        
                 <!--         Payment Voucher modal -->
        <div class="modal fade" id="PayVouch" tabindex="-1" role="dialog" aria-hidden="true">
            <div class="modal-dialog modal-xl modal-dialog-centered" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h4 class="modal-title">
                               <?php echo e(trans('admin.Payment_Voucher')); ?>

                        </h4>
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true"><i class="fal fa-times"></i></span>
                        </button>
                    </div>
                    
                    
                    <div class="modal-body">
                        <div class="row">
                            
                            
                <div class="col-md-6">   
                <label><?php echo e(trans('admin.Debitor')); ?></label>            
                    <input type="number" step="any" class="form-control" id="Debitor">
                        </div>       
                            
                        <div class="col-md-6">   
                <label><?php echo e(trans('admin.Account')); ?></label>            
            <select  class="select2 form-control w-100" id="AccountCodee" >
                                             
                          </select>
                        </div>   
                            
                                      <div class="col-md-12">   
                <label><?php echo e(trans('admin.Statement')); ?></label>            
                    <input type="text"  class="form-control" id="STATEMENTP">
                        </div>             
                            
<input type="hidden" id="ShiftP"  value="<?php echo e($shift->id); ?>">    
<input type="hidden" id="SafeP"  value="<?php echo e(auth()->guard('admin')->user()->safe); ?>">
<input type="hidden" id="CoinP"  value="<?php echo e($Def->Coin); ?>">
<input type="hidden" id="DrawP"  value="<?php echo e($Def->Draw); ?>">      
 <input type="hidden" id="STOREP" value="<?php echo e(auth()->guard('admin')->user()->store); ?>">                           
                            

                        </div>
                    </div>
                    <div class="modal-footer">
             <button type="button" class="btn btn-secondary" data-dismiss="modal">   <?php echo e(trans('admin.Close')); ?></button>
             <button type="button" class="btn btn-secondary" id="PaymentVoucher">   <?php echo e(trans('admin.Save')); ?></button>
                    </div>
                </div>
            </div>
        </div>
  
                      <!--         Payment 2 Voucher modal -->
        <div class="modal fade" id="PayyVouch" tabindex="-1" role="dialog" aria-hidden="true">
            <div class="modal-dialog modal-xl modal-dialog-centered" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h4 class="modal-title">
                       <?php echo e(trans('admin.Expenses_Voucher')); ?>

                        </h4>
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true"><i class="fal fa-times"></i></span>
                        </button>
                    </div>
                    
                    
                    <div class="modal-body">
                        <div class="row">
                            
                            
                <div class="col-md-6">   
                <label><?php echo e(trans('admin.Debitor')); ?></label>            
                    <input type="number" step="any" class="form-control" id="Debitorr">
                        </div>       
                            
                        <div class="col-md-6">   
                <label><?php echo e(trans('admin.Account')); ?></label>            
            <select  class="select2 form-control w-100" id="AccountCodeee" >
                                             
                          </select>
                        </div>   
                         
                            
                                          <div class="col-md-12">   
                <label><?php echo e(trans('admin.Statement')); ?></label>            
                    <input type="text"  class="form-control" id="STATEMENTPr">
                        </div>         
<input type="hidden" id="ShiftPr"  value="<?php echo e($shift->id); ?>">    
<input type="hidden" id="SafePr"  value="<?php echo e(auth()->guard('admin')->user()->safe); ?>">
<input type="hidden" id="CoinPr"  value="<?php echo e($Def->Coin); ?>">
<input type="hidden" id="DrawPr"  value="<?php echo e($Def->Draw); ?>">      
 <input type="hidden" id="STOREPr" value="<?php echo e(auth()->guard('admin')->user()->store); ?>">                           
                            

                        </div>
                    </div>
                    <div class="modal-footer">
             <button type="button" class="btn btn-secondary" data-dismiss="modal">   <?php echo e(trans('admin.Close')); ?></button>
             <button type="button" class="btn btn-secondary" id="PaymentVoucherr">   <?php echo e(trans('admin.Save')); ?></button>
                    </div>
                </div>
            </div>
        </div>
  
                              <!--         Payment 3 Voucher modal -->
        <div class="modal fade" id="PayyyVouch" tabindex="-1" role="dialog" aria-hidden="true">
            <div class="modal-dialog modal-xl modal-dialog-centered" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h4 class="modal-title">
                                  <?php echo e(trans('admin.Vendor_Voucher')); ?>

                        </h4>
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true"><i class="fal fa-times"></i></span>
                        </button>
                    </div>
                    
                    
                    <div class="modal-body">
                        <div class="row">
                            
                            
                <div class="col-md-6">   
                <label><?php echo e(trans('admin.Debitor')); ?></label>            
                    <input type="number" step="any" class="form-control" id="Debitorrr">
                        </div>       
                            
                        <div class="col-md-6">   
                <label><?php echo e(trans('admin.Account')); ?></label>            
            <select  class="select2 form-control w-100" id="AccountCodeeee" >
                                             
                          </select>
                        </div>   
                            
                                                     <div class="col-md-12">   
                <label><?php echo e(trans('admin.Statement')); ?></label>            
                    <input type="text"  class="form-control" id="STATEMENTPrP">
                        </div>      
                            
<input type="hidden" id="ShiftPrP"  value="<?php echo e($shift->id); ?>">    
<input type="hidden" id="SafePrP"  value="<?php echo e(auth()->guard('admin')->user()->safe); ?>">
<input type="hidden" id="CoinPrP"  value="<?php echo e($Def->Coin); ?>">
<input type="hidden" id="DrawPrP"  value="<?php echo e($Def->Draw); ?>">      
 <input type="hidden" id="STOREPrP" value="<?php echo e(auth()->guard('admin')->user()->store); ?>">                           
                            

                        </div>
                    </div>
                    <div class="modal-footer">
             <button type="button" class="btn btn-secondary" data-dismiss="modal">   <?php echo e(trans('admin.Close')); ?></button>
             <button type="button" class="btn btn-secondary" id="PaymentVoucherrr">   <?php echo e(trans('admin.Save')); ?></button>
                    </div>
                </div>
            </div>
        </div>
  
        
              <!-- UnitTTT modal -->
        <div class="modal fade" id="UnitTTT" tabindex="-1" role="dialog" aria-hidden="true">
            <div class="modal-dialog  modal-dialog-centered" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h4 class="modal-title">
                        <?php echo e(trans('admin.Unit')); ?>

                        </h4>
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true"><i class="fal fa-times"></i></span>
                        </button>
                    </div>
                    <div class="modal-body">
                        <div class="row">
                        <div class="col-md-12">
                    <input type="hidden" id="R">        
                    <input type="hidden" id="ProR">        
                    <input type="hidden" id="CodeR">        
                    <input type="hidden" id="StoR">        
                        <select class="select2 form-control" id="ChUnit" onchange="UnitCodePurch()">
           
                            </select>
                        </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-secondary" data-dismiss="modal"><?php echo e(trans('admin.Close')); ?></button>
                    </div>
                </div>
            </div>
        </div>
        
        
          <!-- Tax modal -->
        <div class="modal fade" id="TAXXXX" tabindex="-1" role="dialog" aria-hidden="true">
            <div class="modal-dialog  modal-dialog-centered" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h4 class="modal-title">
                        <?php echo e(trans('admin.Unit')); ?>

                        </h4>
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true"><i class="fal fa-times"></i></span>
                        </button>
                    </div>
                    <div class="modal-body">
                        <div class="row">
                        <div class="col-md-12">
                    <input type="hidden" id="RX">        
                    <input type="hidden" id="ProRX">               
                        <select class="select2 form-control" id="OLDTAX" onchange="TAXPurch()">
                            <?php $__currentLoopData = $TAXESS; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $tax): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <option value="<?php echo e($tax->id); ?>"> 
                            
                         <?php echo e(app()->getLocale() == 'ar' ?$tax->Name :$tax->NameEn); ?>    
                            </option>
                              <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>        
                            </select>
                        </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-secondary" data-dismiss="modal"><?php echo e(trans('admin.Close')); ?></button>
                    </div>
                </div>
            </div>
        </div>
            
          <?php if(auth()->guard('admin')->user()->pos_stores == 1): ?>     
    
         <!-- Other Qty -->
        <div class='modal fade' id='Avilable' tabindex='-1' role='dialog' aria-labelledby='exampleModalLabel' aria-hidden='true'>
        <div class='modal-dialog' role='document'>
        <div class='modal-content'>
        <div class='modal-header'>
        <h5 class='modal-title' id='exampleModalLabel'><?php echo e(trans('admin.Qty_In_OtherStores')); ?></h5><button type='button' class='close' data-dismiss='modal' aria-label='Close'><span aria-hidden='true'>&times;</span></button>
        </div>
        <div class='modal-body'>
                       <table class="table table-bordered table-hover table-striped">
                            <thead>
                                <th><?php echo e(trans('admin.Store')); ?></th>
                                <th><?php echo e(trans('admin.Qty')); ?></th>
                            </thead>
                            <tbody class="QTYOTHERSTORES">

                            </tbody>
                        </table>
        </div>
        <div class='modal-footer'>
        <button type='button' class='btn btn-secondary' data-dismiss='modal'>Close</button>
            </div>
            </div>
            </div>
            </div>
        
        
        
        <?php endif; ?>  
        
        <!-- END Messenger -->
        <!-- BEGIN Page Settings -->
        <div class="modal fade js-modal-settings modal-backdrop-transparent" tabindex="-1" role="dialog" aria-hidden="true">
            <div class="modal-dialog modal-dialog-right modal-md">
                <div class="modal-content">
                    <div class="dropdown-header bg-trans-gradient d-flex justify-content-center align-items-center w-100">
                        <h4 class="m-0 text-center color-white">
                            Layout Settings
                            <small class="mb-0 opacity-80">User Interface Settings</small>
                        </h4>
                        <button type="button" class="close text-white position-absolute pos-top pos-right p-2 m-1 mr-2" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true"><i class="fal fa-times"></i></span>
                        </button>
                    </div>
                    <div class="modal-body p-0">
                        <div class="settings-panel">
                            <div class="mt-4 d-table w-100 px-5">
                                <div class="d-table-cell align-middle">
                                    <h5 class="p-0">
                                        App Layout
                                    </h5>
                                </div>
                            </div>
                            <div class="list" id="fh">
                                <a href="#" onclick="return false;" class="btn btn-switch" data-action="toggle" data-class="header-function-fixed"></a>
                                <span class="onoffswitch-title">Fixed Header</span>
                                <span class="onoffswitch-title-desc">header is in a fixed at all times</span>
                            </div>
                            <div class="list" id="nff">
                                <a href="#" onclick="return false;" class="btn btn-switch" data-action="toggle" data-class="nav-function-fixed"></a>
                                <span class="onoffswitch-title">Fixed Navigation</span>
                                <span class="onoffswitch-title-desc">left panel is fixed</span>
                            </div>
                            <div class="list" id="nfm">
                                <a href="#" onclick="return false;" class="btn btn-switch" data-action="toggle" data-class="nav-function-minify"></a>
                                <span class="onoffswitch-title">Minify Navigation</span>
                                <span class="onoffswitch-title-desc">Skew nav to maximize space</span>
                            </div>
                            <div class="list" id="nfh">
                                <a href="#" onclick="return false;" class="btn btn-switch" data-action="toggle" data-class="nav-function-hidden"></a>
                                <span class="onoffswitch-title">Hide Navigation</span>
                                <span class="onoffswitch-title-desc">roll mouse on edge to reveal</span>
                            </div>
                            <div class="list" id="nft">
                                <a href="#" onclick="return false;" class="btn btn-switch" data-action="toggle" data-class="nav-function-top"></a>
                                <span class="onoffswitch-title">Top Navigation</span>
                                <span class="onoffswitch-title-desc">Relocate left pane to top</span>
                            </div>
                            <div class="list" id="fff">
                                <a href="#" onclick="return false;" class="btn btn-switch" data-action="toggle" data-class="footer-function-fixed"></a>
                                <span class="onoffswitch-title">Fixed Footer</span>
                                <span class="onoffswitch-title-desc">page footer is fixed</span>
                            </div>
                            <div class="list" id="mmb">
                                <a href="#" onclick="return false;" class="btn btn-switch" data-action="toggle" data-class="mod-main-boxed"></a>
                                <span class="onoffswitch-title">Boxed Layout</span>
                                <span class="onoffswitch-title-desc">Encapsulates to a container</span>
                            </div>
                            <div class="expanded">
                                <ul class="mb-3 mt-1">
                                    <li>
                                        <div class="bg-fusion-50" data-action="toggle" data-class="mod-bg-1"></div>
                                    </li>
                                    <li>
                                        <div class="bg-warning-200" data-action="toggle" data-class="mod-bg-2"></div>
                                    </li>
                                    <li>
                                        <div class="bg-primary-200" data-action="toggle" data-class="mod-bg-3"></div>
                                    </li>
                                    <li>
                                        <div class="bg-success-300" data-action="toggle" data-class="mod-bg-4"></div>
                                    </li>
                                    <li>
                                        <div class="bg-white border" data-action="toggle" data-class="mod-bg-none"></div>
                                    </li>
                                </ul>
                                <div class="list" id="mbgf">
                                    <a href="#" onclick="return false;" class="btn btn-switch" data-action="toggle" data-class="mod-fixed-bg"></a>
                                    <span class="onoffswitch-title">Fixed Background</span>
                                </div>
                            </div>
                            <div class="mt-4 d-table w-100 px-5">
                                <div class="d-table-cell align-middle">
                                    <h5 class="p-0">
                                        Mobile Menu
                                    </h5>
                                </div>
                            </div>
                            <div class="list" id="nmp">
                                <a href="#" onclick="return false;" class="btn btn-switch" data-action="toggle" data-class="nav-mobile-push"></a>
                                <span class="onoffswitch-title">Push Content</span>
                                <span class="onoffswitch-title-desc">Content pushed on menu reveal</span>
                            </div>
                            <div class="list" id="nmno">
                                <a href="#" onclick="return false;" class="btn btn-switch" data-action="toggle" data-class="nav-mobile-no-overlay"></a>
                                <span class="onoffswitch-title">No Overlay</span>
                                <span class="onoffswitch-title-desc">Removes mesh on menu reveal</span>
                            </div>
                            <div class="list" id="sldo">
                                <a href="#" onclick="return false;" class="btn btn-switch" data-action="toggle" data-class="nav-mobile-slide-out"></a>
                                <span class="onoffswitch-title">Off-Canvas <sup>(beta)</sup></span>
                                <span class="onoffswitch-title-desc">Content overlaps menu</span>
                            </div>
                            <div class="mt-4 d-table w-100 px-5">
                                <div class="d-table-cell align-middle">
                                    <h5 class="p-0">
                                        Accessibility
                                    </h5>
                                </div>
                            </div>
                            <div class="list" id="mbf">
                                <a href="#" onclick="return false;" class="btn btn-switch" data-action="toggle" data-class="mod-bigger-font"></a>
                                <span class="onoffswitch-title">Bigger Content Font</span>
                                <span class="onoffswitch-title-desc">content fonts are bigger for readability</span>
                            </div>
                            <div class="list" id="mhc">
                                <a href="#" onclick="return false;" class="btn btn-switch" data-action="toggle" data-class="mod-high-contrast"></a>
                                <span class="onoffswitch-title">High Contrast Text (WCAG 2 AA)</span>
                                <span class="onoffswitch-title-desc">4.5:1 text contrast ratio</span>
                            </div>
                            <div class="list" id="mcb">
                                <a href="#" onclick="return false;" class="btn btn-switch" data-action="toggle" data-class="mod-color-blind"></a>
                                <span class="onoffswitch-title">Daltonism <sup>(beta)</sup> </span>
                                <span class="onoffswitch-title-desc">color vision deficiency</span>
                            </div>
                            <div class="list" id="mpc">
                                <a href="#" onclick="return false;" class="btn btn-switch" data-action="toggle" data-class="mod-pace-custom"></a>
                                <span class="onoffswitch-title">Preloader Inside</span>
                                <span class="onoffswitch-title-desc">preloader will be inside content</span>
                            </div>
                            <div class="list" id="mpi">
                                <a href="#" onclick="return false;" class="btn btn-switch" data-action="toggle" data-class="mod-panel-icon"></a>
                                <span class="onoffswitch-title">SmartPanel Icons (not Panels)</span>
                                <span class="onoffswitch-title-desc">smartpanel buttons will appear as icons</span>
                            </div>
                            <div class="mt-4 d-table w-100 px-5">
                                <div class="d-table-cell align-middle">
                                    <h5 class="p-0">
                                        Global Modifications
                                    </h5>
                                </div>
                            </div>
                            <div class="list" id="mcbg">
                                <a href="#" onclick="return false;" class="btn btn-switch" data-action="toggle" data-class="mod-clean-page-bg"></a>
                                <span class="onoffswitch-title">Clean Page Background</span>
                                <span class="onoffswitch-title-desc">adds more whitespace</span>
                            </div>
                            <div class="list" id="mhni">
                                <a href="#" onclick="return false;" class="btn btn-switch" data-action="toggle" data-class="mod-hide-nav-icons"></a>
                                <span class="onoffswitch-title">Hide Navigation Icons</span>
                                <span class="onoffswitch-title-desc">invisible navigation icons</span>
                            </div>
                            <div class="list" id="dan">
                                <a href="#" onclick="return false;" class="btn btn-switch" data-action="toggle" data-class="mod-disable-animation"></a>
                                <span class="onoffswitch-title">Disable CSS Animation</span>
                                <span class="onoffswitch-title-desc">Disables CSS based animations</span>
                            </div>
                            <div class="list" id="mhic">
                                <a href="#" onclick="return false;" class="btn btn-switch" data-action="toggle" data-class="mod-hide-info-card"></a>
                                <span class="onoffswitch-title">Hide Info Card</span>
                                <span class="onoffswitch-title-desc">Hides info card from left panel</span>
                            </div>
                            <div class="list" id="mlph">
                                <a href="#" onclick="return false;" class="btn btn-switch" data-action="toggle" data-class="mod-lean-subheader"></a>
                                <span class="onoffswitch-title">Lean Subheader</span>
                                <span class="onoffswitch-title-desc">distinguished page header</span>
                            </div>
                            <div class="list" id="mnl">
                                <a href="#" onclick="return false;" class="btn btn-switch" data-action="toggle" data-class="mod-nav-link"></a>
                                <span class="onoffswitch-title">Hierarchical Navigation</span>
                                <span class="onoffswitch-title-desc">Clear breakdown of nav links</span>
                            </div>
                            <div class="list" id="mdn">
                                <a href="#" onclick="return false;" class="btn btn-switch" data-action="toggle" data-class="mod-nav-dark"></a>
                                <span class="onoffswitch-title">Dark Navigation</span>
                                <span class="onoffswitch-title-desc">Navigation background is darkend</span>
                            </div>
                            <hr class="mb-0 mt-4">
                            <div class="mt-4 d-table w-100 pl-5 pr-3">
                                <div class="d-table-cell align-middle">
                                    <h5 class="p-0">
                                        Global Font Size
                                    </h5>
                                </div>
                            </div>
                            <div class="list mt-1">
                                <div class="btn-group btn-group-sm btn-group-toggle my-2" data-toggle="buttons">
                                    <label class="btn btn-default btn-sm" data-action="toggle-swap" data-class="root-text-sm" data-target="html">
                                        <input type="radio" name="changeFrontSize"> SM
                                    </label>
                                    <label class="btn btn-default btn-sm" data-action="toggle-swap" data-class="root-text" data-target="html">
                                        <input type="radio" name="changeFrontSize" checked=""> MD
                                    </label>
                                    <label class="btn btn-default btn-sm" data-action="toggle-swap" data-class="root-text-lg" data-target="html">
                                        <input type="radio" name="changeFrontSize"> LG
                                    </label>
                                    <label class="btn btn-default btn-sm" data-action="toggle-swap" data-class="root-text-xl" data-target="html">
                                        <input type="radio" name="changeFrontSize"> XL
                                    </label>
                                </div>
                                <span class="onoffswitch-title-desc d-block mb-0">Change <strong>root</strong> font size to effect rem
                                    values (resets on page refresh)</span>
                            </div>
                            <hr class="mb-0 mt-4">
                            <div class="mt-4 d-table w-100 pl-5 pr-3">
                                <div class="d-table-cell align-middle">
                                    <h5 class="p-0 pr-2 d-flex">
                                        Theme colors
                                        <a href="#" class="ml-auto fw-400 fs-xs" data-toggle="popover" data-trigger="focus" data-placement="top" title="" data-html="true" data-content="The settings below uses <code>localStorage</code> to load the external <strong>CSS</strong> file as an overlap to the base css. Due to network latency and <strong>CPU utilization</strong>, you may experience a brief flickering effect on page load which may show the intial applied theme for a split second. Setting the prefered style/theme in the header will prevent this from happening." data-original-title="<span class='text-primary'><i class='fal fa-exclamation-triangle mr-1'></i> Heads up!</span>" data-template="<div class=&quot;popover bg-white border-white&quot; role=&quot;tooltip&quot;><div class=&quot;arrow&quot;></div><h3 class=&quot;popover-header bg-transparent&quot;></h3><div class=&quot;popover-body fs-xs&quot;></div></div>"><i class="fal fa-info-circle mr-1"></i> more info</a>
                                    </h5>
                                </div>
                            </div>
                            <div class="expanded theme-colors pl-5 pr-3">
                                <ul class="m-0">
                                    <li>
                                        <a href="#" id="myapp-0" data-action="theme-update" data-themesave data-theme="" data-toggle="tooltip" data-placement="top" title="Wisteria (base css)" data-original-title="Wisteria (base css)"></a>
                                    </li>
                                    <li>
                                        <a href="#" id="myapp-1" data-action="theme-update" data-themesave data-theme="css/themes/cust-theme-1.css" data-toggle="tooltip" data-placement="top" title="Tapestry" data-original-title="Tapestry"></a>
                                    </li>
                                    <li>
                                        <a href="#" id="myapp-2" data-action="theme-update" data-themesave data-theme="css/themes/cust-theme-2.css" data-toggle="tooltip" data-placement="top" title="Atlantis" data-original-title="Atlantis"></a>
                                    </li>
                                    <li>
                                        <a href="#" id="myapp-3" data-action="theme-update" data-themesave data-theme="css/themes/cust-theme-3.css" data-toggle="tooltip" data-placement="top" title="Indigo" data-original-title="Indigo"></a>
                                    </li>
                                    <li>
                                        <a href="#" id="myapp-4" data-action="theme-update" data-themesave data-theme="css/themes/cust-theme-4.css" data-toggle="tooltip" data-placement="top" title="Dodger Blue" data-original-title="Dodger Blue"></a>
                                    </li>
                                    <li>
                                        <a href="#" id="myapp-5" data-action="theme-update" data-themesave data-theme="css/themes/cust-theme-5.css" data-toggle="tooltip" data-placement="top" title="Tradewind" data-original-title="Tradewind"></a>
                                    </li>
                                    <li>
                                        <a href="#" id="myapp-6" data-action="theme-update" data-themesave data-theme="css/themes/cust-theme-6.css" data-toggle="tooltip" data-placement="top" title="Cranberry" data-original-title="Cranberry"></a>
                                    </li>
                                    <li>
                                        <a href="#" id="myapp-7" data-action="theme-update" data-themesave data-theme="css/themes/cust-theme-7.css" data-toggle="tooltip" data-placement="top" title="Oslo Gray" data-original-title="Oslo Gray"></a>
                                    </li>
                                    <li>
                                        <a href="#" id="myapp-8" data-action="theme-update" data-themesave data-theme="css/themes/cust-theme-8.css" data-toggle="tooltip" data-placement="top" title="Chetwode Blue" data-original-title="Chetwode Blue"></a>
                                    </li>
                                    <li>
                                        <a href="#" id="myapp-9" data-action="theme-update" data-themesave data-theme="css/themes/cust-theme-9.css" data-toggle="tooltip" data-placement="top" title="Apricot" data-original-title="Apricot"></a>
                                    </li>
                                    <li>
                                        <a href="#" id="myapp-10" data-action="theme-update" data-themesave data-theme="css/themes/cust-theme-10.css" data-toggle="tooltip" data-placement="top" title="Blue Smoke" data-original-title="Blue Smoke"></a>
                                    </li>
                                    <li>
                                        <a href="#" id="myapp-11" data-action="theme-update" data-themesave data-theme="css/themes/cust-theme-11.css" data-toggle="tooltip" data-placement="top" title="Green Smoke" data-original-title="Green Smoke"></a>
                                    </li>
                                    <li>
                                        <a href="#" id="myapp-12" data-action="theme-update" data-themesave data-theme="css/themes/cust-theme-12.css" data-toggle="tooltip" data-placement="top" title="Wild Blue Yonder" data-original-title="Wild Blue Yonder"></a>
                                    </li>
                                    <li>
                                        <a href="#" id="myapp-13" data-action="theme-update" data-themesave data-theme="css/themes/cust-theme-13.css" data-toggle="tooltip" data-placement="top" title="Emerald" data-original-title="Emerald"></a>
                                    </li>
                                    <li>
                                        <a href="#" id="myapp-14" data-action="theme-update" data-themesave data-theme="css/themes/cust-theme-14.css" data-toggle="tooltip" data-placement="top" title="Supernova" data-original-title="Supernova"></a>
                                    </li>
                                    <li>
                                        <a href="#" id="myapp-15" data-action="theme-update" data-themesave data-theme="css/themes/cust-theme-15.css" data-toggle="tooltip" data-placement="top" title="Hoki" data-original-title="Hoki"></a>
                                    </li>
                                </ul>
                            </div>
                            <hr class="mb-0 mt-4">
                            <div class="mt-4 d-table w-100 pl-5 pr-3">
                                <div class="d-table-cell align-middle">
                                    <h5 class="p-0 pr-2 d-flex">
                                        Theme Modes (beta)
                                        <a href="#" class="ml-auto fw-400 fs-xs" data-toggle="popover" data-trigger="focus" data-placement="top" title="" data-html="true" data-content="This is a brand new technique we are introducing which uses CSS variables to infiltrate color options. While this has been working nicely on modern browsers without much issues, some users <strong>may still face issues on Internet Explorer </strong>. Until these issues are resolved or Internet Explorer improves, this feature will remain in Beta" data-original-title="<span class='text-primary'><i class='fal fa-question-circle mr-1'></i> Why beta?</span>" data-template="<div class=&quot;popover bg-white border-white&quot; role=&quot;tooltip&quot;><div class=&quot;arrow&quot;></div><h3 class=&quot;popover-header bg-transparent&quot;></h3><div class=&quot;popover-body fs-xs&quot;></div></div>"><i class="fal fa-question-circle mr-1"></i> why beta?</a>
                                    </h5>
                                </div>
                            </div>
                            <div class="pl-5 pr-3 py-3">
                                <div class="ie-only alert alert-warning d-none">
                                    <h6>Internet Explorer Issue</h6>
                                    This particular component may not work as expected in Internet Explorer. Please use with caution.
                                </div>
                                <div class="row no-gutters">
                                    <div class="col-4 pr-2 text-center">
                                        <div id="skin-default" data-action="toggle-replace" data-replaceclass="mod-skin-light mod-skin-dark" data-class="" data-toggle="tooltip" data-placement="top" title="" class="d-flex bg-white border border-primary rounded overflow-hidden text-success js-waves-on" data-original-title="Default Mode" style="height: 80px">
                                            <div class="bg-primary-600 bg-primary-gradient px-2 pt-0 border-right border-primary"></div>
                                            <div class="d-flex flex-column flex-1">
                                                <div class="bg-white border-bottom border-primary py-1"></div>
                                                <div class="bg-faded flex-1 pt-3 pb-3 px-2">
                                                    <div class="py-3" style="background:url('img/demo/s-1.png') top left no-repeat;background-size: 100%;"></div>
                                                </div>
                                            </div>
                                        </div>
                                        Default
                                    </div>
                                    <div class="col-4 px-1 text-center">
                                        <div id="skin-light" data-action="toggle-replace" data-replaceclass="mod-skin-dark" data-class="mod-skin-light" data-toggle="tooltip" data-placement="top" title="" class="d-flex bg-white border border-secondary rounded overflow-hidden text-success js-waves-on" data-original-title="Light Mode" style="height: 80px">
                                            <div class="bg-white px-2 pt-0 border-right border-"></div>
                                            <div class="d-flex flex-column flex-1">
                                                <div class="bg-white border-bottom border- py-1"></div>
                                                <div class="bg-white flex-1 pt-3 pb-3 px-2">
                                                    <div class="py-3" style="background:url('img/demo/s-1.png') top left no-repeat;background-size: 100%;"></div>
                                                </div>
                                            </div>
                                        </div>
                                        Light
                                    </div>
                                    <div class="col-4 pl-2 text-center">
                                        <div id="skin-dark" data-action="toggle-replace" data-replaceclass="mod-skin-light" data-class="mod-skin-dark" data-toggle="tooltip" data-placement="top" title="" class="d-flex bg-white border border-dark rounded overflow-hidden text-success js-waves-on" data-original-title="Dark Mode" style="height: 80px">
                                            <div class="bg-fusion-500 px-2 pt-0 border-right"></div>
                                            <div class="d-flex flex-column flex-1">
                                                <div class="bg-fusion-600 border-bottom py-1"></div>
                                                <div class="bg-fusion-300 flex-1 pt-3 pb-3 px-2">
                                                    <div class="py-3 opacity-30" style="background:url('img/demo/s-1.png') top left no-repeat;background-size: 100%;"></div>
                                                </div>
                                            </div>
                                        </div>
                                        Dark
                                    </div>
                                </div>
                            </div>
                            <hr class="mb-0 mt-4">
                            <div class="pl-5 pr-3 py-3 bg-faded">
                                <div class="row no-gutters">
                                    <div class="col-6 pr-1">
                                        <a href="#" class="btn btn-outline-danger fw-500 btn-block" data-action="app-reset">Reset Settings</a>
                                    </div>
                                    <div class="col-6 pl-1">
                                        <a href="#" class="btn btn-danger fw-500 btn-block" data-action="factory-reset">Factory Reset</a>
                                    </div>
                                </div>
                            </div>
                        </div> <span id="saving"></span>
                    </div>
                </div>
            </div>
        </div>
        <!-- END Page Settings -->



        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
        <script src="<?php echo e(asset('Admin/js/vendors.bundle.js')); ?>"></script>
        <script src="<?php echo e(asset('Admin/js/app.bundle.js')); ?>"></script>
        <script src="<?php echo e(asset('Admin/js/formplugins/select2/select2.bundle.js')); ?>"></script>
        

        <script type="text/javascript">
            /* Activate smart panels */
            $('#js-page-content').smartPanel();

        </script>
       

  
            <script>
$(document).ready(function(){
  setTimeout(function(){ $("#ex").hide(); }, 6000);
});
</script>
        

    <script src="<?php echo e(asset('Admin/js/datagrid/datatables/datatables.bundle.js')); ?>"></script>
    <script src="<?php echo e(asset('Admin/js/datagrid/datatables/datatables.export.js')); ?>"></script>
    <script src="<?php echo e(asset('Admin/js/formplugins/summernote/summernote.js')); ?>"></script>
    <script src="<?php echo e(asset('Admin/js/formplugins/select2/select2.bundle.js')); ?>"></script>
    
         <?php if($Def->Discount == 0): ?>
            <input type="hidden" id="DIS" value="0">  <!-- Number -->
        <?php else: ?>
            <input type="hidden" id="DIS" value="1">  <!-- Precent -->
        <?php endif; ?>     
        
       
                 <?php if($show->Tax_POS == 0): ?>
            <input type="hidden" id="ShowTax" value="0">  
        <?php else: ?>
            <input type="hidden" id="ShowTax" value="1">  
        <?php endif; ?>    
        
        
        <?php if($show->POS_Qty == 0): ?>
            <input type="hidden" id="POS_Qty" value="0">  
        <?php else: ?>
            <input type="hidden" id="POS_Qty" value="1">  
        <?php endif; ?>       
        
        <?php if($show->POS_Barcode == 0): ?>
            <input type="hidden" id="POS_Barcode" value="0">  
        <?php else: ?>
            <input type="hidden" id="POS_Barcode" value="1">  
        <?php endif; ?>  
        
  <?php if(app()->getLocale() == 'ar' ): ?> 
<input type="hidden" id="LANG" value="ar">
<?php else: ?>
<input type="hidden" id="LANG" value="en">
<?php endif; ?>
<input type="hidden" id="LOWCOSTPRICE" value="<?php echo e($Def->SalesLowCostPrice); ?>">
        <input type="hidden" id="LimitSalesQty" value="<?php echo e($Def->LimitSalesQty); ?>">
<input type="hidden" id="RATOO" value="0">
<input type="hidden" id="DEFAULTCOSTPRICE" value="<?php echo e($FCOST->Cost_Price); ?>">          
 <!-- Search Selecet -->
<script>
    $(document).ready(function () {
        $(function () {

            $(".select2").select2();

            $(".select2-placeholder-multiple").select2({
                placeholder: "Select State",
            });
            $(".js-hide-search").select2({
                minimumResultsForSearch: 1 / 0,
            });
            $(".js-max-length").select2({
                maximumSelectionLength: 2,
                placeholder: "Select maximum 2 items",
            });
            $(".select2-placeholder").select2({
                placeholder: "Select a state",
                allowClear: true,
            });

            $(".js-select2-icons").select2({
                minimumResultsForSearch: 1 / 0,
                templateResult: icon,
                templateSelection: icon,
                escapeMarkup: function (elm) {
                    return elm;
                },
            });

            function icon(elm) {
                elm.element;
                return elm.id ? "<i class='" + $(elm.element).data("icon") + " mr-2'></i>" + elm.text : elm.text;
            }

            $("#Emp").select2({
                placeholder: "select...",
                ajax: {
                    type: "GET",
                    dataType: "json",
                    url: "AllEmps",
                    processResults: function (data) {
                        return {
                            results: $.map(data, function (obj, index) {
                                return { id: index, text: obj };
                            }),
                        };

                        console.log(data);
                    },
                  data: function (params) {  
   
            
                   var query = {
                            search: params.term,
                        };
                                
            
              $.ajax({
                              url: 'AllEmpsJ/'+params.term,
                              type:"GET",
                              dataType:"json",
                              beforeSend: function(){
                                  $('#loader').css("visibility", "visible");
                              },

                              success:function(data) {
                                          $('#Emp').empty();  
                                  $.each(data, function(key, value){
   
                         $('#Emp').append('<option value="'+ key +'">' + value + '</option>');
                   
                                  });
                              },
                              complete: function(){
                                  $('#loader').css("visibility", "hidden");
                              }
                          });
            
            
            
        }
                },
            });

            $("#Emp").on("select2:select", function (e) {
                console.log("select done", e.params.data);
            });
            
              $("#client").select2({
                placeholder: "select...",
                ajax: {
                    type: "GET",
                    dataType: "json",
                    url: "AllClientsFilter",
                    processResults: function (data) {
                        return {
                            results: $.map(data, function (obj, index) {

                                return { id: index, text: obj };
                            }),
                        };

                        console.log(data);
                    },
                     data: function (params) {  
   
            
                   var query = {
                            search: params.term,
                        };
                                
            
              $.ajax({
                              url: 'AllClientsFilterJS/'+params.term,
                              type:"GET",
                              dataType:"json",
                              beforeSend: function(){
                                  $('#loader').css("visibility", "visible");
                              },

                              success:function(data) {
                                          $('#client').empty();  
                                  $.each(data, function(key, value){
   
                         $('#client').append('<option value="'+ key +'">' + value + '</option>');
                   
                                  });
                                  
                                      var countryId = $('#client').val();
                      if(countryId) {
                          $.ajax({
                              url: 'AccountBalanceSOFilter/'+countryId,
                              type:"GET",
                              dataType:"json",
                              beforeSend: function(){
                                  $('#loader').css("visibility", "visible");
                              },
   
                              success:function(data) {
                                  $.each(data, function(key, value){
   
        
                    $('#AccountCredit').val(key); 
                    $('#AccountCredit').val(value); 
                                  });
                              },
                              complete: function(){
                                  $('#loader').css("visibility", "hidden");
                              }
                          });
                      } else {
   
                          $('select[name="state"]').empty();
                      }          
                           
                                  
                              },
                              complete: function(){
                                  $('#loader').css("visibility", "hidden");
                              }
                          });
            
            
            
        }
                },
            });

            $("#client").on("select2:select", function (e) {
                console.log("select done", e.params.data);
            });
            
          
              $('#AccountCode').select2({
    placeholder: "select...",
    ajax: {
        type: "GET",
        dataType: 'json',
        url: 'AllSubAccounts',
        processResults: function (data) {
          return {
            results: $.map(data, function(obj, index) {
              return { id: index, text: obj };
            })
          };
            
            	console.log(data);
            
        },
         data: function (params) {  
   
            
                   var query = {
                            search: params.term,
                        };
                                
            
              $.ajax({
                              url: 'AllSubAccountsJ/'+params.term,
                              type:"GET",
                              dataType:"json",
                              beforeSend: function(){
                                  $('#loader').css("visibility", "visible");
                              },

                              success:function(data) {
                                          $('#AccountCode').empty();  
                                  $.each(data, function(key, value){
   
                         $('#AccountCode').append('<option value="'+ key +'">' + value + '</option>');
                   
                                  });
                              },
                              complete: function(){
                                  $('#loader').css("visibility", "hidden");
                              }
                          });
            
            
            
        }
    }
  });

    
$('#AccountCode').on('select2:select', function (e) {
	console.log("select done", e.params.data);
});
      
            
        $('#AccountCodee').select2({
    placeholder: "select...",
    ajax: {
        type: "GET",
        dataType: 'json',
        url: 'AllSubAccounts',
        processResults: function (data) {
          return {
            results: $.map(data, function(obj, index) {
              return { id: index, text: obj };
            })
          };
            
            	console.log(data);
            
        },
         data: function (params) {  
   
            
                   var query = {
                            search: params.term,
                        };
                                
            
              $.ajax({
                              url: 'AllSubAccountsJ/'+params.term,
                              type:"GET",
                              dataType:"json",
                              beforeSend: function(){
                                  $('#loader').css("visibility", "visible");
                              },

                              success:function(data) {
                                          $('#AccountCodee').empty();  
                                  $.each(data, function(key, value){
   
                         $('#AccountCodee').append('<option value="'+ key +'">' + value + '</option>');
                   
                                  });
                              },
                              complete: function(){
                                  $('#loader').css("visibility", "hidden");
                              }
                          });
            
            
            
        }
    }
  });

    
$('#AccountCodee').on('select2:select', function (e) {
	console.log("select done", e.params.data);
});
            
          
                    $('#AccountCodeee').select2({
    placeholder: "select...",
    ajax: {
        type: "GET",
        dataType: 'json',
        url: 'AllSubAccountsMsrofat',
        processResults: function (data) {
          return {
            results: $.map(data, function(obj, index) {
              return { id: index, text: obj };
            })
          };
            
            	console.log(data);
            
        },
         data: function (params) {  
   
            
                   var query = {
                            search: params.term,
                        };
                                
            
              $.ajax({
                              url: 'AllSubAccountsMsrofatJ/'+params.term,
                              type:"GET",
                              dataType:"json",
                              beforeSend: function(){
                                  $('#loader').css("visibility", "visible");
                              },

                              success:function(data) {
                                          $('#AccountCodeee').empty();  
                                  $.each(data, function(key, value){
   
                         $('#AccountCodeee').append('<option value="'+ key +'">' + value + '</option>');
                   
                                  });
                              },
                              complete: function(){
                                  $('#loader').css("visibility", "hidden");
                              }
                          });
            
            
            
        }
    }
  });

    
$('#AccountCodeee').on('select2:select', function (e) {
	console.log("select done", e.params.data);
});
            
 $('#AccountCodeeee').select2({
    placeholder: "select...",
    ajax: {
        type: "GET",
        dataType: 'json',
        url: 'AllSubAccountsMwrden',
        processResults: function (data) {
          return {
            results: $.map(data, function(obj, index) {
              return { id: index, text: obj };
            })
          };
            
            	console.log(data);
            
        },
         data: function (params) {  
   
            
                   var query = {
                            search: params.term,
                        };
                                
            
              $.ajax({
                              url: 'AllSubAccountsMwrdenJ/'+params.term,
                              type:"GET",
                              dataType:"json",
                              beforeSend: function(){
                                  $('#loader').css("visibility", "visible");
                              },

                              success:function(data) {
                                          $('#AccountCodeeee').empty();  
                                  $.each(data, function(key, value){
   
                         $('#AccountCodeeee').append('<option value="'+ key +'">' + value + '</option>');
                   
                                  });
                              },
                              complete: function(){
                                  $('#loader').css("visibility", "hidden");
                              }
                          });
            
            
            
        }
    }
  });

    
$('#AccountCodeeee').on('select2:select', function (e) {
	console.log("select done", e.params.data);
});
         
            
             $("#AccountCodeF").select2({
                placeholder: "select...",
                ajax: {
                    type: "GET",
                    dataType: "json",
                    url: "AllClientsFilter",
                    processResults: function (data) {
                        return {
                            results: $.map(data, function (obj, index) {

                                return { id: index, text: obj };
                            }),
                        };

                        console.log(data);
                    },
                     data: function (params) {  
   
            
                   var query = {
                            search: params.term,
                        };
                                
            
              $.ajax({
                              url: 'AllClientsFilterJS/'+params.term,
                              type:"GET",
                              dataType:"json",
                              beforeSend: function(){
                                  $('#loader').css("visibility", "visible");
                              },

                              success:function(data) {
                                          $('#AccountCodeF').empty();  
                                  $.each(data, function(key, value){
   
                         $('#AccountCodeF').append('<option value="'+ key +'">' + value + '</option>');
                   
                                  });
                              },
                              complete: function(){
                                  $('#loader').css("visibility", "hidden");
                              }
                          });
            
            
            
        }
                },
            });

            $("#AccountCodeF").on("select2:select", function (e) {
                console.log("select done", e.params.data);
            });
            
            
                    $(".EmpDele").select2({
               placeholder: "select...",
               ajax: {
                   type: "GET",
                   dataType: "json",
                   url: "AllEmps",
                   processResults: function (data) {
                       return {
                           results: $.map(data, function (obj, index) {
                               return { id: index, text: obj };
                           }),
                       };
   
                       console.log(data);
                   },
                  data: function (params) {  
   
           
                  var query = {
                           search: params.term,
                       };
                               
           
             $.ajax({
                             url: 'AllEmpsJ/'+params.term,
                             type:"GET",
                             dataType:"json",
                             beforeSend: function(){
                                 $('#loader').css("visibility", "visible");
                             },
   
                             success:function(data) {
                                         $('.EmpDele').empty();  
                                 $.each(data, function(key, value){
   
                        $('.EmpDele').append('<option value="'+ key +'">' + value + '</option>');
                  
                                 });
                             },
                             complete: function(){
                                 $('#loader').css("visibility", "hidden");
                             }
                         });
           
           
           
       }
               },
           });
   
           $(".EmpDele").on("select2:select", function (e) {
               console.log("select done", e.params.data);
           });
                
           
                        
        });
    });
</script>
 
<!-- Client Address -->
<script>
 $('#client').on('change', function(){
      var CLIENT = $('#client').val();  
                         $.ajax({
                   url: 'AllClientsAddressFilter',
                   type:"GET",
                data:{
                  CLIENT:CLIENT
                },             
                   dataType:"json",
                   beforeSend: function(){
                       $('#loader').css("visibility", "visible");
                   },
   
                   success:function(data) {
   
                       $('#Client_Address').empty();
   
                       $.each(data, function(key, value){
   
             $('#Client_Address').append('<option value="'+ key +'">' + value + '</option>');
                           
                       });
                       
       
                   },
                   complete: function(){
                       $('#loader').css("visibility", "hidden");
                   }
               });
                       
     
 });   
    
   $(document).ready(function() {
          var CLIENT = $('#client').val();  
                         $.ajax({
                   url: 'AllClientsAddressFilter',
                   type:"GET",
                data:{
                  CLIENT:CLIENT
                },             
                   dataType:"json",
                   beforeSend: function(){
                       $('#loader').css("visibility", "visible");
                   },
   
                   success:function(data) {
   
                       $('#Client_Address').empty();
   
                       $.each(data, function(key, value){
   
             $('#Client_Address').append('<option value="'+ key +'">' + value + '</option>');
                           
                       });
                       
       
                   },
                   complete: function(){
                       $('#loader').css("visibility", "hidden");
                   }
               });
                       
        
       
   });    
    
</script>        
        
<!-- Account Balance -->
<script>
   $(document).ready(function() {
   
                  $('#client').on('change', function(){
                      var countryId = $(this).val();
                      if(countryId) {
                          $.ajax({
                              url: 'AccountBalanceSOFilter/'+countryId,
                              type:"GET",
                              dataType:"json",
                              beforeSend: function(){
                                  $('#loader').css("visibility", "visible");
                              },
   
                              success:function(data) {
                                  $.each(data, function(key, value){
   
        
                    $('#AccountCredit').val(parseFloat(key).toFixed(2)); 
                    $('#AccountCredit').val(parseFloat(value).toFixed(2)); 
                                  });
                              },
                              complete: function(){
                                  $('#loader').css("visibility", "hidden");
                              }
                          });
                      } else {
   
                          $('select[name="state"]').empty();
                      }
   
                  });
   
              });
    
     $(document).ready(function() { 
 
                      var countryId = $('#client').val();
                      if(countryId) {
                          $.ajax({
                              url: 'AccountBalanceSFilter/'+countryId,
                              type:"GET",
                              dataType:"json",
                              beforeSend: function(){
                                  $('#loader').css("visibility", "visible");
                              },
   
                              success:function(data) {
                                  $.each(data, function(key, value){
   
        
                    $('#AccountCredit').val(parseFloat(key).toFixed(2)); 
                    $('#AccountCredit').val(parseFloat(value).toFixed(2)); 
                                  });
                              },
                              complete: function(){
                                  $('#loader').css("visibility", "hidden");
                              }
                          });
                      } else {
   
                          $('select[name="state"]').empty();
                      }
     
     });
</script>  

<!--  Filter Products -->
<script>
   $(document).ready(function(){
    
    fetch_customer_data();
   
    function fetch_customer_data(search = '',store='',client='')
    {  
     $.ajax({
      url:'SalesProductsPOSFilter',
      method:'GET',
      data:{search:search,store:store,client:client},
      dataType:'json',
      success:function(data)
      {
          
        document.getElementById('data').style.display="block";
       $('.Data').html(data.table_data);

           if(search.toString().length  == 13){
            
                if(parseFloat(data.count) == 1){ 
                
                  if(search.slice(0, 2)  == 20){
                               var t = search.slice(0, 7) ; 
                               var x = search.slice(7, 13) ; 
                               var y = search.slice(12, 13) ; 
     
                      
var z= parseFloat(x) - parseFloat(y) ;
//var z=  x.slice(0, 5);               
                    
var zz= parseFloat(z) / parseFloat(10000) ;
    
                            FunMyzan(data.Get,t,zz);  
                           }else{
                               
                             Fun(data.Get);  
            $('#search').val('');
                               
                           }
                    
                }
               
               
           }else{
                   
               
                 if(parseFloat(data.count) == 1){
                     
                 Fun(data.Get);  
            $('#search').val('');         
                     
      document.getElementById('data').style.display="none";  
          }    
               
               
               
           }
     

    
      }
     })
    }
    

   $(document).on('keyup', '#search', function(event){

     var search = $(this).val();           
     var store = $('#store').val();     
     var client = $('#client').val();       
     var SCAN = $('#SCAN').val(search);
  if (event.which == '10' || event.which == '50' || event.which == '54' || event.which == '52'  || event.which == '48' || event.which == '55' || event.which == '56' || event.which == '49' || event.which == '53' || event.which == '51'  || event.which == '57') {
   
   document.getElementById('data').style.display="none";
       
   }else{
       
    fetch_customer_data(search,store,client); 

       
       
   }
  

           
    });

       
    $(document).on('change', '#client', function(){
     var client = $(this).val();     
     var search = $('#search').val();     
     var store = $('#store').val();      
        if(search != ''){
     fetch_customer_data(search,store,client);
       }else{
      document.getElementById('data').style.display="none";
           
       }
    });  
                 
   });
</script>
        
<!--  Filter SearchCode -->
<script>
   $(document).ready(function(){
    
    fetch_customer_data();
   
    function fetch_customer_data(search = '',store='',client='')
    {  
     $.ajax({
      url:'SalesProductsPOSSearchCodeFilter',
      method:'GET',
      data:{search:search,store:store,client:client},
      dataType:'json',
      success:function(data)
      {
          
        document.getElementById('data').style.display="block";
       $('.Data').html(data.table_data);

           if(search.toString().length  == 13){
            
                if(parseFloat(data.count) == 1){ 
                
                  if(search.slice(0, 2)  == 20){
                               var t = search.slice(0, 7) ; 
                               var x = search.slice(7, 13) ; 
                               var y = search.slice(12, 13) ; 
     
                      
var z= parseFloat(x) - parseFloat(y) ;
//var z=  x.slice(0, 5);               
                    
var zz= parseFloat(z) / parseFloat(10000) ;
    
                            FunMyzan(data.Get,t,zz);  
                           }else{
                               
                             Fun(data.Get);  
            $('#SearchCode').val('');
                               
                           }
                    
                }
               
               
           }else{
                   
               
                 if(parseFloat(data.count) == 1){
                     
                 Fun(data.Get);  
            $('#SearchCode').val('');         
                     
      document.getElementById('data').style.display="none";  
          }    
               
               
               
           }
     

    
      }
     })
    }
    

   $(document).on('keyup', '#SearchCode', function(event){
     var search = $(this).val();           
     var store = $('#store').val();     
     var client = $('#client').val();       
     var SCAN = $('#SCAN').val(search);
  if (event.which == '10' || event.which == '50' || event.which == '54' || event.which == '52'  || event.which == '48' || event.which == '55' || event.which == '56' || event.which == '49' || event.which == '53' || event.which == '51') {
   
   document.getElementById('data').style.display="none";
       
   }else{
       
    fetch_customer_data(search,store,client); 

       
       
   }
  

           
    });

           
   });
</script>
        
<!-- Add New Client -->
<script>
    function NewClients(){
        
    var co = $('#CODE').val();    
    var Name = $('#Name').val();  
    var PriceLevel = $('#PriceLevel').val();  
    var Phone = $('#Phone').val();  
        
    var NaameAddress = $('#NaameAddress').val();  
    var Governrate = $('#Governrate').val();  
    var City = $('#City').val();  
    var Place = $('#Place').val();  
    var Street = $('#Street').val();  
    var Buliding = $('#Buliding').val();  
    var Floor = $('#Floor').val();  
    var Flat = $('#Flat').val();  
    var Special_Mark = $('#Special_Mark').val();  
    var Location = $('#Location').val();  
    var Address_Details = $('#Address_Details').val();  
        var NameEn = $('#NameEn').val();  
   var LANG = $('#LANG').val();  
       if(NameEn == ''){
          
               NameEn = Name ;
          }        
          if(Name) {
                         $.ajax({
                             url: 'AddNewClientPOS/'+co+'/'+Name+'/'+PriceLevel+'/'+Phone,
                             type:"GET",
                             data:{
                               NaameAddress:NaameAddress,
                                Governrate:Governrate,
                                City:City,
                                Place:Place,
                                Street:Street,
                                Buliding:Buliding,
                                Floor:Floor,
                                Flat:Flat,
                                Special_Mark:Special_Mark,
                                Location:Location,
                                Address_Details:Address_Details,  
                                NameEn:NameEn  
                             },
                             dataType:"json",
                             beforeSend: function(){
                                 $('#loader').css("visibility", "visible");
                             },
   
                             success:function(data) {
                                 $.each(data, function(key, value){
                                     
                                          if(LANG == 'ar'){
                            alert('تم الاضافه بنجاح');
                       }else{
                           alert('Added Successfully'); 
                       }       
                                     
                                 });
                             },
                             complete: function(){
                                 $('#loader').css("visibility", "hidden");
                             }
                         });
                     }else{
                         
                                         
                                  if(LANG == 'ar'){        
                       alert('حقل الاسم مطلوب'); 
                      }else{
                          
                       alert('Name Input is Required');        
                      }
                         
                     }
        
        
        
    }
</script>

<!-- LOCK and Unlock SHift -->
<script>
function  Unlock(){
    
var Pass = $('#Pass').val();    
var RightPass = $('#RightPass').val();   
   var LANG = $("#LANG").val();    
    
    if(Pass == RightPass){
        
       document.getElementById('LOCKK').style.display='none'; 
       document.getElementById('DETALIS').style.display='block'; 
    }else{
        
         document.getElementById('LOCKK').style.display='block'; 
       document.getElementById('DETALIS').style.display='none'; 
        
           if(LANG == 'ar' ){ 
          alert('كلمه المرور خطأ');
          }else{
         alert('Password Incorrect');
          } 
     
    }
    
    
}

function  Lock(){
    $('#Pass').val('');
     document.getElementById('LOCKK').style.display='block'; 
       document.getElementById('DETALIS').style.display='none'; 
}
  
    function  UnlockSafe(){
    
var Pass = $('#PassSafe').val();    
var RightPass = $('#RightPassSafe').val();   
    
    if(Pass == RightPass){
        
       document.getElementById('BLOCKSAFE').style.display='none'; 
   
        window.print();
        
    }else{
        
         document.getElementById('BLOCKSAFE').style.display='block'; 
        alert('كلمه المرور خطأ');
    }
    
    
}

        
    
</script>
        
        
<style>
@media  print {
    html, body {
      display: none;
    }
}        
</style>        
        
<!-- Add Products -->
<script>
   function Fun(r) { 
              
             var P_Ar_Name = $("#P_Ar_Name"+r).val();
             var P_En_Name= $("#P_En_Name"+r).val();
             var Product = $("#Product"+r).val();
             var UnitID = $("#UnitPurch"+r).val();
             var UnitName = $("#UnitPurchName"+r).val();
             var Qty = $("#Qty"+r).val();
             var AvQty = $("#AvQty"+r).val();
             var Barcode = $("#CodePurch"+r).val();
             var Price = $("#Price"+r).val();
             var Total = $("#Total"+r).val();
             var ExpDate = $("#ExpDate"+r).val();
             var PurchTax = $("#PurchTax"+r).val();
             var TotalTax = $("#Tax"+r).val();
             var Discount = $("#Discount"+r).val();
             var TotalBFTax = $("#TotalBFTax"+r).val();
             var StorePurch = $("#StorePurchName"+r).val();
             var StorePurchName = $("#StorePurchName"+r).val();
             var PurchTax = $("#PurchTax"+r).val();
             var VOne = $("#VOne"+r).val();
             var VTwo = $("#VTwo"+r).val();
             var V_Name = $("#V_Name"+r).val();
             var VV_Name = $("#VV_Name"+r).val();
             var TaxRate = $("#TaxRate"+r).val();
             var TaxType = $("#TaxType"+r).val();
             var Viro = '';
             var VViro = '';
               var priceSale =$("#priceSale").val();
               var discount =$("#discount").val();
               var serial =$("#serial"+r).val();
                var TDiscPro = $("#TDiscPro"+r).val();
    var CostPrice = $("#CostPrice"+r).val();
       
       
                      var weight = $("#weight"+r).val();
                var maxSales = $("#maxSales"+r).val();
                var RATOO = $("#UnitRato"+r).val();
                var LimitSalesQty = $("#LimitSalesQty").val();
          var DEFAULTCOSTPRICE = $("#DEFAULTCOSTPRICE").val();    
 
       var TWeight=parseFloat(Qty) * (parseFloat(weight) * parseFloat(RATOO)) ;
       
       
              if(DEFAULTCOSTPRICE == 2){
          
            $.ajax({
                             url: 'NewCostProductFilter',
                             type:"GET",
                            data:{
                              store:StorePurch,  
                              pro_code:Barcode, 
                              Product:Product,  
                              Qty:Qty,  
                              UnitID:UnitID  
                            },
                             dataType:"json",
                             beforeSend: function(){
                                 $('#loader').css("visibility", "visible");
                             },
   
                             success:function(data) {
                            
                                     
                                 $("#CostPrice"+r).val(data.total_cost);
                                 
                             },
                             complete: function(){
                                 $('#loader').css("visibility", "hidden");
                             }
                         });
           
          
          }
       
       
       
       
        

       if( V_Name != ''){
           
          Viro= '(' + V_Name +')';
       }
  
       if( VV_Name != ''){
           
         VViro= '(' + VV_Name +')'; 
       }


       if(parseFloat(priceSale) == 0){
         
           var PRIce = 'disabled';
           var PRIceTwo = '';
           
       }else{
           
           var PRIce = '';
                 var PRIceTwo = 'disabled';
       }
       
        if(parseFloat(discount) == 0){
             var Dicco = 'disabled';
             var DiccoTwo = '';
           
       }else{
           
           var Dicco = ''; 
           var DiccoTwo = 'disabled'; 
       }

         if(parseFloat(serial) == 1){
             var ser = 'disabled';
             var serTwo = '';

           
       }else{
           
           var ser = ''; 
           var serTwo = 'disabled'; 

       }

          document.getElementById("Row"+r).style.display = "none";
       
   var i = 0;
   var ii=0;       
   var iii=0;       

         var HighDisc = $("#HighDisc"+r).val();
       var DIS = $("#DIS").val();
        
       if(parseFloat(DIS) == 0){
          
           Discount=$("#Discount"+r).val();
       }else{
         
           var d= Discount / 100 ;
           var Multi= parseFloat(Qty) * parseFloat(Price) ;
          var dd= Multi * d;
           
        Discount=  dd; 
       }
  
         var BFG =  parseFloat(Qty) * parseFloat(Discount) ;
             $("#TDiscPro"+r).val(parseFloat(BFG));

       if(TaxType == 1){
           //Precent
          
      var BF =  parseFloat(Qty) *  (parseFloat(Price)  -  parseFloat(Discount));  
       
           
           TotalBFTax = parseFloat(BF) ;

       i =    parseFloat(TaxRate)  / 100 ;  
           
        ii=  parseFloat(BF) * parseFloat(i) ;
              

           TotalTax=parseFloat(ii);

       iii =  parseFloat(BF) + parseFloat(ii) ;

      
           Total=parseFloat(iii);
           
       }else if(TaxType == 2){
          //Number 
         var BF =  parseFloat(Qty) *  (parseFloat(Price)  -  parseFloat(Discount));  
               TotalBFTax = parseFloat(BF) ;
          
            i =    parseFloat(TaxRate)   ; 
           
              TotalTax=parseFloat(i);

       iii =  parseFloat(BF) + parseFloat(i) ;
           
            Total=parseFloat(iii);
           
           
       }

       
         var POS_Qty = $("#POS_Qty").val();
         var POS_Barcode = $("#POS_Barcode").val();
       
       if(parseFloat(POS_Qty) == 1){
          var ShowAvQty="<span style='color:red'>(<b id='AVVQ"+r+"'><button onclick='OtherQTY("+Product+","+Barcode+")' type='button' class='bt' style='padding:0 !imporatnt' data-toggle='modal' data-target='#Avilable'>"+AvQty+"</button></b>)</span>";
          }else{
             var ShowAvQty="<span style='color:red;display:none'>(<b id='AVVQ"+r+"'><button onclick='OtherQTY("+Product+","+Barcode+")' type='button' class='bt' style='padding:0 !imporatnt' data-toggle='modal' data-target='#Avilable'>"+AvQty+"</button></b>)</span>";
          }
          
          
               if(parseFloat(POS_Barcode) == 1){
          var ShowBarcode = "(<b id='Coding"+r+"'>"+ Barcode +"</b>)";
          }else{
           var ShowBarcode = "<b id='Coding"+r+"' style='display:none'>"+ Barcode +"</b>";
          }
       
         var DIS = $("#DIS").val();
        var RFF= parseFloat(Qty) * parseFloat(Price);
       var RFFResult= parseFloat(RFF) - parseFloat(Total);
       
       
       var ShowTax = $("#ShowTax").val();

               var LANG = $("#LANG").val();
   if(LANG == 'ar' ){ 
          var Nemo = P_Ar_Name ;
          }else{
             var Nemo = P_En_Name ;   
          }     
       
       
       
           var TotCostNew=parseFloat(Qty) * parseFloat(CostPrice) ;


       
       
       if(parseFloat(ShowTax) == 1){
var markup = "<tr><td><i id='DelAssem' class='fal fa-trash-alt'></i></td><td>" + Nemo + ""+ Viro +" "+ VViro +" "+ShowBarcode+" "+ShowAvQty+" <button type='button'  class='btn btn-sm btn-block btn-outline-success waves-effect waves-themed'  data-toggle='modal' onclick='TaxPro("+Product+","+r+")' style='width: 10%;' data-target='#TAXXXX'><i class='fal fa-calculator'></i></button> </td><td><input type='hidden' id='un"+r+"' name='Unit[]' value='"+UnitID+"'><button type='button'  class='btn btn-sm btn-block btn-outline-success waves-effect waves-themed'  data-toggle='modal' onclick='UniPro("+Product+","+r+","+Barcode+","+StorePurch+")' data-target='#UnitTTT'><span id='TextUni"+r+"'>" + UnitName + "<span></button></td><td><input  type='number' "+ser+" step='any' onkeyup='PurchTotal("+r+")' onclick='PurchTotal("+r+")' id='QTTY"+r+"' name='Qty[]' class='form-control input-width Qun' value='"+parseFloat(Qty).toFixed(2)+"'><input "+serTwo+" type='hidden' name='Qty[]' value='"+parseFloat(Qty).toFixed(2)+"'></td><td><input type='number' step='any' "+PRIce+" class='form-control input-width' onkeyup='PurchTotal("+r+")' onclick='PurchTotal("+r+")' id='PRICE"+r+"' name='Price[]' value='"+Price+"'><input "+PRIceTwo+" type='hidden' name='Price[]' value='"+Price+"' id='PCL"+r+"'></td><td style='width:50px'><input  onkeyup='PurchTotal("+r+")' onclick='PurchTotal("+r+")' type='number' step='any' class='form-control Disc input-width' "+Dicco+" name='Discount[]' id='DISC"+r+"' value='"+Discount+"'><input type='hidden' "+DiccoTwo+" name='Discount[]' value='"+Discount+"'></td><td style='width:130px'><input  type='hidden' name='Total[]' id='TOTT"+r+"' value='"+parseFloat(Total).toFixed(2)+"'><input class='form-control Tot total-input-width'  type='text' disabled id='TOTTNo"+r+"' value='"+parseFloat(Total).toFixed(2)+"'></td><input type='hidden' name='V_Name[]' value='"+Viro+"'><input type='hidden' name='VV_Name[]' value='"+VViro+"'><input type='hidden' id='PurchTaxx"+r+"' name='PurchTax[]'  value='"+PurchTax+"'><input type='hidden' name='VOne[]' id='V"+r+"' value='"+VOne+"'><input id='VV"+r+"' type='hidden' name='VTwo[]' value='"+VTwo+"'><input type='hidden' id='PRO"+r+"' name='Product[]' value='"+Product+"'><input type='hidden' name='P_Ar_Name[]' value='"+P_Ar_Name+"'><input type='hidden' name='P_En_Name[]' value='"+P_En_Name+"'><input type='hidden' name='P_Code[]' id='CodingHide"+r+"' value='"+Barcode+"'><input id='AVHide"+r+"' type='hidden' name='AvQty[]' value='"+AvQty+"'><input class='TotalBFTax' id='TBFTax"+r+"' type='hidden' name='TotalBFTax[]' value='"+TotalBFTax+"'><input class='TotalTax' type='hidden' name='TotalTax[]' id='TTax"+r+"' value='"+TotalTax+"'><input id='STORETABLE"+r+"'  type='hidden' name='StorePurch[]' value='"+StorePurch+"'><input type='hidden' name='Exp_Date[]' value='"+ExpDate+"'><input type='hidden' id='RATE"+r+"'  value='"+TaxRate+"'><input type='hidden' id='TYPE"+r+"'  value='"+TaxType+"'><input type='hidden' id='HighDisc"+r+"'  value='"+HighDisc+"'><input type='hidden' id='Enough"+r+"' name='AllEnough[]'  value='0'><input type='hidden' class='DiscoPrecent' id='disssccoount"+r+"' value='"+RFFResult+"'><input type='hidden' class='TDISCOOO' id='TDiscProEdit"+r+"' name='TDiscPro[]' value='"+TDiscPro+"'><input type='hidden' id='costPric"+r+"'   name='CostPrice[]' value='"+CostPrice+"'><input type='hidden' id='weightT"+r+"'   name='weight[]' value='"+weight+"'><input type='hidden' id='UnitRate"+r+"'   name='UnitRate[]' value='"+RATOO+"'><input type='hidden' id='Total_Wight"+r+"' class='W'  name='Total_Wight[]' value='"+TWeight+"'><input type='hidden' id='maxSa"+r+"' value='"+maxSales+"'><input type='hidden' class='COSTPRICES' id='TotCostNew"+r+"' name='TotCostNew[]' value='"+TotCostNew+"'></tr>";
   }else{
      var markup = "<tr><td><i id='DelAssem' class='fal fa-trash-alt'></i></td><td>" + Nemo + ""+ Viro +" "+ VViro +" "+ShowBarcode+" "+ShowAvQty+"</td><td><input type='hidden' id='un"+r+"' name='Unit[]' value='"+UnitID+"'><button type='button'  class='btn btn-sm btn-block btn-outline-success waves-effect waves-themed'  data-toggle='modal' onclick='UniPro("+Product+","+r+","+Barcode+","+StorePurch+")' data-target='#UnitTTT'><span id='TextUni"+r+"'>" + UnitName + "<span></button></td><td><input  type='number' "+ser+" step='any' onkeyup='PurchTotal("+r+")' onclick='PurchTotal("+r+")' id='QTTY"+r+"' name='Qty[]' class='form-control input-width Qun' value='"+parseFloat(Qty).toFixed(2)+"'><input "+serTwo+" type='hidden' name='Qty[]' value='"+parseFloat(Qty).toFixed(2)+"'></td><td><input type='number' step='any' "+PRIce+" class='form-control input-width' onkeyup='PurchTotal("+r+")' onclick='PurchTotal("+r+")' id='PRICE"+r+"' name='Price[]' value='"+Price+"'><input "+PRIceTwo+" type='hidden' name='Price[]' value='"+Price+"' id='PCL"+r+"'></td><td style='width:50px'><input  onkeyup='PurchTotal("+r+")' onclick='PurchTotal("+r+")' type='number' step='any' class='form-control Disc input-width' "+Dicco+" name='Discount[]' id='DISC"+r+"' value='"+Discount+"'><input type='hidden' "+DiccoTwo+" name='Discount[]' value='"+Discount+"'></td><td style='width:130px'><input  type='hidden' name='Total[]' id='TOTT"+r+"' value='"+parseFloat(Total).toFixed(2)+"'><input class='form-control Tot total-input-width'  type='text' disabled id='TOTTNo"+r+"' value='"+parseFloat(Total).toFixed(2)+"'></td><input type='hidden' name='V_Name[]' value='"+Viro+"'><input type='hidden' name='VV_Name[]' value='"+VViro+"'><input type='hidden' id='PurchTaxx"+r+"' name='PurchTax[]'  value='"+PurchTax+"'><input type='hidden' name='VOne[]' id='V"+r+"' value='"+VOne+"'><input id='VV"+r+"' type='hidden' name='VTwo[]' value='"+VTwo+"'><input type='hidden' id='PRO"+r+"' name='Product[]' value='"+Product+"'><input type='hidden' name='P_Ar_Name[]' value='"+P_Ar_Name+"'><input type='hidden' name='P_En_Name[]' value='"+P_En_Name+"'><input type='hidden' name='P_Code[]' id='CodingHide"+r+"' value='"+Barcode+"'><input id='AVHide"+r+"' type='hidden' name='AvQty[]' value='"+AvQty+"'><input class='TotalBFTax' id='TBFTax"+r+"' type='hidden' name='TotalBFTax[]' value='"+TotalBFTax+"'><input class='TotalTax' type='hidden' name='TotalTax[]' id='TTax"+r+"' value='"+TotalTax+"'><input  type='hidden' id='STORETABLE"+r+"' name='StorePurch[]' value='"+StorePurch+"'><input type='hidden' name='Exp_Date[]' value='"+ExpDate+"'><input type='hidden' id='RATE"+r+"'  value='"+TaxRate+"'><input type='hidden' id='TYPE"+r+"'  value='"+TaxType+"'><input type='hidden' id='HighDisc"+r+"'  value='"+HighDisc+"'><input type='hidden' id='Enough"+r+"' name='AllEnough[]'  value='0'><input type='hidden' class='DiscoPrecent' id='disssccoount"+r+"' value='"+RFFResult+"'><input type='hidden' class='TDISCOOO' id='TDiscProEdit"+r+"' name='TDiscPro[]' value='"+TDiscPro+"'><input type='hidden' id='costPric"+r+"' name='CostPrice[]' value='"+CostPrice+"'><input type='hidden' id='weightT"+r+"'   name='weight[]' value='"+weight+"'><input type='hidden' id='UnitRate"+r+"'   name='UnitRate[]' value='"+RATOO+"'><input type='hidden' id='Total_Wight"+r+"' class='W'  name='Total_Wight[]' value='"+TWeight+"'><input type='hidden' id='maxSa"+r+"' value='"+maxSales+"'><input type='hidden' class='COSTPRICES' id='TotCostNew"+r+"' name='TotCostNew[]' value='"+TotCostNew+"'></tr>"; 
       
   }

       
       
    var P = $("#PRO"+r).val();
     var Q = $("#QTTY"+r).val();
     var VO = $("#V"+r).val();
        var VOO = $("#VV"+r).val();
        var PRICE = $("#PRICE"+r).val();
        var DISC = $("#DISC"+r).val();
        var RATE = $("#RATE"+r).val();
        var TYPE = $("#TYPE"+r).val();


       
          if(LimitSalesQty == 1){
       
       if(maxSales >= Qty){
         
   
          
       if(Product == P){

         if(parseFloat(serial) == 0){   
           
           if(VO == VOne  && VOO == VTwo){
           var rt=parseFloat(Q) + parseFloat(1);
           $("#QTTY"+r).val(parseFloat(rt));
               $('#search').val('');
                document.getElementById('data').style.display="none";
           }
             
  $('.Data').hide();
var TaxRate = $("#RATE"+r).val();
   var TaxType = $("#TYPE"+r).val();
   var Qty = $("#QTTY"+r).val();
   var Price = $("#PRICE"+r).val();
   var Discount = $("#DISC"+r).val();
   var i = 0;
   var ii=0;       
   var iii=0;       

             var HighDisc = $("#HighDisc"+r).val();
       var DIS = $("#DIS").val();
        
       if(parseFloat(DIS) == 0){
          
           Discount=$("#DISC"+r).val();
       }else{
         
           var d= Discount / 100 ;
           var Multi= parseFloat(Qty) * parseFloat(Price) ;
          var dd= Multi * d;
           
        Discount=  dd; 
       }
  
        if(HighDisc != 0){
           
         
           if(parseFloat(Discount)  >  parseFloat(HighDisc)){
                     document.getElementById("Action").style.display = "none";    
                     document.getElementById("ActionAlert").style.display = "block";    
           }else{
                   document.getElementById("Action").style.display = "block";      
                   document.getElementById("ActionAlert").style.display = "none";      
               
           }
           
           
       }
       
             var BFG =  parseFloat(Qty) * parseFloat(Discount) ;
             $("#TDiscPro"+r).val(parseFloat(BFG));
  
        
       
       if(TaxType == 1){
           //Precent
          
  var BF =  parseFloat(Qty) *  (parseFloat(Price)  -  parseFloat(Discount));  
       
       $("#TBFTax"+r).val(parseFloat(BF));
           
       i =    parseFloat(TaxRate)  / 100 ;  
           
        ii=  parseFloat(BF) * parseFloat(i) ;
              
           $("#TTax"+r).val(parseFloat(ii));

       iii =  parseFloat(BF) + parseFloat(ii) ;
           
           $("#TOTT"+r).val(parseFloat(iii).toFixed(2));
           $("#TOTTNo"+r).val(parseFloat(iii).toFixed(2));
           
       }else if(TaxType == 2){
          //Number 
        var BF =  parseFloat(Qty) *  (parseFloat(Price)  -  parseFloat(Discount));  
         $("#TBFTax"+r).val(parseFloat(BF));
          
            i =    parseFloat(TaxRate)   ; 
           
           $("#TTax"+r).val(parseFloat(i));

       iii =  parseFloat(BF) + parseFloat(i) ;
           
           $("#TOTT"+r).val(parseFloat(iii).toFixed(2));
           $("#TOTTNo"+r).val(parseFloat(iii).toFixed(2));
           
           
       }
       
           
          play(); 
         }else{
             
             alert('لا يمكن اضافه هذا المنتج مره اخري');
             
         }
           
       }else{
        $("#data-dt").append(markup); 
           $('#search').val('');
         document.getElementById('data').style.display="none";   
           play();
       }
       
               
       
           
          }else{
              
      if(LANG == 'ar' ){           
    alert('تجاوزت الحد المسموح  لبيع كمية هذا المنتج');     
      }else{
          
    alert('You have exceeded the selling limit for this product');            
      }
              
          }
       
          }else{
              
              
               
       if(Product == P){

         if(parseFloat(serial) == 0){   
           
           if(VO == VOne  && VOO == VTwo){
           var rt=parseFloat(Q) + parseFloat(1);
           $("#QTTY"+r).val(parseFloat(rt));
               $('#search').val('');
                document.getElementById('data').style.display="none";
           }
             
  $('.Data').hide();
var TaxRate = $("#RATE"+r).val();
   var TaxType = $("#TYPE"+r).val();
   var Qty = $("#QTTY"+r).val();
   var Price = $("#PRICE"+r).val();
   var Discount = $("#DISC"+r).val();
   var i = 0;
   var ii=0;       
   var iii=0;       

             var HighDisc = $("#HighDisc"+r).val();
       var DIS = $("#DIS").val();
        
       if(parseFloat(DIS) == 0){
          
           Discount=$("#DISC"+r).val();
       }else{
         
           var d= Discount / 100 ;
           var Multi= parseFloat(Qty) * parseFloat(Price) ;
          var dd= Multi * d;
           
        Discount=  dd; 
       }
  
        if(HighDisc != 0){
           
         
           if(parseFloat(Discount)  >  parseFloat(HighDisc)){
                     document.getElementById("Action").style.display = "none";    
                     document.getElementById("ActionAlert").style.display = "block";    
           }else{
                   document.getElementById("Action").style.display = "block";      
                   document.getElementById("ActionAlert").style.display = "none";      
               
           }
           
           
       }
       
             var BFG =  parseFloat(Qty) * parseFloat(Discount) ;
             $("#TDiscPro"+r).val(parseFloat(BFG));
  
        
       
       if(TaxType == 1){
           //Precent
          
  var BF =  parseFloat(Qty) *  (parseFloat(Price)  -  parseFloat(Discount));  
       
       $("#TBFTax"+r).val(parseFloat(BF));
           
       i =    parseFloat(TaxRate)  / 100 ;  
           
        ii=  parseFloat(BF) * parseFloat(i) ;
              
           $("#TTax"+r).val(parseFloat(ii));

       iii =  parseFloat(BF) + parseFloat(ii) ;
           
           $("#TOTT"+r).val(parseFloat(iii).toFixed(2));
           $("#TOTTNo"+r).val(parseFloat(iii).toFixed(2));
           
       }else if(TaxType == 2){
          //Number 
        var BF =  parseFloat(Qty) *  (parseFloat(Price)  -  parseFloat(Discount));  
         $("#TBFTax"+r).val(parseFloat(BF));
          
            i =    parseFloat(TaxRate)   ; 
           
           $("#TTax"+r).val(parseFloat(i));

       iii =  parseFloat(BF) + parseFloat(i) ;
           
           $("#TOTT"+r).val(parseFloat(iii).toFixed(2));
           $("#TOTTNo"+r).val(parseFloat(iii).toFixed(2));
           
           
       }
       
           
          play(); 
         }else{
             
             alert('لا يمكن اضافه هذا المنتج مره اخري');
             
         }
           
       }else{
        $("#data-dt").append(markup); 
           $('#search').val('');
         document.getElementById('data').style.display="none";   
           play();
       }
       
             
              
              
          }

       
       
       
        document.getElementById('data').style.display="none";         
    
      $.fn.rowCount = function() {
     return $('tr', $(this).find('tbody')).length;
   };
   
   var rowctr = $('#dt').rowCount();     
                
    var sumQ = 0;        
   $('.Qun').each(function(){
   sumQ += parseFloat($(this).val());
   });   
            
    var sumT = 0;        
   $('.Tot').each(function(){
   sumT += parseFloat($(this).val());
   });       
       
        var sumD = 0;        
   $('.Disc').each(function(){
   sumD += parseFloat($(this).val());
   }); 
       
       
           var sumBF = 0;        
   $('.TotalBFTax').each(function(){
   sumBF += parseFloat($(this).val());
   }); 
       
           var sumTax = 0;        
   $('.TotalTax').each(function(){
   sumTax += parseFloat($(this).val());
   }); 
       
                                  var prec = 0;        
   $('.DiscoPrecent').each(function(){
   prec += parseFloat($(this).val());
   }); 
   

   
              var sumTTD = 0;        
   $('.TDISCOOO').each(function(){
   sumTTD += parseFloat($(this).val());
   }); 
    
         var COPRI = 0;        
   $('.COSTPRICES').each(function(){
   COPRI += parseFloat($(this).val());
   }); 
       
              var COWeight = 0;        
   $('.W').each(function(){
   COWeight += parseFloat($(this).val());
   }); 
       
       $('#Total_Wight_Bill').val(parseFloat(COWeight));
       
    
  $('#ProfitPrecent').val(parseFloat(sumT) - parseFloat(COPRI));
      var nfd=((parseFloat(sumT) - parseFloat(COPRI)) * 100) / parseFloat(COPRI);
   $('#proPrecent').text(parseFloat(nfd).toFixed(2));
   $('#TotalCost').val(parseFloat(COPRI).toFixed(2));
   $('#ProNums').text(parseFloat(rowctr));
   $('#ProQty').text(parseFloat(sumQ).toFixed(2));
   $('#Total_QtyHide').val(parseFloat(sumQ).toFixed(2));
  $('#TotalPrice').text(parseFloat(sumT) + parseFloat(sumTTD) -  parseFloat(sumTax));

         $('#Total_DiscountTTShow').text(parseFloat(sumTTD).toFixed(2));
         $('#Total_TaxesShow').text(parseFloat(sumTax));
       
      
       
       
        $('#Product_Numbers').val(parseFloat(rowctr));
   $('#Product_NumbersHide').val(parseFloat(rowctr));
       
   $('#Total_Qty').val(parseFloat(sumQ));
       
     $('#Total_Price').val(parseFloat(sumT) + parseFloat(sumTTD) -  parseFloat(sumTax));
   $('#Total_PriceHide').val(parseFloat(sumT) + parseFloat(sumTTD) -  parseFloat(sumTax));
   $('#Total_PriceW').val(parseFloat(sumT));
       $('#Total_Bill').val(parseFloat(sumT));

           $('#Total_DiscountTT').val(parseFloat(sumTTD).toFixed(2));
   $('#Total_DiscountHideTT').val(parseFloat(sumTTD).toFixed(2));
    
       $('#Total_Discount').val(parseFloat(sumD).toFixed(2));
   $('#Total_DiscountHide').val(parseFloat(sumD).toFixed(2));
       
          $('#Total_Bf_Taxes').val(parseFloat(sumBF)+parseFloat(sumTTD));
   $('#Total_Bf_TaxesHide').val(parseFloat(sumBF)+parseFloat(sumTTD));
       
          $('#Total_Taxes').val(parseFloat(sumTax).toFixed(2));
   $('#Total_TaxesHide').val(parseFloat(sumTax).toFixed(2));
  var Pay =$('#Payment_Method').val();
        var Stat =$('#Status').val();
        var paid =$('#paid').val();
        var resdiual =$('#resdiual').val();
        var total =$('#Total_PriceHide').val();
        var totalDisc =$('#Total_DiscountHideTT').val();

          var totalTax =$('#Total_TaxesHide').val();

 
         var RR= (parseFloat(total) + parseFloat(totalTax) ) - (parseFloat(resdiual) + parseFloat(totalDisc));
             var RRR= parseFloat(total) - (parseFloat(resdiual) + parseFloat(totalDisc));
          $('#TAFterD').val(parseFloat(RRR).toFixed(2));        
         $('#paid').val(parseFloat(RR).toFixed(2));
       
         $('#presenter').val(parseFloat(RR).toFixed(2));
         $('#total').val(parseFloat(sumT).toFixed(2));
    
   
       
          var TaxRate = $("#RATE"+r).val();
   var TaxType = $("#TYPE"+r).val();
   var Qty = $("#QTTY"+r).val();
   var AVQty = $("#AVHide"+r).val();
   var Price = $("#PRICE"+r).val();
   var Discount = $("#DISC"+r).val();
       var CostPrice = $("#costPric"+r).val();   
          var LOWCOSTPRICE = $("#LOWCOSTPRICE").val();
                var DEFAULTCOSTPRICE = $("#DEFAULTCOSTPRICE").val();   
           var weight = $("#weightT"+r).val();
    var RATOO = $("#UnitRate"+r).val();
    var maxSales = $("#maxSa"+r).val();
    var LimitSalesQty = $("#LimitSalesQty").val();
    var LANG = $("#LANG").val();
       if(parseFloat(Qty) > parseFloat(AVQty)){
           
           
      document.getElementById("QTTY"+r).style.border="1px solid darkred";     
             $("#Enough"+r).val(1);
  
       }else{
           
           if(parseFloat(Qty) < 0){
                   document.getElementById("QTTY"+r).style.border="1px solid darkred";     
             $("#Enough"+r).val(1);  
           }else{
               

              if(parseFloat(LOWCOSTPRICE) == 0){
                     
                  if(DEFAULTCOSTPRICE == 2){
                     
                      
                   if(parseFloat(Price)*parseFloat(Qty) < parseFloat(CostPrice)){
                         
                     document.getElementById("QTTY"+r).style.border="1px solid darkred";     
             $("#Enough"+r).val(1);  

                         }else{
             
                                                 
                                   
   if(LimitSalesQty == 1){
       
       if(maxSales >= Qty){
         
                          document.getElementById("QTTY"+r).style.border="none"; 
             $("#Enough"+r).val(0);     
       
           
          }else{
 document.getElementById("QTTY"+r).style.border="1px solid darkred";     
             $("#Enough"+r).val(1);         
      if(LANG == 'ar' ){           
    alert('تجاوزت الحد المسموح  لبيع كمية هذا المنتج');     
      }else{
          
    alert('You have exceeded the selling limit for this product');            
      }
              
          }
       
   }else{
                          document.getElementById("QTTY"+r).style.border="none"; 
             $("#Enough"+r).val(0);       
       
   }
          
                       
                 
                 
                         }      
                      
                     }else{
                     
                      if(parseFloat(Price) < parseFloat(CostPrice)){
                         
                     document.getElementById("QTTY"+r).style.border="1px solid darkred";     
             $("#Enough"+r).val(1);  

                         }else{
             
                                                 
                                   
   if(LimitSalesQty == 1){
       
       if(maxSales >= Qty){
         
                          document.getElementById("QTTY"+r).style.border="none"; 
             $("#Enough"+r).val(0);     
       
           
          }else{
 document.getElementById("QTTY"+r).style.border="1px solid darkred";     
             $("#Enough"+r).val(1);         
      if(LANG == 'ar' ){           
    alert('تجاوزت الحد المسموح  لبيع كمية هذا المنتج');     
      }else{
          
    alert('You have exceeded the selling limit for this product');            
      }
              
          }
       
   }else{
                          document.getElementById("QTTY"+r).style.border="none"; 
             $("#Enough"+r).val(0);       
       
   }
          
                       
                 
                 
                         }
                      
              }
                  
                  
                      
                     }else{
                     
     
        if(LimitSalesQty == 1){
       
       if(maxSales >= Qty){
         
                          document.getElementById("QTTY"+r).style.border="none"; 
             $("#Enough"+r).val(0);     
       
           
          }else{
 document.getElementById("QTTY"+r).style.border="1px solid darkred";     
             $("#Enough"+r).val(1);         
      if(LANG == 'ar' ){           
    alert('تجاوزت الحد المسموح  لبيع كمية هذا المنتج');     
      }else{
          
    alert('You have exceeded the selling limit for this product');            
      }
              
          }
       
   }else{
                          document.getElementById("QTTY"+r).style.border="none"; 
             $("#Enough"+r).val(0);       
       
   }                 
                         
                         
                     }       
               
               
       }
       }

       var enough=0;
    $('input[name^="AllEnough"]').each(function() {
    
    
        enough +=$(this).val();
        
});

         
             if(parseFloat(enough) > 0){
            
               document.getElementById("Action").style.display = "none";  
   document.getElementById("QTYAlert").style.display = "block";     
        }else{
               document.getElementById("Action").style.display = "block";  
   document.getElementById("QTYAlert").style.display = "none";  
            
        }
       
                       var Total_PriceW =$('#Total_PriceW').val();

             if(enough == 0){
        
             if(Total_PriceW == 'NaN'){
                   document.getElementById("Action").style.display = "none";   
                    }else{
        document.getElementById("Action").style.display = "block";    
             }
             
       }else{
           
        document.getElementById("Action").style.display = "none";    
       } 
       
       
       
         var TWeight=parseFloat(Qty) * (parseFloat(weight) * parseFloat(RATOO)) ;

                $("#Total_Wight"+r).val(parseFloat(TWeight));
      
       
       var COWeight = 0;        
   $('.W').each(function(){
   COWeight += parseFloat($(this).val());
   }); 
       
      $('#Total_Wight_Bill').val(parseFloat(COWeight));
       

 
        $('#data-dt').on('click', '#DelAssem', function(e){
                $(this).closest('tr').remove(); 
            
   
      $.fn.rowCount = function() {
     return $('tr', $(this).find('tbody')).length;
   };
   
   var rowctr = $('#dt').rowCount();     
                
    var sumQ = 0;        
   $('.Qun').each(function(){
   sumQ += parseFloat($(this).val());
   });   
            
    var sumT = 0;        
   $('.Tot').each(function(){
   sumT += parseFloat($(this).val());
   });       
       
        var sumD = 0;        
   $('.Disc').each(function(){
   sumD += parseFloat($(this).val());
   }); 
       
       
           var sumBF = 0;        
   $('.TotalBFTax').each(function(){
   sumBF += parseFloat($(this).val());
   }); 
       
           var sumTax = 0;        
   $('.TotalTax').each(function(){
   sumTax += parseFloat($(this).val());
   }); 
       
        
                                  var prec = 0;        
   $('.DiscoPrecent').each(function(){
   prec += parseFloat($(this).val());
   });     
            
 
              var sumTTD = 0;        
   $('.TDISCOOO').each(function(){
   sumTTD += parseFloat($(this).val());
   }); 
    
             var COPRI = 0;        
   $('.COSTPRICES').each(function(){
   COPRI += parseFloat($(this).val());
   }); 
            
                   var COWeight = 0;        
   $('.W').each(function(){
   COWeight += parseFloat($(this).val());
   }); 
       
       $('#Total_Wight_Bill').val(parseFloat(COWeight));
   

  $('#ProfitPrecent').val(parseFloat(sumT) - parseFloat(COPRI));
       var nfd=((parseFloat(sumT) - parseFloat(COPRI)) * 100) / parseFloat(COPRI);
   $('#proPrecent').text(parseFloat(nfd).toFixed(2));
          $('#TotalCost').val(parseFloat(COPRI).toFixed(2));
 $('#ProNums').text(parseFloat(rowctr));
   $('#ProQty').text(parseFloat(sumQ).toFixed(2));
   $('#Total_QtyHide').val(parseFloat(sumQ).toFixed(2));
  $('#TotalPrice').text(parseFloat(sumT) + parseFloat(sumTTD) -  parseFloat(sumTax));

         $('#Total_DiscountTTShow').text(parseFloat(sumTTD).toFixed(2));
         $('#Total_TaxesShow').text(parseFloat(sumTax));
       
      
       
       
        $('#Product_Numbers').val(parseFloat(rowctr));
   $('#Product_NumbersHide').val(parseFloat(rowctr));
       
   $('#Total_Qty').val(parseFloat(sumQ));
       
     $('#Total_Price').val(parseFloat(sumT) + parseFloat(sumTTD) -  parseFloat(sumTax));
   $('#Total_PriceHide').val(parseFloat(sumT) + parseFloat(sumTTD) -  parseFloat(sumTax));
   $('#Total_PriceW').val(parseFloat(sumT));
       $('#Total_Bill').val(parseFloat(sumT));

           $('#Total_DiscountTT').val(parseFloat(sumTTD).toFixed(2));
   $('#Total_DiscountHideTT').val(parseFloat(sumTTD).toFixed(2));
    
       $('#Total_Discount').val(parseFloat(sumD).toFixed(2));
   $('#Total_DiscountHide').val(parseFloat(sumD).toFixed(2));
       
          $('#Total_Bf_Taxes').val(parseFloat(sumBF)+parseFloat(sumTTD));
   $('#Total_Bf_TaxesHide').val(parseFloat(sumBF)+parseFloat(sumTTD));
       
          $('#Total_Taxes').val(parseFloat(sumTax).toFixed(2));
   $('#Total_TaxesHide').val(parseFloat(sumTax).toFixed(2));
  var Pay =$('#Payment_Method').val();
        var Stat =$('#Status').val();
        var paid =$('#paid').val();
        var resdiual =$('#resdiual').val();
        var total =$('#Total_PriceHide').val();
        var totalDisc =$('#Total_DiscountHideTT').val();

          var totalTax =$('#Total_TaxesHide').val();

 
         var RR= (parseFloat(total) + parseFloat(totalTax) ) - (parseFloat(resdiual) + parseFloat(totalDisc));
             var RRR= parseFloat(total) - (parseFloat(resdiual) + parseFloat(totalDisc));
          $('#TAFterD').val(parseFloat(RRR).toFixed(2));        
         $('#paid').val(parseFloat(RR).toFixed(2));
       
         $('#presenter').val(parseFloat(RR).toFixed(2));
         $('#total').val(parseFloat(sumT).toFixed(2));

                    })  
       
       
     }    
    
     function FunMyzan(r,t,zz) { 

             var P_Ar_Name = $("#P_Ar_Name"+r).val();
             var P_En_Name= $("#P_En_Name"+r).val();
             var Product = $("#Product"+r).val();
             var UnitID = $("#UnitPurch"+r).val();
             var UnitName = $("#UnitPurchName"+r).val();
             var Qty = $("#Qty"+r).val();
             var AvQty = $("#AvQty"+r).val();
             var Barcode = $("#CodePurch"+r).val();
             var Price = $("#Price"+r).val();
             var Total = $("#Total"+r).val();
             var ExpDate = $("#ExpDate"+r).val();
             var PurchTax = $("#PurchTax"+r).val();
             var TotalTax = $("#Tax"+r).val();
             var Discount = $("#Discount"+r).val();
             var TotalBFTax = $("#TotalBFTax"+r).val();
             var StorePurch = $("#StorePurchName"+r).val();
             var StorePurchName = $("#StorePurchName"+r).val();
             var PurchTax = $("#PurchTax"+r).val();
             var VOne = $("#VOne"+r).val();
             var VTwo = $("#VTwo"+r).val();
             var V_Name = $("#V_Name"+r).val();
             var VV_Name = $("#VV_Name"+r).val();
             var TaxRate = $("#TaxRate"+r).val();
             var TaxType = $("#TaxType"+r).val();
             var Viro = '';
             var VViro = '';
               var priceSale =$("#priceSale").val();
               var discount =$("#discount").val();
               var serial =$("#serial"+r).val();
  var TDiscPro = $("#TDiscPro"+r).val();
    var CostPrice = $("#CostPrice"+r).val();
         
                             var weight = $("#weight"+r).val();
                var maxSales = $("#maxSales"+r).val();
                var RATOO = $("#UnitRato"+r).val();
                var LimitSalesQty = $("#LimitSalesQty").val();
            var DEFAULTCOSTPRICE = $("#DEFAULTCOSTPRICE").val();    
 
       var TWeight=parseFloat(Qty) * (parseFloat(weight) * parseFloat(RATOO)) ;
        
         
                if(DEFAULTCOSTPRICE == 2){
          
            $.ajax({
                             url: 'NewCostProductFilter',
                             type:"GET",
                            data:{
                              store:StorePurch,  
                              pro_code:Barcode, 
                              Product:Product,  
                              Qty:Qty,  
                              UnitID:UnitID  
                            },
                             dataType:"json",
                             beforeSend: function(){
                                 $('#loader').css("visibility", "visible");
                             },
   
                             success:function(data) {
                            
                                     
                                 $("#CostPrice"+r).val(data.total_cost);
                                 
                             },
                             complete: function(){
                                 $('#loader').css("visibility", "hidden");
                             }
                         });
           
          
          }
       
       
       
         
         
         Qty=parseFloat(zz);
         Barcode=parseFloat(t);
  
       if( V_Name != ''){
           
          Viro= '(' + V_Name +')';
       }
  
       if( VV_Name != ''){
           
         VViro= '(' + VV_Name +')'; 
       }


       if(parseFloat(priceSale) == 0){
         
           var PRIce = 'disabled';
           var PRIceTwo = '';
           
       }else{
           
           var PRIce = '';
                 var PRIceTwo = 'disabled';
       }
       
        if(parseFloat(discount) == 0){
             var Dicco = 'disabled';
             var DiccoTwo = '';
           
       }else{
           
           var Dicco = ''; 
           var DiccoTwo = 'disabled'; 
       }

         if(parseFloat(serial) == 1){
             var ser = 'disabled';
             var serTwo = '';

           
       }else{
           
           var ser = ''; 
           var serTwo = 'disabled'; 

       }

          document.getElementById("Row"+r).style.display = "none";
       
   var i = 0;
   var ii=0;       
   var iii=0;       

         var HighDisc = $("#HighDisc"+r).val();
       var DIS = $("#DIS").val();
        
       if(parseFloat(DIS) == 0){
          
           Discount=$("#Discount"+r).val();
       }else{
         
           var d= Discount / 100 ;
           var Multi= parseFloat(Qty) * parseFloat(Price) ;
          var dd= Multi * d;
           
        Discount=  dd; 
       }
             var BFG =  parseFloat(Qty) * parseFloat(Discount) ;
             $("#TDiscPro"+r).val(parseFloat(BFG));
  
       
       if(TaxType == 1){
           //Precent
       var BF =  parseFloat(Qty) *  (parseFloat(Price)  -  parseFloat(Discount));
       
           
           TotalBFTax = parseFloat(BF) ;

       i =    parseFloat(TaxRate)  / 100 ;  
           
        ii=  parseFloat(BF) * parseFloat(i) ;
              

           TotalTax=parseFloat(ii);

       iii =  parseFloat(BF) + parseFloat(ii) ;

      
           Total=parseFloat(iii);
           
       }else if(TaxType == 2){
          //Number 
    var BF =  parseFloat(Qty) *  (parseFloat(Price)  -  parseFloat(Discount));  
               TotalBFTax = parseFloat(BF) ;
          
            i =    parseFloat(TaxRate)   ; 
           
              TotalTax=parseFloat(i);

       iii =  parseFloat(BF) + parseFloat(i) ;
           
            Total=parseFloat(iii);
           
           
       }
       
  var DIS = $("#DIS").val();
  var RFF= parseFloat(Qty) * parseFloat(Price);
       var RFFResult= parseFloat(RFF) - parseFloat(Total);

         
              var ShowTax = $("#ShowTax").val();
                  var LANG = $("#LANG").val();
   if(LANG == 'ar' ){ 
          var Nemo = P_Ar_Name ;
          }else{
             var Nemo = P_En_Name ;   
          }     
       
         
               
           var TotCostNew=parseFloat(Qty) * parseFloat(CostPrice) ;

  
   
       if(parseFloat(ShowTax) == 1){
             var markup = "<tr><td><i id='DelAssem' class='fal fa-trash-alt'></i></td><td>" + Nemo + ""+ Viro +" "+ VViro +" (<b id='Coding"+r+"'>"+ Barcode +"</b>) <span style='color:red'>(<b id='AVVQ"+r+"'><button onclick='OtherQTY("+Product+","+Barcode+")' type='button' class='bt' data-toggle='modal' style='padding:0 !imporatnt' data-target='#Avilable'>"+ AvQty +"</button></b>)</span><button type='button'  class='btn btn-sm btn-block btn-outline-success waves-effect waves-themed'  data-toggle='modal' onclick='TaxPro("+Product+","+r+")' style='width: 10%;' data-target='#TAXXXX'><i class='fal fa-calculator'></i></button> </td><td><input type='hidden' id='un"+r+"' name='Unit[]' value='"+UnitID+"'><button type='button'  class='btn btn-sm btn-block btn-outline-success waves-effect waves-themed'  data-toggle='modal' onclick='UniPro("+Product+","+r+","+Barcode+","+StorePurch+")' data-target='#UnitTTT'><span id='TextUni"+r+"'>" + UnitName + "<span></button></td><td><input  type='number' "+ser+" step='any' onkeyup='PurchTotal("+r+")' onclick='PurchTotal("+r+")' id='QTTY"+r+"' name='Qty[]' class='form-control input-width Qun' value='"+parseFloat(Qty).toFixed(2)+"'><input "+serTwo+" type='hidden' name='Qty[]' value='"+parseFloat(Qty).toFixed(2)+"'></td><td><input type='number' step='any' "+PRIce+" class='form-control input-width' onkeyup='PurchTotal("+r+")' onclick='PurchTotal("+r+")' id='PRICE"+r+"' name='Price[]' value='"+Price+"'><input "+PRIceTwo+" type='hidden' name='Price[]' value='"+Price+"' id='PCL"+r+"' ></td><td style='width:50px'><input  onkeyup='PurchTotal("+r+")' onclick='PurchTotal("+r+")' type='number' step='any' class='form-control Disc input-width' "+Dicco+" name='Discount[]' id='DISC"+r+"' value='"+Discount+"'><input type='hidden' "+DiccoTwo+" name='Discount[]' value='"+Discount+"'></td><td style='width:130px'><input  type='hidden' name='Total[]' id='TOTT"+r+"' value='"+parseFloat(Total).toFixed(2)+"'><input class='form-control Tot total-input-width'  type='text' disabled id='TOTTNo"+r+"' value='"+parseFloat(Total).toFixed(2)+"'></td><input type='hidden' name='V_Name[]' value='"+Viro+"'><input type='hidden' name='VV_Name[]' value='"+VViro+"'><input id='PurchTaxx"+r+"' type='hidden' name='PurchTax[]' value='"+PurchTax+"'><input type='hidden' name='VOne[]' id='V"+r+"' value='"+VOne+"'><input id='VV"+r+"' type='hidden' name='VTwo[]' value='"+VTwo+"'><input type='hidden' id='PRO"+r+"' name='Product[]' value='"+Product+"'><input type='hidden' name='P_Ar_Name[]' value='"+P_Ar_Name+"'><input type='hidden' name='P_En_Name[]' value='"+P_En_Name+"'><input type='hidden' name='P_Code[]' id='CodingHide"+r+"' value='"+Barcode+"'><input id='AVHide"+r+"' type='hidden' name='AvQty[]' value='"+AvQty+"'><input class='TotalBFTax' id='TBFTax"+r+"' type='hidden' name='TotalBFTax[]' value='"+TotalBFTax+"'><input class='TotalTax' type='hidden' name='TotalTax[]' id='TTax"+r+"' value='"+TotalTax+"'><input id='STORETABLE"+r+"'  type='hidden' name='StorePurch[]' value='"+StorePurch+"'><input type='hidden' name='Exp_Date[]' value='"+ExpDate+"'><input type='hidden' id='RATE"+r+"'  value='"+TaxRate+"'><input type='hidden' id='TYPE"+r+"'  value='"+TaxType+"'> <input type='hidden' id='HighDisc"+r+"'  value='"+HighDisc+"'><input type='hidden' class='DiscoPrecent' id='disssccoount"+r+"' value='"+RFFResult+"'><input type='hidden' class='TDISCOOO' id='TDiscProEdit"+r+"' name='TDiscPro[]' value='"+TDiscPro+"'><input type='hidden' id='costPric"+r+"'  name='CostPrice[]' value='"+CostPrice+"'><input type='hidden' id='weightT"+r+"'   name='weight[]' value='"+weight+"'><input type='hidden' id='UnitRate"+r+"'   name='UnitRate[]' value='"+RATOO+"'><input type='hidden' id='Total_Wight"+r+"' class='W'  name='Total_Wight[]' value='"+TWeight+"'><input type='hidden' id='maxSa"+r+"' value='"+maxSales+"'><input type='hidden' class='COSTPRICES' id='TotCostNew"+r+"' name='TotCostNew[]' value='"+TotCostNew+"'></tr>";
       }else{
           
                   var markup = "<tr><td><i id='DelAssem' class='fal fa-trash-alt'></i></td><td>" + Nemo + ""+ Viro +" "+ VViro +" (<b id='Coding"+r+"'>"+ Barcode +"</b>) <span style='color:red'>(<b id='AVVQ"+r+"'><button onclick='OtherQTY("+Product+","+Barcode+")' type='button' class='bt' data-toggle='modal' style='padding:0 !imporatnt' data-target='#Avilable'>"+ AvQty +"</button></b>)</span> </td><td><input type='hidden' id='un"+r+"' name='Unit[]' value='"+UnitID+"'><button type='button'  class='btn btn-sm btn-block btn-outline-success waves-effect waves-themed'  data-toggle='modal' onclick='UniPro("+Product+","+r+","+Barcode+","+StorePurch+")' data-target='#UnitTTT'><span id='TextUni"+r+"'>" + UnitName + "<span></button></td><td><input  type='number' "+ser+" step='any' onkeyup='PurchTotal("+r+")' onclick='PurchTotal("+r+")' id='QTTY"+r+"' name='Qty[]' class='form-control input-width Qun' value='"+parseFloat(Qty).toFixed(2)+"'><input "+serTwo+" type='hidden' name='Qty[]' value='"+parseFloat(Qty).toFixed(2)+"'></td><td><input type='number' step='any' "+PRIce+" class='form-control input-width' onkeyup='PurchTotal("+r+")' onclick='PurchTotal("+r+")' id='PRICE"+r+"' name='Price[]' value='"+Price+"'><input "+PRIceTwo+" type='hidden' name='Price[]' value='"+Price+"' id='PCL"+r+"' ></td><td style='width:50px'><input  onkeyup='PurchTotal("+r+")' onclick='PurchTotal("+r+")' type='number' step='any' class='form-control Disc input-width' "+Dicco+" name='Discount[]' id='DISC"+r+"' value='"+Discount+"'><input type='hidden' "+DiccoTwo+" name='Discount[]' value='"+Discount+"'></td><td style='width:130px'><input  type='hidden' name='Total[]' id='TOTT"+r+"' value='"+parseFloat(Total).toFixed(2)+"'><input class='form-control Tot total-input-width'  type='text' disabled id='TOTTNo"+r+"' value='"+parseFloat(Total).toFixed(2)+"'></td><input type='hidden' name='V_Name[]' value='"+Viro+"'><input type='hidden' name='VV_Name[]' value='"+VViro+"'><input id='PurchTaxx"+r+"' type='hidden' name='PurchTax[]' value='"+PurchTax+"'><input type='hidden' name='VOne[]' id='V"+r+"' value='"+VOne+"'><input id='VV"+r+"' type='hidden' name='VTwo[]' value='"+VTwo+"'><input type='hidden' id='PRO"+r+"' name='Product[]' value='"+Product+"'><input type='hidden' name='P_Ar_Name[]' value='"+P_Ar_Name+"'><input type='hidden' name='P_En_Name[]' value='"+P_En_Name+"'><input type='hidden' name='P_Code[]' id='CodingHide"+r+"' value='"+Barcode+"'><input id='AVHide"+r+"' type='hidden' name='AvQty[]' value='"+AvQty+"'><input class='TotalBFTax' id='TBFTax"+r+"' type='hidden' name='TotalBFTax[]' value='"+TotalBFTax+"'><input class='TotalTax' type='hidden' name='TotalTax[]' id='TTax"+r+"' value='"+TotalTax+"'><input  type='hidden' id='STORETABLE"+r+"' name='StorePurch[]' value='"+StorePurch+"'><input type='hidden' name='Exp_Date[]' value='"+ExpDate+"'><input type='hidden' id='RATE"+r+"'  value='"+TaxRate+"'><input type='hidden' id='TYPE"+r+"'  value='"+TaxType+"'> <input type='hidden' id='HighDisc"+r+"'  value='"+HighDisc+"'><input type='hidden' class='DiscoPrecent' id='disssccoount"+r+"' value='"+RFFResult+"'><input type='hidden' class='TDISCOOO' id='TDiscProEdit"+r+"' name='TDiscPro[]' value='"+TDiscPro+"'><input type='hidden'   name='CostPrice[]' id='costPric"+r+"' value='"+CostPrice+"'><input type='hidden' id='weightT"+r+"'   name='weight[]' value='"+weight+"'><input type='hidden' id='UnitRate"+r+"'   name='UnitRate[]' value='"+RATOO+"'><input type='hidden' id='Total_Wight"+r+"' class='W'  name='Total_Wight[]' value='"+TWeight+"'><input type='hidden' id='maxSa"+r+"' value='"+maxSales+"'><input type='hidden' class='COSTPRICES' id='TotCostNew"+r+"' name='TotCostNew[]' value='"+TotCostNew+"'></tr>";     
           
           
       }

    var P = $("#PRO"+r).val();
     var Q = $("#QTTY"+r).val();
     var VO = $("#V"+r).val();
        var VOO = $("#VV"+r).val();
        var PRICE = $("#PRICE"+r).val();
        var DISC = $("#DISC"+r).val();
        var RATE = $("#RATE"+r).val();
        var TYPE = $("#TYPE"+r).val();


       
       
          if(LimitSalesQty == 1){
       
       if(maxSales >= Qty){
         
   
          
       if(Product == P){

         if(parseFloat(serial) == 0){   
           
           if(VO == VOne  && VOO == VTwo){
           var rt=parseFloat(Q) + parseFloat(1);
           $("#QTTY"+r).val(parseFloat(rt));
               $('#search').val('');
                document.getElementById('data').style.display="none";
           }
             
  $('.Data').hide();
var TaxRate = $("#RATE"+r).val();
   var TaxType = $("#TYPE"+r).val();
   var Qty = $("#QTTY"+r).val();
   var Price = $("#PRICE"+r).val();
   var Discount = $("#DISC"+r).val();
   var i = 0;
   var ii=0;       
   var iii=0;       

             var HighDisc = $("#HighDisc"+r).val();
       var DIS = $("#DIS").val();
        
       if(parseFloat(DIS) == 0){
          
           Discount=$("#DISC"+r).val();
       }else{
         
           var d= Discount / 100 ;
           var Multi= parseFloat(Qty) * parseFloat(Price) ;
          var dd= Multi * d;
           
        Discount=  dd; 
       }
  
        if(HighDisc != 0){
           
         
           if(parseFloat(Discount)  >  parseFloat(HighDisc)){
                     document.getElementById("Action").style.display = "none";    
                     document.getElementById("ActionAlert").style.display = "block";    
           }else{
                   document.getElementById("Action").style.display = "block";      
                   document.getElementById("ActionAlert").style.display = "none";      
               
           }
           
           
       }
       
             var BFG =  parseFloat(Qty) * parseFloat(Discount) ;
             $("#TDiscPro"+r).val(parseFloat(BFG));
  
        
       
       if(TaxType == 1){
           //Precent
          
  var BF =  parseFloat(Qty) *  (parseFloat(Price)  -  parseFloat(Discount));  
       
       $("#TBFTax"+r).val(parseFloat(BF));
           
       i =    parseFloat(TaxRate)  / 100 ;  
           
        ii=  parseFloat(BF) * parseFloat(i) ;
              
           $("#TTax"+r).val(parseFloat(ii));

       iii =  parseFloat(BF) + parseFloat(ii) ;
           
           $("#TOTT"+r).val(parseFloat(iii).toFixed(2));
           $("#TOTTNo"+r).val(parseFloat(iii).toFixed(2));
           
       }else if(TaxType == 2){
          //Number 
        var BF =  parseFloat(Qty) *  (parseFloat(Price)  -  parseFloat(Discount));  
         $("#TBFTax"+r).val(parseFloat(BF));
          
            i =    parseFloat(TaxRate)   ; 
           
           $("#TTax"+r).val(parseFloat(i));

       iii =  parseFloat(BF) + parseFloat(i) ;
           
           $("#TOTT"+r).val(parseFloat(iii).toFixed(2));
           $("#TOTTNo"+r).val(parseFloat(iii).toFixed(2));
           
           
       }
       
           
          play(); 
         }else{
             
             alert('لا يمكن اضافه هذا المنتج مره اخري');
             
         }
           
       }else{
        $("#data-dt").append(markup); 
           $('#search').val('');
         document.getElementById('data').style.display="none";   
           play();
       }
       
               
       
           
          }else{
              
      if(LANG == 'ar' ){           
    alert('تجاوزت الحد المسموح  لبيع كمية هذا المنتج');     
      }else{
          
    alert('You have exceeded the selling limit for this product');            
      }
              
          }
       
          }else{
              
              
               
       if(Product == P){

         if(parseFloat(serial) == 0){   
           
           if(VO == VOne  && VOO == VTwo){
           var rt=parseFloat(Q) + parseFloat(1);
           $("#QTTY"+r).val(parseFloat(rt));
               $('#search').val('');
                document.getElementById('data').style.display="none";
           }
             
  $('.Data').hide();
var TaxRate = $("#RATE"+r).val();
   var TaxType = $("#TYPE"+r).val();
   var Qty = $("#QTTY"+r).val();
   var Price = $("#PRICE"+r).val();
   var Discount = $("#DISC"+r).val();
   var i = 0;
   var ii=0;       
   var iii=0;       

             var HighDisc = $("#HighDisc"+r).val();
       var DIS = $("#DIS").val();
        
       if(parseFloat(DIS) == 0){
          
           Discount=$("#DISC"+r).val();
       }else{
         
           var d= Discount / 100 ;
           var Multi= parseFloat(Qty) * parseFloat(Price) ;
          var dd= Multi * d;
           
        Discount=  dd; 
       }
  
        if(HighDisc != 0){
           
         
           if(parseFloat(Discount)  >  parseFloat(HighDisc)){
                     document.getElementById("Action").style.display = "none";    
                     document.getElementById("ActionAlert").style.display = "block";    
           }else{
                   document.getElementById("Action").style.display = "block";      
                   document.getElementById("ActionAlert").style.display = "none";      
               
           }
           
           
       }
       
             var BFG =  parseFloat(Qty) * parseFloat(Discount) ;
             $("#TDiscPro"+r).val(parseFloat(BFG));
  
        
       
       if(TaxType == 1){
           //Precent
          
  var BF =  parseFloat(Qty) *  (parseFloat(Price)  -  parseFloat(Discount));  
       
       $("#TBFTax"+r).val(parseFloat(BF));
           
       i =    parseFloat(TaxRate)  / 100 ;  
           
        ii=  parseFloat(BF) * parseFloat(i) ;
              
           $("#TTax"+r).val(parseFloat(ii));

       iii =  parseFloat(BF) + parseFloat(ii) ;
           
           $("#TOTT"+r).val(parseFloat(iii).toFixed(2));
           $("#TOTTNo"+r).val(parseFloat(iii).toFixed(2));
           
       }else if(TaxType == 2){
          //Number 
        var BF =  parseFloat(Qty) *  (parseFloat(Price)  -  parseFloat(Discount));  
         $("#TBFTax"+r).val(parseFloat(BF));
          
            i =    parseFloat(TaxRate)   ; 
           
           $("#TTax"+r).val(parseFloat(i));

       iii =  parseFloat(BF) + parseFloat(i) ;
           
           $("#TOTT"+r).val(parseFloat(iii).toFixed(2));
           $("#TOTTNo"+r).val(parseFloat(iii).toFixed(2));
           
           
       }
       
           
          play(); 
         }else{
             
             alert('لا يمكن اضافه هذا المنتج مره اخري');
             
         }
           
       }else{
        $("#data-dt").append(markup); 
           $('#search').val('');
         document.getElementById('data').style.display="none";   
           play();
       }
       
             
              
              
          }

       
       
         
         
       
        document.getElementById('data').style.display="none";         
    
      $.fn.rowCount = function() {
     return $('tr', $(this).find('tbody')).length;
   };
   
   var rowctr = $('#dt').rowCount();     
                
    var sumQ = 0;        
   $('.Qun').each(function(){
   sumQ += parseFloat($(this).val());
   });   
            
    var sumT = 0;        
   $('.Tot').each(function(){
   sumT += parseFloat($(this).val());
   });       
       
        var sumD = 0;        
   $('.Disc').each(function(){
   sumD += parseFloat($(this).val());
   }); 
       
       
           var sumBF = 0;        
   $('.TotalBFTax').each(function(){
   sumBF += parseFloat($(this).val());
   }); 
       
           var sumTax = 0;        
   $('.TotalTax').each(function(){
   sumTax += parseFloat($(this).val());
   }); 
         
                                          var prec = 0;        
   $('.DiscoPrecent').each(function(){
   prec += parseFloat($(this).val());
   });  

  
              var sumTTD = 0;        
   $('.TDISCOOO').each(function(){
   sumTTD += parseFloat($(this).val());
   }); 
    
        var COPRI = 0;        
   $('.COSTPRICES').each(function(){
   COPRI += parseFloat($(this).val());
   }); 
         
                var COWeight = 0;        
   $('.W').each(function(){
   COWeight += parseFloat($(this).val());
   }); 
       
       $('#Total_Wight_Bill').val(parseFloat(COWeight));
         
     


  $('#ProfitPrecent').val(parseFloat(sumT) - parseFloat(COPRI));
      var nfd=((parseFloat(sumT) - parseFloat(COPRI)) * 100) / parseFloat(COPRI);
   $('#proPrecent').text(parseFloat(nfd).toFixed(2));
  $('#ProNums').text(parseFloat(rowctr));
   $('#ProQty').text(parseFloat(sumQ).toFixed(2));
   $('#Total_QtyHide').val(parseFloat(sumQ).toFixed(2));
  $('#TotalPrice').text(parseFloat(sumT) + parseFloat(sumTTD) -  parseFloat(sumTax));

         $('#Total_DiscountTTShow').text(parseFloat(sumTTD).toFixed(2));
         $('#Total_TaxesShow').text(parseFloat(sumTax));
          $('#TotalCost').val(parseFloat(COPRI).toFixed(2));
      
       
       
        $('#Product_Numbers').val(parseFloat(rowctr));
   $('#Product_NumbersHide').val(parseFloat(rowctr));
       
   $('#Total_Qty').val(parseFloat(sumQ));
       
     $('#Total_Price').val(parseFloat(sumT) + parseFloat(sumTTD) -  parseFloat(sumTax));
   $('#Total_PriceHide').val(parseFloat(sumT) + parseFloat(sumTTD) -  parseFloat(sumTax));
   $('#Total_PriceW').val(parseFloat(sumT));
       $('#Total_Bill').val(parseFloat(sumT));

           $('#Total_DiscountTT').val(parseFloat(sumTTD).toFixed(2));
   $('#Total_DiscountHideTT').val(parseFloat(sumTTD).toFixed(2));
    
       $('#Total_Discount').val(parseFloat(sumD).toFixed(2));
   $('#Total_DiscountHide').val(parseFloat(sumD).toFixed(2));
       
          $('#Total_Bf_Taxes').val(parseFloat(sumBF)+parseFloat(sumTTD));
   $('#Total_Bf_TaxesHide').val(parseFloat(sumBF)+parseFloat(sumTTD));
       
          $('#Total_Taxes').val(parseFloat(sumTax).toFixed(2));
   $('#Total_TaxesHide').val(parseFloat(sumTax).toFixed(2));
  var Pay =$('#Payment_Method').val();
        var Stat =$('#Status').val();
        var paid =$('#paid').val();
        var resdiual =$('#resdiual').val();
        var total =$('#Total_PriceHide').val();
        var totalDisc =$('#Total_DiscountHideTT').val();

          var totalTax =$('#Total_TaxesHide').val();

 
         var RR= (parseFloat(total) + parseFloat(totalTax) ) - (parseFloat(resdiual) + parseFloat(totalDisc));
             var RRR= parseFloat(total) - (parseFloat(resdiual) + parseFloat(totalDisc));
          $('#TAFterD').val(parseFloat(RRR).toFixed(2));        
         $('#paid').val(parseFloat(RR).toFixed(2));
       
         $('#presenter').val(parseFloat(RR).toFixed(2));
         $('#total').val(parseFloat(sumT).toFixed(2));

            var TaxRate = $("#RATE"+r).val();
   var TaxType = $("#TYPE"+r).val();
   var Qty = $("#QTTY"+r).val();
   var AVQty = $("#AVHide"+r).val();
   var Price = $("#PRICE"+r).val();
   var Discount = $("#DISC"+r).val();
       var CostPrice = $("#costPric"+r).val();   
          var LOWCOSTPRICE = $("#LOWCOSTPRICE").val();
       
           var weight = $("#weightT"+r).val();
    var RATOO = $("#UnitRate"+r).val();
    var maxSales = $("#maxSa"+r).val();
    var LimitSalesQty = $("#LimitSalesQty").val();
    var LANG = $("#LANG").val();
       if(parseFloat(Qty) > parseFloat(AVQty)){
           
           
      document.getElementById("QTTY"+r).style.border="1px solid darkred";     
             $("#Enough"+r).val(1);
  
       }else{
           
           if(parseFloat(Qty) < 0){
                   document.getElementById("QTTY"+r).style.border="1px solid darkred";     
             $("#Enough"+r).val(1);  
           }else{
               

              if(parseFloat(LOWCOSTPRICE) == 0){
                     
                     if(parseFloat(DEFAULTCOSTPRICE) == 2){
                     
                          if(parseFloat(Price)*parseFloat(Qty) < parseFloat(CostPrice)){
                         
                     document.getElementById("QTTY"+r).style.border="1px solid darkred";     
             $("#Enough"+r).val(1);  

                         }else{
             
                                                 
                                   
   if(LimitSalesQty == 1){
       
       if(maxSales >= Qty){
         
                          document.getElementById("QTTY"+r).style.border="none"; 
             $("#Enough"+r).val(0);     
       
           
          }else{
 document.getElementById("QTTY"+r).style.border="1px solid darkred";     
             $("#Enough"+r).val(1);         
      if(LANG == 'ar' ){           
    alert('تجاوزت الحد المسموح  لبيع كمية هذا المنتج');     
      }else{
          
    alert('You have exceeded the selling limit for this product');            
      }
              
          }
       
   }else{
                          document.getElementById("QTTY"+r).style.border="none"; 
             $("#Enough"+r).val(0);       
       
   }
          
                       
                 
                 
                         }
                         
                         
                     }else{
                      if(parseFloat(Price) < parseFloat(CostPrice)){
                         
                     document.getElementById("QTTY"+r).style.border="1px solid darkred";     
             $("#Enough"+r).val(1);  

                         }else{
             
                                                 
                                   
   if(LimitSalesQty == 1){
       
       if(maxSales >= Qty){
         
                          document.getElementById("QTTY"+r).style.border="none"; 
             $("#Enough"+r).val(0);     
       
           
          }else{
 document.getElementById("QTTY"+r).style.border="1px solid darkred";     
             $("#Enough"+r).val(1);         
      if(LANG == 'ar' ){           
    alert('تجاوزت الحد المسموح  لبيع كمية هذا المنتج');     
      }else{
          
    alert('You have exceeded the selling limit for this product');            
      }
              
          }
       
   }else{
                          document.getElementById("QTTY"+r).style.border="none"; 
             $("#Enough"+r).val(0);       
       
   }
          
                       
                 
                 
                         }
                     }
                      
                     }else{
                     
     
        if(LimitSalesQty == 1){
       
       if(maxSales >= Qty){
         
                          document.getElementById("QTTY"+r).style.border="none"; 
             $("#Enough"+r).val(0);     
       
           
          }else{
 document.getElementById("QTTY"+r).style.border="1px solid darkred";     
             $("#Enough"+r).val(1);         
      if(LANG == 'ar' ){           
    alert('تجاوزت الحد المسموح  لبيع كمية هذا المنتج');     
      }else{
          
    alert('You have exceeded the selling limit for this product');            
      }
              
          }
       
   }else{
                          document.getElementById("QTTY"+r).style.border="none"; 
             $("#Enough"+r).val(0);       
       
   }                 
                         
                         
                     }       
               
               
       }
       }

       var enough=0;
    $('input[name^="AllEnough"]').each(function() {
    
    
        enough +=$(this).val();
        
});

         
             if(parseFloat(enough) > 0){
            
               document.getElementById("Action").style.display = "none";  
   document.getElementById("QTYAlert").style.display = "block";     
        }else{
               document.getElementById("Action").style.display = "block";  
   document.getElementById("QTYAlert").style.display = "none";  
            
        }
       
                       var Total_PriceW =$('#Total_PriceW').val();

             if(enough == 0){
        
             if(Total_PriceW == 'NaN'){
                   document.getElementById("Action").style.display = "none";   
                    }else{
        document.getElementById("Action").style.display = "block";    
             }
             
       }else{
           
        document.getElementById("Action").style.display = "none";    
       } 
       
         
         
                  var TWeight=parseFloat(Qty) * (parseFloat(weight) * parseFloat(RATOO)) ;

                $("#Total_Wight"+r).val(parseFloat(TWeight));
      
       
       var COWeight = 0;        
   $('.W').each(function(){
   COWeight += parseFloat($(this).val());
   }); 
       
      $('#Total_Wight_Bill').val(parseFloat(COWeight));
         
         
         
 
        $('#data-dt').on('click', '#DelAssem', function(e){
                $(this).closest('tr').remove(); 
            
   
      $.fn.rowCount = function() {
     return $('tr', $(this).find('tbody')).length;
   };
   
   var rowctr = $('#dt').rowCount();     
                
    var sumQ = 0;        
   $('.Qun').each(function(){
   sumQ += parseFloat($(this).val());
   });   
            
    var sumT = 0;        
   $('.Tot').each(function(){
   sumT += parseFloat($(this).val());
   });       
       
        var sumD = 0;        
   $('.Disc').each(function(){
   sumD += parseFloat($(this).val());
   }); 
       
       
           var sumBF = 0;        
   $('.TotalBFTax').each(function(){
   sumBF += parseFloat($(this).val());
   }); 
       
           var sumTax = 0;        
   $('.TotalTax').each(function(){
   sumTax += parseFloat($(this).val());
   }); 
            
            var prec = 0;        
   $('.DiscoPrecent').each(function(){
   prec += parseFloat($(this).val());
   }); 
       
  
              var sumTTD = 0;        
   $('.TDISCOOO').each(function(){
   sumTTD += parseFloat($(this).val());
   }); 
    
     var COPRI = 0;        
   $('.COSTPRICES').each(function(){
   COPRI += parseFloat($(this).val());
   }); 
            
                   var COWeight = 0;        
   $('.W').each(function(){
   COWeight += parseFloat($(this).val());
   }); 
       
       $('#Total_Wight_Bill').val(parseFloat(COWeight));
            
   


  $('#ProfitPrecent').val(parseFloat(sumT) - parseFloat(COPRI));
      var nfd=((parseFloat(sumT) - parseFloat(COPRI)) * 100) / parseFloat(COPRI);
   $('#proPrecent').text(parseFloat(nfd).toFixed(2));   
 $('#ProNums').text(parseFloat(rowctr));
   $('#ProQty').text(parseFloat(sumQ).toFixed(2));
   $('#Total_QtyHide').val(parseFloat(sumQ).toFixed(2));
  $('#TotalPrice').text(parseFloat(sumT) + parseFloat(sumTTD) -  parseFloat(sumTax));

         $('#Total_DiscountTTShow').text(parseFloat(sumTTD).toFixed(2));
         $('#Total_TaxesShow').text(parseFloat(sumTax));
       
         $('#TotalCost').val(parseFloat(COPRI).toFixed(2));
       
       
        $('#Product_Numbers').val(parseFloat(rowctr));
   $('#Product_NumbersHide').val(parseFloat(rowctr));
       
   $('#Total_Qty').val(parseFloat(sumQ));
       
     $('#Total_Price').val(parseFloat(sumT) + parseFloat(sumTTD) -  parseFloat(sumTax));
   $('#Total_PriceHide').val(parseFloat(sumT) + parseFloat(sumTTD) -  parseFloat(sumTax));
   $('#Total_PriceW').val(parseFloat(sumT));
       $('#Total_Bill').val(parseFloat(sumT));

           $('#Total_DiscountTT').val(parseFloat(sumTTD).toFixed(2));
   $('#Total_DiscountHideTT').val(parseFloat(sumTTD).toFixed(2));
    
       $('#Total_Discount').val(parseFloat(sumD).toFixed(2));
   $('#Total_DiscountHide').val(parseFloat(sumD).toFixed(2));
       
          $('#Total_Bf_Taxes').val(parseFloat(sumBF)+parseFloat(sumTTD));
   $('#Total_Bf_TaxesHide').val(parseFloat(sumBF)+parseFloat(sumTTD));
       
          $('#Total_Taxes').val(parseFloat(sumTax).toFixed(2));
   $('#Total_TaxesHide').val(parseFloat(sumTax).toFixed(2));
  var Pay =$('#Payment_Method').val();
        var Stat =$('#Status').val();
        var paid =$('#paid').val();
        var resdiual =$('#resdiual').val();
        var total =$('#Total_PriceHide').val();
        var totalDisc =$('#Total_DiscountHideTT').val();

          var totalTax =$('#Total_TaxesHide').val();

 
         var RR= (parseFloat(total) + parseFloat(totalTax) ) - (parseFloat(resdiual) + parseFloat(totalDisc));
             var RRR= parseFloat(total) - (parseFloat(resdiual) + parseFloat(totalDisc));
          $('#TAFterD').val(parseFloat(RRR).toFixed(2));        
         $('#paid').val(parseFloat(RR).toFixed(2));
       
         $('#presenter').val(parseFloat(RR).toFixed(2));
         $('#total').val(parseFloat(sumT).toFixed(2));

       
   
                    })  
       
       
     }    
    
</script> 
      
<!-- Total Products -->
<script>
   function PurchTotal(r) { 
   var TaxRate = $("#RATE"+r).val();
   var TaxType = $("#TYPE"+r).val();
   var Qty = $("#QTTY"+r).val();
   var AVQty = $("#AVHide"+r).val();
   var Price = $("#PRICE"+r).val();
   var Discount = $("#DISC"+r).val();
       var CostPrice = $("#costPric"+r).val();   
       var StorePurch = $("#STORETABLE"+r).val();   
       var Barcode = $("#CodingHide"+r).val();   
       var Product = $("#PRO"+r).val();   
       var UnitID = $("#un"+r).val();   
       

          var LOWCOSTPRICE = $("#LOWCOSTPRICE").val();
       
           var weight = $("#weightT"+r).val();
    var RATOO = $("#UnitRate"+r).val();
    var maxSales = $("#maxSa"+r).val();
    var LimitSalesQty = $("#LimitSalesQty").val();
    var LANG = $("#LANG").val();
          var DEFAULTCOSTPRICE = $("#DEFAULTCOSTPRICE").val();    

   var i = 0;
   var ii=0;       
   var iii=0;       

       
             var TWeight=parseFloat(Qty) * (parseFloat(weight) * parseFloat(RATOO)) ;

       
       
       
              if(DEFAULTCOSTPRICE == 2){
          
            $.ajax({
                             url: 'NewCostProductFilter',
                             type:"GET",
                            data:{
                              store:StorePurch,  
                              pro_code:Barcode, 
                              Product:Product,  
                              Qty:Qty,  
                              UnitID:UnitID  
                            },
                             dataType:"json",
                             beforeSend: function(){
                                 $('#loader').css("visibility", "visible");
                             },
   
                             success:function(data) {
                            
                                     
                                 $("#costPric"+r).val(data.total_cost);
                                 
                             },
                             complete: function(){
                                 $('#loader').css("visibility", "hidden");
                             }
                         });
           
          
          }
       
       
       
       
       
       
                $("#Total_Wight"+r).val(parseFloat(TWeight));
     
         
       
         var HighDisc = $("#HighDisc"+r).val();
       var DIS = $("#DIS").val();
        
       if(parseFloat(DIS) == 0){
          
           Discount=$("#DISC"+r).val();
       }else{
         
           var d= Discount / 100 ;
           var Multi= parseFloat(Qty) * parseFloat(Price) ;
          var dd= Multi * d;
           
        Discount=  dd; 
       }
  
           var BFG =  parseFloat(Qty) * parseFloat(Discount) ;
             $("#TDiscProEdit"+r).val(parseFloat(BFG));
       
       if(TaxType == 1){
           //Precent
          
      var BF =  parseFloat(Qty) *  (parseFloat(Price)  -  parseFloat(Discount));  
       
       $("#TBFTax"+r).val(parseFloat(BF));
           
       i =    parseFloat(TaxRate)  / 100 ;  
           
        ii=  parseFloat(BF) * parseFloat(i) ;
              
           $("#TTax"+r).val(parseFloat(ii));

       iii =  parseFloat(BF) + parseFloat(ii) ;
           
           $("#TOTT"+r).val(parseFloat(iii).toFixed(2));
           $("#TOTTNo"+r).val(parseFloat(iii).toFixed(2));
           
       }else if(TaxType == 2){
          //Number 
         var BF =  parseFloat(Qty) *  (parseFloat(Price)  -  parseFloat(Discount));  
         $("#TBFTax"+r).val(parseFloat(BF));
          
            i =    parseFloat(TaxRate)   ; 
           
           $("#TTax"+r).val(parseFloat(i));

       iii =  parseFloat(BF) + parseFloat(i) ;
           
           $("#TOTT"+r).val(parseFloat(iii).toFixed(2));
           $("#TOTTNo"+r).val(parseFloat(iii).toFixed(2));
           
           
       }
     
           var Total = $("#TOTT"+r).val();
       var RFF= parseFloat(Qty) * parseFloat(Price);
       var RFFResult= parseFloat(RFF) - parseFloat(Total);
         $("#disssccoount"+r).val(parseFloat(RFFResult));

       
       
           var TotCostNew=parseFloat(Qty) * parseFloat(CostPrice) ;
         
          $("#TotCostNew"+r).val(parseFloat(TotCostNew).toFixed(2));
         

       
       
     $.fn.rowCount = function() {
     return $('tr', $(this).find('tbody')).length;
   };
   
   var rowctr = $('#dt').rowCount();     
                
    var sumQ = 0;        
   $('.Qun').each(function(){
   sumQ += parseFloat($(this).val());
   });   
            
    var sumT = 0;        
   $('.Tot').each(function(){
   sumT += parseFloat($(this).val());
   });       
       
        var sumD = 0;        
   $('.Disc').each(function(){
   sumD += parseFloat($(this).val());
   }); 
       
       
           var sumBF = 0;        
   $('.TotalBFTax').each(function(){
   sumBF += parseFloat($(this).val());
   }); 
       
           var sumTax = 0;        
   $('.TotalTax').each(function(){
   sumTax += parseFloat($(this).val());
   }); 

                                      var prec = 0;        
   $('.DiscoPrecent').each(function(){
   prec += parseFloat($(this).val());
   });    
       
              var sumTTD = 0;        
   $('.TDISCOOO').each(function(){
   sumTTD += parseFloat($(this).val());
   }); 
    
        var COPRI = 0;        
   $('.COSTPRICES').each(function(){
   COPRI += parseFloat($(this).val());
   }); 
       
                     var COWeight = 0;        
   $('.W').each(function(){
   COWeight += parseFloat($(this).val());
   }); 
       
       $('#Total_Wight_Bill').val(parseFloat(COWeight));
       


  $('#ProfitPrecent').val(parseFloat(sumT) - parseFloat(COPRI));
      var nfd=((parseFloat(sumT) - parseFloat(COPRI)) * 100) / parseFloat(COPRI);
   $('#proPrecent').text(parseFloat(nfd).toFixed(2));

  $('#ProNums').text(parseFloat(rowctr));
   $('#ProQty').text(parseFloat(sumQ).toFixed(2));
   $('#Total_QtyHide').val(parseFloat(sumQ).toFixed(2));
  $('#TotalPrice').text(parseFloat(sumT) + parseFloat(sumTTD) -  parseFloat(sumTax));

         $('#Total_DiscountTTShow').text(parseFloat(sumTTD).toFixed(2));
         $('#Total_TaxesShow').text(parseFloat(sumTax));
       
         $('#TotalCost').val(parseFloat(COPRI).toFixed(2));
       
       
        $('#Product_Numbers').val(parseFloat(rowctr));
   $('#Product_NumbersHide').val(parseFloat(rowctr));
       
   $('#Total_Qty').val(parseFloat(sumQ));
       
     $('#Total_Price').val(parseFloat(sumT) + parseFloat(sumTTD) -  parseFloat(sumTax));
   $('#Total_PriceHide').val(parseFloat(sumT) + parseFloat(sumTTD) -  parseFloat(sumTax));
   $('#Total_PriceW').val(parseFloat(sumT));
       $('#Total_Bill').val(parseFloat(sumT));

           $('#Total_DiscountTT').val(parseFloat(sumTTD).toFixed(2));
   $('#Total_DiscountHideTT').val(parseFloat(sumTTD).toFixed(2));
    
       $('#Total_Discount').val(parseFloat(sumD).toFixed(2));
   $('#Total_DiscountHide').val(parseFloat(sumD).toFixed(2));
       
          $('#Total_Bf_Taxes').val(parseFloat(sumBF)+parseFloat(sumTTD));
   $('#Total_Bf_TaxesHide').val(parseFloat(sumBF)+parseFloat(sumTTD));
       
          $('#Total_Taxes').val(parseFloat(sumTax).toFixed(2));
   $('#Total_TaxesHide').val(parseFloat(sumTax).toFixed(2));
  var Pay =$('#Payment_Method').val();
        var Stat =$('#Status').val();
        var paid =$('#paid').val();
        var resdiual =$('#resdiual').val();
        var total =$('#Total_PriceHide').val();
        var totalDisc =$('#Total_DiscountHideTT').val();

          var totalTax =$('#Total_TaxesHide').val();

 
         var RR= (parseFloat(total) + parseFloat(totalTax) ) - (parseFloat(resdiual) + parseFloat(totalDisc));
             var RRR= parseFloat(total) - (parseFloat(resdiual) + parseFloat(totalDisc));
          $('#TAFterD').val(parseFloat(RRR).toFixed(2));        
         $('#paid').val(parseFloat(RR).toFixed(2));
       
         $('#presenter').val(parseFloat(RR).toFixed(2));
         $('#total').val(parseFloat(sumT).toFixed(2));
 
            if(HighDisc != 0){
           
         
           if(parseFloat(Discount)  >  parseFloat(HighDisc)){
                     document.getElementById("Action").style.display = "none";  
                   document.getElementById("ActionAlert").style.display = "block";  
           }else{
                   document.getElementById("Action").style.display = "block";   
                document.getElementById("ActionAlert").style.display = "none";   
               
           }
           
           
       }
  
       if(parseFloat(Qty) > parseFloat(AVQty)){
           
           
      document.getElementById("QTTY"+r).style.border="1px solid darkred";     
             $("#Enough"+r).val(1);
  
       }else{
           
           if(parseFloat(Qty) < 0){
                   document.getElementById("QTTY"+r).style.border="1px solid darkred";     
             $("#Enough"+r).val(1);  
           }else{
               

              if(parseFloat(LOWCOSTPRICE) == 0){
                     
                     
                  
                     if(DEFAULTCOSTPRICE == 2){
                  
                           if(parseFloat(Price)*parseFloat(Qty) < parseFloat(CostPrice)){
                         
                     document.getElementById("QTTY"+r).style.border="1px solid darkred";     
             $("#Enough"+r).val(1);  

                         }else{
             
                                                 
                                   
   if(LimitSalesQty == 1){
       
       if(maxSales >= Qty){
         
                          document.getElementById("QTTY"+r).style.border="none"; 
             $("#Enough"+r).val(0);     
       
           
          }else{
 document.getElementById("QTTY"+r).style.border="1px solid darkred";     
             $("#Enough"+r).val(1);         
      if(LANG == 'ar' ){           
    alert('تجاوزت الحد المسموح  لبيع كمية هذا المنتج');     
      }else{
          
    alert('You have exceeded the selling limit for this product');            
      }
              
          }
       
   }else{
                          document.getElementById("QTTY"+r).style.border="none"; 
             $("#Enough"+r).val(0);       
       
   }
          
                       
                 
                 
                         }
                         
                     }else{
                         
                         
                     
                      if(parseFloat(Price) < parseFloat(CostPrice)){
                         
                     document.getElementById("QTTY"+r).style.border="1px solid darkred";     
             $("#Enough"+r).val(1);  

                         }else{
             
                                                 
                                   
   if(LimitSalesQty == 1){
       
       if(maxSales >= Qty){
         
                          document.getElementById("QTTY"+r).style.border="none"; 
             $("#Enough"+r).val(0);     
       
           
          }else{
 document.getElementById("QTTY"+r).style.border="1px solid darkred";     
             $("#Enough"+r).val(1);         
      if(LANG == 'ar' ){           
    alert('تجاوزت الحد المسموح  لبيع كمية هذا المنتج');     
      }else{
          
    alert('You have exceeded the selling limit for this product');            
      }
              
          }
       
   }else{
                          document.getElementById("QTTY"+r).style.border="none"; 
             $("#Enough"+r).val(0);       
       
   }
          
                       
                 
                 
                         }
                      
                     }
                      
                     }else{
                     
     
        if(LimitSalesQty == 1){
       
       if(maxSales >= Qty){
         
                          document.getElementById("QTTY"+r).style.border="none"; 
             $("#Enough"+r).val(0);     
       
           
          }else{
 document.getElementById("QTTY"+r).style.border="1px solid darkred";     
             $("#Enough"+r).val(1);         
      if(LANG == 'ar' ){           
    alert('تجاوزت الحد المسموح  لبيع كمية هذا المنتج');     
      }else{
          
    alert('You have exceeded the selling limit for this product');            
      }
              
          }
       
   }else{
                          document.getElementById("QTTY"+r).style.border="none"; 
             $("#Enough"+r).val(0);       
       
   }                 
                         
                         
                     }       
               
               
       }
       }

       var enough=0;
    $('input[name^="AllEnough"]').each(function() {
    
    
        enough +=$(this).val();
        
});

         
             if(parseFloat(enough) > 0){
            
               document.getElementById("Action").style.display = "none";  
   document.getElementById("QTYAlert").style.display = "block";     
        }else{
               document.getElementById("Action").style.display = "block";  
   document.getElementById("QTYAlert").style.display = "none";  
            
        }
       
                       var Total_PriceW =$('#Total_PriceW').val();

             if(enough == 0){
        
             if(Total_PriceW == 'NaN'){
                   document.getElementById("Action").style.display = "none";   
                    }else{
        document.getElementById("Action").style.display = "block";    
             }
             
       }else{
           
        document.getElementById("Action").style.display = "none";    
       } 
       
         

 
   }
</script>
    
<!-- Scanner  problem -->         
<script>
   $(".form-control").keypress(function(event){
   if (event.which == '10' || event.which == '13') {
   event.preventDefault();
   }
   });             
      $("#search").keypress(function(event){
   if (event.which == '10' || event.which == '13') {
   event.preventDefault();
   }
   });   
    

   
</script>
        
<!-- Groups Filter -->
<script>
function GROUP(r){

    var store = $('#store').val(); 
     var client = $('#client').val();  
     $.ajax({
      url:'GroupPosFilter',
      method:'GET',
      data:{
      group:r,      
      store:store,     
      client:client     
      },
      dataType:'json',
      success:function(data)
      {
          
       $('.Group').html(data.table_data);
    
      }
     })
          
}   
    
$(document).on('change', '#client', function(event){

    $('.Group').empty();
           
    });    
</script>    
        
<!-- Brands Filter -->
<script>
function BRAND(r){

    var store = $('#store').val(); 
     var client = $('#client').val();  
     $.ajax({
      url:'BrandsPosFilter',
      method:'GET',
      data:{
      group:r,      
      store:store,      
      client:client      
      },
      dataType:'json',
      success:function(data)
      {
          
       $('.Group').html(data.table_data);
    
      }
     })
    
}    
</script>    
                
<!-- Payment Method -->
<script>
function Pay(r){

    $('#Payment_Method').val(r); 
    
    if(r == 'Later'){
       $('#paid').val('');  
       }
      
}    
</script>    
         
<!-- Installment Total -->
<script>
 function Install(){
     
   var presenter =$('#presenter').val();  
   var annual_interest =$('#annual_interest').val();  
   var Years_Number =$('#Years_Number').val();  
   var total =$('#total').val();  

     
     var dif = parseFloat(total) - parseFloat(presenter) ; 
     
     var Percent = parseFloat(annual_interest) / parseFloat(100) ;
     
     var Tp = parseFloat(dif) * parseFloat(Percent) ;
     
     var years = parseFloat(Tp) * parseFloat(Years_Number) ;
     
     var tot = parseFloat(dif) + parseFloat(years) ; 
     
     var monthly = parseFloat(Years_Number) * parseFloat(12) ; 
     
     var t = parseFloat(tot) / parseFloat(monthly) ;
     
     
            $('#monthly_installment').val(parseFloat(t)); 
            $('#monthly_installmentHide').val(parseFloat(t)); 
            $('#installment_Num').val(parseFloat(monthly));  
            $('#installment_NumHide').val(parseFloat(monthly));      
 
 }
</script>
   
<!-- Holding or Not -->
<script>
function Hol(r){

    $('#HOLD').val(r); 
      
}    
</script>    
             
<!-- Submit Script -->
<script>

        function SPP(){
           $('#sp').val(1);  
           var x= $('#sp').val();   
          var client= $('#client').val();   
          var Total_QtyHide= $('#Total_QtyHide').val();   
          
       if(client == null){ 
           
              alert('تأكد من اختيار عميل');    
    
       }else{
    
                      if(Total_QtyHide == ''){
               
              alert('يجب اختيار اصناف اولا');      
               
              }else{
              if(x == 1){
             document.getElementById("SubmitY").style.display = "none"; 
      document.getElementById('form').submit();   
        } 
              }
       }
    }
    
    
       function SPS(){
           $('#sp').val(0);  
           var x= $('#sp').val();   
           var client= $('#client').val();   
           var Total_QtyHide= $('#Total_QtyHide').val();   
       if(client == null){ 
           
              alert('تأكد من اختيار عميل');    
    
       }else{
    
        

           if(Total_QtyHide == ''){
               
              alert('يجب اختيار اصناف اولا');      
               
              }else{
           if(x == 0){
              document.getElementById("SubmitY").style.display = "none"; 
   document.getElementById('form').submit();   
        } 
       }
       }
    }

      function SPP8(){
           $('#sp').val(2);  
           var x= $('#sp').val();   
               var Total_QtyHide= $('#Total_QtyHide').val(); 
         var client= $('#client').val();   
    
            if(client == null){ 
           
              alert('تأكد من اختيار عميل');    
    
       }else{
    
                      if(Total_QtyHide == ''){
               
              alert('يجب اختيار اصناف اولا');      
               
              }else{
              if(x == 2){
             document.getElementById("SubmitY").style.display = "none"; 
      document.getElementById('form').submit();   
        } 
              }
           
       }
    }
    
    
 
</script>
            
<!-- Search Hold Bills -->
<script>
$(document).ready(function(){
   
    fetch_customer_data();
   
    function fetch_customer_data(searchHold = '')
    {  
     $.ajax({
      url:'SalesHoldBillsPOSFilter',
      method:'GET',
      data:{searchHold:searchHold},
      dataType:'json',
      success:function(data)
      {
          
       $('.HOLDD').html(data.table_data);
         
          
      }
     })
    }
    
   $(document).on('keyup', '#searchHold', function(){
     var searchHold = $(this).val();     
     fetch_customer_data(searchHold);           
    });

       

    });      
</script>    
    
<!-- Press Enter Open Model  F2 Cash  F4 Later = Cash nd Visa  -  Delivery Example(fn + f1)-->        
<script>


    
    document.onkeyup = KeyCheck;

function KeyCheck(e)
{
   var KeyID = (window.event) ? event.keyCode : e.keyCode;
   if(KeyID == 113)
   {
   $('#default-example-modal-center-payment').modal('show');
       Pay('Cash');
       
     $("#T1").removeClass("active");
     $("#T2").removeClass("active");
     $("#T3").removeClass("active");
     $("#T4").removeClass("active");
     $("#T5").removeClass("active");
     $("#T6").removeClass("active");
     $("#T7").removeClass("active");
     $("#T8").removeClass("active");
     $("#T9").removeClass("active");
       
     $("#tab_direction-1").removeClass("active show");
     $("#tab_direction-2").removeClass("active show");
     $("#tab_direction-3").removeClass("active show");
     $("#tab_direction-4").removeClass("active show");
     $("#tab_direction-5").removeClass("active show");
     $("#tab_direction-6").removeClass("active show");
     $("#tab_direction-7").removeClass("active show");
     $("#tab_direction-8").removeClass("active show");
     $("#tab_direction-9").removeClass("active show");
       
  $("#T1").addClass("active");
  $("#tab_direction-1").addClass("active show");
       
   }
    
     if(KeyID == 115)
   {
   $('#default-example-modal-center-payment').modal('show');
       Pay('Later');
       
            $("#T1").removeClass("active");
     $("#T2").removeClass("active");
     $("#T3").removeClass("active");
     $("#T4").removeClass("active");
     $("#T5").removeClass("active");
     $("#T6").removeClass("active");
     $("#T7").removeClass("active");
     $("#T8").removeClass("active");
        $("#T9").removeClass("active");   
       
        $("#tab_direction-1").removeClass("active show");
     $("#tab_direction-2").removeClass("active show");
     $("#tab_direction-3").removeClass("active show");
     $("#tab_direction-4").removeClass("active show");
     $("#tab_direction-5").removeClass("active show");
     $("#tab_direction-6").removeClass("active show");
     $("#tab_direction-7").removeClass("active show");
     $("#tab_direction-8").removeClass("active show");
     $("#tab_direction-9").removeClass("active show");
       
  $("#T2").addClass("active");
  $("#tab_direction-2").addClass("active show");
       
       
   }
    
    
     if(KeyID == 187)
   {
   $('#default-example-modal-center-payment').modal('show');
       Pay('Cash_Visa');
       
            $("#T1").removeClass("active");
     $("#T2").removeClass("active");
     $("#T3").removeClass("active");
     $("#T4").removeClass("active");
     $("#T5").removeClass("active");
     $("#T6").removeClass("active");
     $("#T7").removeClass("active");
     $("#T8").removeClass("active");
     $("#T9").removeClass("active");
       
        $("#tab_direction-1").removeClass("active show");
     $("#tab_direction-2").removeClass("active show");
     $("#tab_direction-3").removeClass("active show");
     $("#tab_direction-4").removeClass("active show");
     $("#tab_direction-5").removeClass("active show");
     $("#tab_direction-6").removeClass("active show");
     $("#tab_direction-7").removeClass("active show");
     $("#tab_direction-8").removeClass("active show");
     $("#tab_direction-9").removeClass("active show");
       
  $("#T5").addClass("active");
  $("#tab_direction-5").addClass("active show");
       
       
   }
    
     if(KeyID == 189)
   {
   $('#default-example-modal-center-payment').modal('show');
       Pay('Delivery');
       
            $("#T1").removeClass("active");
     $("#T2").removeClass("active");
     $("#T3").removeClass("active");
     $("#T4").removeClass("active");
     $("#T5").removeClass("active");
     $("#T6").removeClass("active");
     $("#T7").removeClass("active");
     $("#T8").removeClass("active");
     $("#T9").removeClass("active");
       
       
        $("#tab_direction-1").removeClass("active show");
     $("#tab_direction-2").removeClass("active show");
     $("#tab_direction-3").removeClass("active show");
     $("#tab_direction-4").removeClass("active show");
     $("#tab_direction-5").removeClass("active show");
     $("#tab_direction-6").removeClass("active show");
     $("#tab_direction-7").removeClass("active show");
     $("#tab_direction-8").removeClass("active show");
     $("#tab_direction-9").removeClass("active show");
       
  $("#T7").addClass("active");
  $("#tab_direction-7").addClass("active show");
       
       
   }
    
    
}
    


    
        </script>        
        
 <!-- Recipy Voucher Add Ajax -->       
<script>
    $(document).ready(function(){
   
    fetch_customer_data();

    function fetch_customer_data(Creditor = '',AccountCode='',Shift='',Safe='',Coin='',Draw='',STORE='',STATEMENT='')
    {  
     $.ajax({
      url:'AddReciptVoucherAjax',
      method:'GET',
      data:{Creditor:Creditor,AccountCode:AccountCode,Shift:Shift,Safe:Safe,Coin:Coin,Draw:Draw,STORE:STORE,STATEMENT:STATEMENT},
      dataType:'json',
      success:function(data)
      {
          
           var LANG= $('#LANG').val();   
  if(LANG == 'ar'){
                            alert('تم الاضافه بنجاح');
                       }else{
                           alert('Added Successfully'); 
                       }  
    
          $('#Creditor').val(''); 
          $('#STATEMENT').val(''); 
$('#AccountCode').empty();     
          
      }
     })
    }
    
   $(document).on('click', '#ReciptVoucher', function(){
  
     var Creditor = $('#Creditor').val();     
     var AccountCode = $('#AccountCode').val();       
     var Shift = $('#Shift').val();       
     var Safe = $('#Safe').val();       
     var Coin = $('#Coin').val();       
     var Draw = $('#Draw').val();       
     var STORE = $('#STORE').val();    
     var STATEMENT = $('#STATEMENT').val();    
       
       if(Creditor != '' && AccountCode != ''){
        fetch_customer_data(Creditor,AccountCode,Shift,Safe,Coin,Draw,STORE,STATEMENT);    
       }
       
    });

       

                 
   });

     $(document).ready(function(){
   
    fetch_customer_data();

    function fetch_customer_data(Creditor = '',AccountCode='',Shift='',Safe='',Coin='',Draw='',STORE='',STATEMENT='')
    {  
     $.ajax({
      url:'AddReciptVoucherAjax',
      method:'GET',
      data:{Creditor:Creditor,AccountCode:AccountCode,Shift:Shift,Safe:Safe,Coin:Coin,Draw:Draw,STORE:STORE,STATEMENT:STATEMENT},
      dataType:'json',
      success:function(data)
      {
          
          alert('تم الاضافه بنجاح');
        $('#STATEMENTF').val(''); 
          $('#CreditorF').val(''); 
$('#AccountCodeF').empty();     
          
      }
     })
    }
    
   $(document).on('click', '#ReciptVoucher', function(){
  
     var Creditor = $('#CreditorF').val();     
     var AccountCode = $('#AccountCodeF').val();       
     var Shift = $('#ShiftF').val();       
     var Safe = $('#SafeF').val();       
     var Coin = $('#CoinF').val();       
     var Draw = $('#DrawF').val();       
     var STORE = $('#STOREF').val();    
           var STATEMENT = $('#STATEMENTF').val();  
       if(Creditor != '' && AccountCode != ''){
        fetch_customer_data(Creditor,AccountCode,Shift,Safe,Coin,Draw,STORE,STATEMENT);    
       }
       
    });

       

                 
   });
</script>  
 
 <!-- Payment Voucher Add Ajax -->       
<script>
    $(document).ready(function(){
   
    fetch_customer_data();

    function fetch_customer_data(Debitor = '',AccountCodee='',Shift='',Safe='',Coin='',Draw='',STORE='',STATEMENT='')
    {  
     $.ajax({
      url:'AddPaymentVoucherAjax',
      method:'GET',
      data:{Debitor:Debitor,AccountCodee:AccountCodee,Shift:Shift,Safe:Safe,Coin:Coin,Draw:Draw,STORE:STORE,STATEMENT:STATEMENT},
      dataType:'json',
      success:function(data)
      {
          
        var LANG= $('#LANG').val();   
  if(LANG == 'ar'){
                            alert('تم الاضافه بنجاح');
                       }else{
                           alert('Added Successfully'); 
                       }  
      $('#STATEMENTP').val(''); 
          $('#Debitor').val(''); 
$('#AccountCodee').empty();     
          
      }
     })
    }
    
   $(document).on('click', '#PaymentVoucher', function(){
  
     var Debitor = $('#Debitor').val();     
     var AccountCodee = $('#AccountCodee').val();       
     var Shift = $('#ShiftP').val();       
     var Safe = $('#SafeP').val();       
     var Coin = $('#CoinP').val();       
     var Draw = $('#DrawP').val();       
     var STORE = $('#STOREP').val();    
        var STATEMENT = $('#STATEMENTP').val();  
       if(Debitor != '' && AccountCodee != ''){
        fetch_customer_data(Debitor,AccountCodee,Shift,Safe,Coin,Draw,STORE,STATEMENT);    
       }
       
    });

       


                 
   });

        $(document).ready(function(){
   
    fetch_customer_data();

    function fetch_customer_data(Debitor = '',AccountCodee='',Shift='',Safe='',Coin='',Draw='',STORE='',STATEMENT='')
    {  
     $.ajax({
      url:'AddPaymentVoucherAjax',
      method:'GET',
      data:{Debitor:Debitor,AccountCodee:AccountCodee,Shift:Shift,Safe:Safe,Coin:Coin,Draw:Draw,STORE:STORE,STATEMENT:STATEMENT},
      dataType:'json',
      success:function(data)
      {
          
          alert('تم الاضافه بنجاح');
      $('#STATEMENTPr').val(''); 
          $('#Debitorr').val(''); 
$('#AccountCodeee').empty();     
          
      }
     })
    }
    
   $(document).on('click', '#PaymentVoucherr', function(){
  
     var Debitor = $('#Debitorr').val();     
     var AccountCodee = $('#AccountCodeee').val();       
     var Shift = $('#ShiftPr').val();       
     var Safe = $('#SafePr').val();       
     var Coin = $('#CoinPr').val();       
     var Draw = $('#DrawPr').val();       
     var STORE = $('#STOREPr').val();    
        var STATEMENT = $('#STATEMENTPr').val();  
       if(Debitor != '' && AccountCodee != ''){
        fetch_customer_data(Debitor,AccountCodee,Shift,Safe,Coin,Draw,STORE,STATEMENT);    
       }
       
    });

       


                 
   });
    
    
     $(document).ready(function(){
   
    fetch_customer_data();

    function fetch_customer_data(Debitor = '',AccountCodee='',Shift='',Safe='',Coin='',Draw='',STORE='',STATEMENT='')
    {  
     $.ajax({
      url:'AddPaymentVoucherAjax',
      method:'GET',
      data:{Debitor:Debitor,AccountCodee:AccountCodee,Shift:Shift,Safe:Safe,Coin:Coin,Draw:Draw,STORE:STORE,STATEMENT:STATEMENT},
      dataType:'json',
      success:function(data)
      {
          
          alert('تم الاضافه بنجاح');
      $('#STATEMENTPrP').val(''); 
          $('#Debitorrr').val(''); 
$('#AccountCodeeee').empty();     
          
      }
     })
    }
    
   $(document).on('click', '#PaymentVoucherrr', function(){
  
     var Debitor = $('#Debitorrr').val();     
     var AccountCodee = $('#AccountCodeeee').val();       
     var Shift = $('#ShiftPrP').val();       
     var Safe = $('#SafePrP').val();       
     var Coin = $('#CoinPrP').val();       
     var Draw = $('#DrawPrP').val();       
     var STORE = $('#STOREPrP').val();    
        var STATEMENT = $('#STATEMENTPrP').val();  
       if(Debitor != '' && AccountCodee != ''){
        fetch_customer_data(Debitor,AccountCodee,Shift,Safe,Coin,Draw,STORE,STATEMENT);    
       }
       
    });

       


                 
   });
    
    
</script>  
<!-- Cash and Residual -->
<script>
function Dif(){

    var Total=$("#Total_PriceHide").val();
    var paid=$('#paid').val();
    
    var res=parseFloat(Total) - parseFloat(paid) ;
    
    if(parseFloat(res) > 0){
        $('#resdiual').val(res); 
        $('#Total_DiscountHide').val(res); 
    }else{
       $('#resdiual').val(0);  
       $('#Total_DiscountHide').val(0);  
    }
   
    
    $('#Res').val(Math.abs(res));

    
    
} 
    
function Diff(){

    var Total=$("#Total_PriceHide").val();
    var paid=$('#CashhHold').val();
    
    var res=parseFloat(Total) - parseFloat(paid) ;
    $('#ResidualHold').val(res);
    
    
} 
</script>    
<!-- Unit Change and Select -->
        <script>
    function UniPro(Pro,r,co,st){
        $('#R').val(r);
        $('#ProR').val(Pro);
        $('#CodeR').val(co);
        $('#StoR').val(st);
          $.ajax({
                              url: 'UnitsOfProducts/'+Pro,
                              type:"GET",
                              dataType:"json",
                              beforeSend: function(){
                                  $('#loader').css("visibility", "visible");
                              },

                              success:function(data) {
                                          $('#ChUnit').empty();  
                                  
                                          var LANG = $("#LANG").val();
   if(LANG == 'ar' ){ 
          $('#ChUnit').append('<option value="">اختر الوحده</option>');   
          }else{
          $('#ChUnit').append('<option value=""> Choice Unit</option>');   
          } 
                  
                                  
                                  
                                  
                                  $.each(data, function(key, value){
   
                         $('#ChUnit').append('<option value="'+ key +'">' + value + '</option>');
                   
                                      
           var Qty = $("#QTTY"+r).val();
           var AVQty = $("#AVHide"+r).val();
                                      
                              var Product = $("#Product"+r).val();
             var UnitID = $("#UnitPurch"+r).val();       
            $.ajax({
                             url: 'UnitSalesRateFilter',
                             type:"GET",
                            data:{
                              Product:Product,  
                              UnitID:UnitID  
                            },
                             dataType:"json",
                             beforeSend: function(){
                                 $('#loader').css("visibility", "visible");
                             },
   
                             success:function(data) {
                            
                                     
                     $('#UnitRato'+r).val(data.rate); 

                                 
                             },
                             complete: function(){
                                 $('#loader').css("visibility", "hidden");
                             }
                         });
       
                             
                                   
                                      
                                      
                                      
       if(parseFloat(Qty) > parseFloat(AVQty)){
           
           
      document.getElementById("QTTY"+r).style.border="1px solid darkred";     
             $("#Enough"+r).val(1);
  
       }else{
           
     document.getElementById("QTTY"+r).style.border="none"; 
             $("#Enough"+r).val(0);     
                   
       }

       var enough=0;
    $('input[name^="AllEnough"]').each(function() {
    
    
        enough +=$(this).val();
        
});

         
             if(parseFloat(enough) > 0){
            
               document.getElementById("Action").style.display = "none";  
   document.getElementById("QTYAlert").style.display = "block";     
        }else{
               document.getElementById("Action").style.display = "block";  
   document.getElementById("QTYAlert").style.display = "none";  
            
        }
       
    
                          
                                      
                                  });
                              },
                              complete: function(){
                                  $('#loader').css("visibility", "hidden");
                              }
                          });
        
    }        
            
       function  UnitCodePurch(){
   
    var r=$('#R').val();       
   var countryId = $('#ChUnit').val();
   var Pro = $('#ProR').val();
   var client = $('#client').val();
   var code = $('#CodeR').val();
   var Store = $('#StoR').val();
         var DEFAULTCOSTPRICE = $("#DEFAULTCOSTPRICE").val();    
                     if(countryId) {
                         $.ajax({
                             url: 'UnitSalesFilter/'+countryId+'/'+Pro+'/'+client+'/'+code+'/'+Store,
                             type:"GET",
                             dataType:"json",
                             beforeSend: function(){
                                 $('#loader').css("visibility", "visible");
                             },
   
                             success:function(data) {
                                 
                                   var V=$('#V'+r).val();   
                          
           if(V == ''){
                       $('#Coding'+r).text(data.code);  
                                     $('#CodeR').val(data.code);
                                     $('#CodingHide').val(data.code);
           }
                       $('#un'+r).val(countryId); 
                       $('#TextUni'+r).text(data.name); 
                       $('#PRICE'+r).val(data.price); 
                       $('#PCL'+r).val(data.price); 
                       $('#AVVQ'+r).text(parseFloat(data.qty).toFixed(2)); 
                       $('#AVHide'+r).val(parseFloat(data.qty).toFixed(2)); 
      
                                 
    var TaxRate = $("#RATE"+r).val();
   var TaxType = $("#TYPE"+r).val();
   var Qty = $("#QTTY"+r).val();
   var Price = $("#PRICE"+r).val();
   var Discount = $("#DISC"+r).val();
   var i = 0;
   var ii=0;       
   var iii=0;      
                                 
                                 
                          var Product = $("#Product"+r).val();
             var UnitID = $("#UnitPurch"+r).val();       
            $.ajax({
                             url: 'UnitSalesRateFilter',
                             type:"GET",
                            data:{
                              Product:Product,  
                              UnitID:UnitID  
                            },
                             dataType:"json",
                             beforeSend: function(){
                                 $('#loader').css("visibility", "visible");
                             },
   
                             success:function(data) {
                            
                                     
                         $('#UnitRato'+r).val(data.rate); 

                                 
                             },
                             complete: function(){
                                 $('#loader').css("visibility", "hidden");
                             }
                         });
       
                             
                                  

         var HighDisc = $("#HighDisc"+r).val();
       var DIS = $("#DIS").val();
        
       if(parseFloat(DIS) == 0){
          
           Discount=$("#DISC"+r).val();
                      
       }else{
         
           var d= Discount / 100 ;
           var Multi= parseFloat(Qty) * parseFloat(Price) ;
          var dd= Multi * d;
           
        Discount=  dd; 
       }
  
     
           var BFG =  parseFloat(Qty) * parseFloat(Discount) ;
             $("#TDiscProEdit"+r).val(parseFloat(BFG));
       
       if(TaxType == 1){
           //Precent
          
      var BF =  parseFloat(Qty) *  (parseFloat(Price)  -  parseFloat(Discount));  
       
       $("#TBFTax"+r).val(parseFloat(BF));
           
       i =    parseFloat(TaxRate)  / 100 ;  
           
        ii=  parseFloat(BF) * parseFloat(i) ;
              
           $("#TTax"+r).val(parseFloat(ii));

       iii =  parseFloat(BF) + parseFloat(ii) ;
           
           $("#TOTT"+r).val(parseFloat(iii).toFixed(2));
           $("#TOTTNo"+r).val(parseFloat(iii).toFixed(2));
           
       }else if(TaxType == 2){
          //Number 
         var BF =  parseFloat(Qty) *  (parseFloat(Price)  -  parseFloat(Discount));  
         $("#TBFTax"+r).val(parseFloat(BF));
          
            i =    parseFloat(TaxRate)   ; 
           
           $("#TTax"+r).val(parseFloat(i));

       iii =  parseFloat(BF) + parseFloat(i) ;
           
           $("#TOTT"+r).val(parseFloat(iii).toFixed(2));
           $("#TOTTNo"+r).val(parseFloat(iii).toFixed(2));
           
           
       }
     
                                        var Total = $("#TOTT"+r).val();
       var RFF= parseFloat(Qty) * parseFloat(Price);
       var RFFResult= parseFloat(RFF) - parseFloat(Total);
         $("#disssccoount"+r).val(parseFloat(RFFResult));
 

     $.fn.rowCount = function() {
     return $('tr', $(this).find('tbody')).length;
   };
   
   var rowctr = $('#dt').rowCount();     
                
    var sumQ = 0;        
   $('.Qun').each(function(){
   sumQ += parseFloat($(this).val());
   });   
            
    var sumT = 0;        
   $('.Tot').each(function(){
   sumT += parseFloat($(this).val());
   });       
       
        var sumD = 0;        
   $('.Disc').each(function(){
   sumD += parseFloat($(this).val());
   }); 
       
       
           var sumBF = 0;        
   $('.TotalBFTax').each(function(){
   sumBF += parseFloat($(this).val());
   }); 
       
           var sumTax = 0;        
   $('.TotalTax').each(function(){
   sumTax += parseFloat($(this).val());
   }); 

    var sumTTD = 0;        
   $('.TDISCOOO').each(function(){
   sumTTD += parseFloat($(this).val());
   }); 
    
                                  var COPRI = 0;        
   $('.COSTPRICES').each(function(){
   COPRI += parseFloat($(this).val());
   }); 
                                 
      

  $('#ProfitPrecent').val(parseFloat(sumT) - parseFloat(COPRI));
      var nfd=((parseFloat(sumT) - parseFloat(COPRI)) * 100) / parseFloat(COPRI);
   $('#proPrecent').text(parseFloat(nfd).toFixed(2));

   $('#ProNums').text(parseFloat(rowctr));
   $('#ProQty').text(parseFloat(sumQ).toFixed(2));
   $('#Total_QtyHide').val(parseFloat(sumQ).toFixed(2));
  $('#TotalPrice').text(parseFloat(sumT) + parseFloat(sumTTD) -  parseFloat(sumTax));

         $('#Total_DiscountTTShow').text(parseFloat(sumTTD).toFixed(2));
         $('#Total_TaxesShow').text(parseFloat(sumTax));
       
         $('#TotalCost').val(parseFloat(COPRI).toFixed(2));
       
       
        $('#Product_Numbers').val(parseFloat(rowctr));
   $('#Product_NumbersHide').val(parseFloat(rowctr));
       
   $('#Total_Qty').val(parseFloat(sumQ));
       
     $('#Total_Price').val(parseFloat(sumT) + parseFloat(sumTTD) -  parseFloat(sumTax));
   $('#Total_PriceHide').val(parseFloat(sumT) + parseFloat(sumTTD) -  parseFloat(sumTax));
   $('#Total_PriceW').val(parseFloat(sumT));
       $('#Total_Bill').val(parseFloat(sumT));

           $('#Total_DiscountTT').val(parseFloat(sumTTD).toFixed(2));
   $('#Total_DiscountHideTT').val(parseFloat(sumTTD).toFixed(2));
    
       $('#Total_Discount').val(parseFloat(sumD).toFixed(2));
   $('#Total_DiscountHide').val(parseFloat(sumD).toFixed(2));
       
          $('#Total_Bf_Taxes').val(parseFloat(sumBF)+parseFloat(sumTTD));
   $('#Total_Bf_TaxesHide').val(parseFloat(sumBF)+parseFloat(sumTTD));
       
          $('#Total_Taxes').val(parseFloat(sumTax).toFixed(2));
   $('#Total_TaxesHide').val(parseFloat(sumTax).toFixed(2));
  var Pay =$('#Payment_Method').val();
        var Stat =$('#Status').val();
        var paid =$('#paid').val();
        var resdiual =$('#resdiual').val();
        var total =$('#Total_PriceHide').val();
        var totalDisc =$('#Total_DiscountHideTT').val();

          var totalTax =$('#Total_TaxesHide').val();

 
         var RR= (parseFloat(total) + parseFloat(totalTax) ) - (parseFloat(resdiual) + parseFloat(totalDisc));
             var RRR= parseFloat(total) - (parseFloat(resdiual) + parseFloat(totalDisc));
          $('#TAFterD').val(parseFloat(RRR).toFixed(2));        
         $('#paid').val(parseFloat(RR).toFixed(2));
       
         $('#presenter').val(parseFloat(RR).toFixed(2));
         $('#total').val(parseFloat(sumT).toFixed(2));
            if(HighDisc != 0){
           
         
           if(parseFloat(Discount)  >  parseFloat(HighDisc)){
                     document.getElementById("Action").style.display = "none";  
                   document.getElementById("ActionAlert").style.display = "block";  
           }else{
                   document.getElementById("Action").style.display = "block";   
                document.getElementById("ActionAlert").style.display = "none";   
               
           }
           
           
       }
                                
                       var Qty = $("#QTTY"+r).val();
           var AVQty = $("#AVHide"+r).val();

        if(parseFloat(Qty) > parseFloat(AVQty)){
           
           
      document.getElementById("QTTY"+r).style.border="1px solid darkred";     
             $("#Enough"+r).val(1);
  
       }else{
           
     document.getElementById("QTTY"+r).style.border="none"; 
             $("#Enough"+r).val(0);     
                   
       }

       var enough=0;
    $('input[name^="AllEnough"]').each(function() {
    
    
        enough +=$(this).val();
        
});

         
             if(parseFloat(enough) > 0){
            
               document.getElementById("Action").style.display = "none";  
   document.getElementById("QTYAlert").style.display = "block";     
        }else{
               document.getElementById("Action").style.display = "block";  
   document.getElementById("QTYAlert").style.display = "none";  
            
        }
       
    
   
                                                
                                 
    
                             },
                             complete: function(){
                                 $('#loader').css("visibility", "hidden");
                             }
                         });
                     } else {
   
                         $('select[name="state"]').empty();
                     }
       
       
           
   
   }     
        </script>        
       
    <!-- All Prods Filter -->    
<script>
function AllProductsPOS(){

    var store = $('#store').val(); 
     var client = $('#client').val();  
     $.ajax({
      url:'AllProsPosFilter',
      method:'GET',
      data:{    
      store:store,     
      client:client     
      },
      dataType:'json',
      success:function(data)
      {
          
       $('.Group').html(data.table_data);
    
      }
     })
          
}       
</script>
        
      <!-- Other Stores Qty -->        
<script>
    function OtherQTY(Product,Barcode){
  $.ajax({
      url:'POSOtherQtyFilter',
      method:'GET',
      data:{Product:Product,Barcode:Barcode},
      dataType:'json',
      success:function(data)
      {
          
       $('.QTYOTHERSTORES').html(data.table_data);

      }
     })    
    }
  

    
</script>    
     

<!-- Filter Governrate and City !-->
<script>
   $(document).ready(function() {
   
       $('#Governrate').on('change', function(){
           var countryId = $(this).val();
           if(countryId) {
               $.ajax({
                   url: 'GovernrateFilter/'+countryId,
                   type:"GET",
                   dataType:"json",
                   beforeSend: function(){
                       $('#loader').css("visibility", "visible");
                   },
   
                   success:function(data) {
   
                       $('#City').empty();
   
                       $.each(data, function(key, value){
   
             $('#City').append('<option value="'+ key +'">' + value + '</option>');
                           
                       });
                       
                      var CIITY = $('#City').val();  
                         $.ajax({
                   url: 'CityFilter/'+CIITY,
                   type:"GET",
                   dataType:"json",
                   beforeSend: function(){
                       $('#loader').css("visibility", "visible");
                   },
   
                   success:function(data) {
   
                       $('#Place').empty();
   
                       $.each(data, function(key, value){
   
             $('#Place').append('<option value="'+ key +'">' + value + '</option>');
                           
                       });
                       
       
                   },
                   complete: function(){
                       $('#loader').css("visibility", "hidden");
                   }
               });
                       
                       
                       
                   },
                   complete: function(){
                       $('#loader').css("visibility", "hidden");
                   }
               });
           } else {
   
               $('select[name="states"]').empty();
           }
   
       });
   
   });
    
   $(document).ready(function() {
   
   
           var countryId = $('#Governrate').val();
           if(countryId) {
               $.ajax({
                   url: 'GovernrateFilter/'+countryId,
                   type:"GET",
                   dataType:"json",
                   beforeSend: function(){
                       $('#loader').css("visibility", "visible");
                   },
   
                   success:function(data) {
   
                       $('#City').empty();
   
                       $.each(data, function(key, value){
   
             $('#City').append('<option value="'+ key +'">' + value + '</option>');
                           
                       });
                       
                     var CIITY = $('#City').val();  
                         $.ajax({
                   url: 'CityFilter/'+CIITY,
                   type:"GET",
                   dataType:"json",
                   beforeSend: function(){
                       $('#loader').css("visibility", "visible");
                   },
   
                   success:function(data) {
   
                       $('#Place').empty();
   
                       $.each(data, function(key, value){
   
             $('#Place').append('<option value="'+ key +'">' + value + '</option>');
                           
                       });
                       
       
                   },
                   complete: function(){
                       $('#loader').css("visibility", "hidden");
                   }
               });
                              
                       
                       
                       
                   },
                   complete: function(){
                       $('#loader').css("visibility", "hidden");
                   }
               });
           } else {
   
               $('select[name="states"]').empty();
           }
   
   
   });  
    
    
 $('#City').on('change', function(){
      var CIITY = $('#City').val();  
                         $.ajax({
                   url: 'CityFilter/'+CIITY,
                   type:"GET",
                   dataType:"json",
                   beforeSend: function(){
                       $('#loader').css("visibility", "visible");
                   },
   
                   success:function(data) {
   
                       $('#Place').empty();
   
                       $.each(data, function(key, value){
   
             $('#Place').append('<option value="'+ key +'">' + value + '</option>');
                           
                       });
                       
       
                   },
                   complete: function(){
                       $('#loader').css("visibility", "hidden");
                   }
               });
                       
     
 });
    
</script>        
        
<script>
    
    $(document).ready(function() {
        
        
               $('#tab_direction-2').removeClass('active show'); 
                        $('#T2').removeClass('active');   
        
          $('#tab_direction-3').removeClass('active show'); 
                        $('#T3').removeClass('active');   
        
          $('#tab_direction-4').removeClass('active show'); 
                        $('#T4').removeClass('active');   
        
          $('#tab_direction-5').removeClass('active show'); 
                        $('#T5').removeClass('active');   
        
          $('#tab_direction-6').removeClass('active show'); 
                        $('#T6').removeClass('active');   
        
          
                        $('#T7').removeClass('active');   
        $('#tab_direction-7').removeClass('active show'); 
                    
                            $('#T8').removeClass('active');   
        $('#tab_direction-8').removeClass('active show');    
        
        $('#T9').removeClass('active');   
        $('#tab_direction-9').removeClass('active show'); 
              
        
                        $('#T1').addClass('active');   
          $('#tab_direction-1').addClass('active show'); 
        
        
   
  
    });

              
</script>    
       
        
<!-- Change Tax -->
<script>
     function  TaxPro(Pro,r){
         $('#RX').val(r);
         $('#ProRX').val(Pro);
     }

     function  TAXPurch(){
 var r=$('#RX').val();  
            var DEFAULTCOSTPRICE = $("#DEFAULTCOSTPRICE").val();    
   var countryId = $('#OLDTAX').val();

                     if(countryId) {
                         $.ajax({
                             url: 'TaxNamePurchasesFilter/'+countryId,
                             type:"GET",
                             dataType:"json",
                             beforeSend: function(){
                                 $('#loader').css("visibility", "visible");
                             },
   
                             success:function(data) {
                          
                                     
                       $('#RATE'+r).val(data.rate); 
                       $('#TYPE'+r).val(data.type); 
                       $('#PurchTaxx'+r).val(data.tax); 
 

     var TaxRate = $("#RATE"+r).val();
   var TaxType = $("#TYPE"+r).val();
   var Qty = $("#QTTY"+r).val();
   var Price = $("#PRICE"+r).val();
   var Discount = $("#DISC"+r).val();
   var i = 0;
   var ii=0;       
   var iii=0;       
          
                                 
                     
                          var Product = $("#Product"+r).val();
             var UnitID = $("#UnitPurch"+r).val();       
            $.ajax({
                             url: 'UnitSalesRateFilter',
                             type:"GET",
                            data:{
                              Product:Product,  
                              UnitID:UnitID  
                            },
                             dataType:"json",
                             beforeSend: function(){
                                 $('#loader').css("visibility", "visible");
                             },
   
                             success:function(data) {
                            
                                     
                     $('#UnitRato'+r).val(data.rate); 

                                 
                             },
                             complete: function(){
                                 $('#loader').css("visibility", "hidden");
                             }
                         });
       
                             
                                  
                                 
                                 

         var HighDisc = $("#HighDisc"+r).val();
       var DIS = $("#DIS").val();
        
       if(parseFloat(DIS) == 0){
          
           Discount=$("#DISC"+r).val();
                      
       }else{
         
           var d= Discount / 100 ;
           var Multi= parseFloat(Qty) * parseFloat(Price) ;
          var dd= Multi * d;
           
        Discount=  dd; 
       }
  
     
           var BFG =  parseFloat(Qty) * parseFloat(Discount) ;
             $("#TDiscProEdit"+r).val(parseFloat(BFG));
       
       if(TaxType == 1){
           //Precent
          
      var BF =  parseFloat(Qty) *  (parseFloat(Price)  -  parseFloat(Discount));  
       
       $("#TBFTax"+r).val(parseFloat(BF));
           
       i =    parseFloat(TaxRate)  / 100 ;  
           
        ii=  parseFloat(BF) * parseFloat(i) ;
              
           $("#TTax"+r).val(parseFloat(ii));

       iii =  parseFloat(BF) + parseFloat(ii) ;
           
           $("#TOTT"+r).val(parseFloat(iii).toFixed(2));
           $("#TOTTNo"+r).val(parseFloat(iii).toFixed(2));
           
       }else if(TaxType == 2){
          //Number 
         var BF =  parseFloat(Qty) *  (parseFloat(Price)  -  parseFloat(Discount));  
         $("#TBFTax"+r).val(parseFloat(BF));
          
            i =    parseFloat(TaxRate)   ; 
           
           $("#TTax"+r).val(parseFloat(i));

       iii =  parseFloat(BF) + parseFloat(i) ;
           
           $("#TOTT"+r).val(parseFloat(iii).toFixed(2));
           $("#TOTTNo"+r).val(parseFloat(iii).toFixed(2));
           
           
       }
     
                                        var Total = $("#TOTT"+r).val();
       var RFF= parseFloat(Qty) * parseFloat(Price);
       var RFFResult= parseFloat(RFF) - parseFloat(Total);
         $("#disssccoount"+r).val(parseFloat(RFFResult));
 

     $.fn.rowCount = function() {
     return $('tr', $(this).find('tbody')).length;
   };
   
   var rowctr = $('#dt').rowCount();     
                
    var sumQ = 0;        
   $('.Qun').each(function(){
   sumQ += parseFloat($(this).val());
   });   
            
    var sumT = 0;        
   $('.Tot').each(function(){
   sumT += parseFloat($(this).val());
   });       
       
        var sumD = 0;        
   $('.Disc').each(function(){
   sumD += parseFloat($(this).val());
   }); 
       
       
           var sumBF = 0;        
   $('.TotalBFTax').each(function(){
   sumBF += parseFloat($(this).val());
   }); 
       
           var sumTax = 0;        
   $('.TotalTax').each(function(){
   sumTax += parseFloat($(this).val());
   }); 

    var sumTTD = 0;        
   $('.TDISCOOO').each(function(){
   sumTTD += parseFloat($(this).val());
   }); 
    
 var COPRI = 0;        
   $('.COSTPRICES').each(function(){
   COPRI += parseFloat($(this).val());
   }); 
                                 
    

  $('#ProfitPrecent').val(parseFloat(sumT) - parseFloat(COPRI));
      var nfd=((parseFloat(sumT) - parseFloat(COPRI)) * 100) / parseFloat(COPRI);
   $('#proPrecent').text(parseFloat(nfd).toFixed(2));
 $('#ProNums').text(parseFloat(rowctr));
   $('#ProQty').text(parseFloat(sumQ).toFixed(2));
   $('#Total_QtyHide').val(parseFloat(sumQ).toFixed(2));
  $('#TotalPrice').text(parseFloat(sumT) + parseFloat(sumTTD) -  parseFloat(sumTax));

         $('#Total_DiscountTTShow').text(parseFloat(sumTTD).toFixed(2));
         $('#Total_TaxesShow').text(parseFloat(sumTax));
       
      
          $('#TotalCost').val(parseFloat(COPRI).toFixed(2));
       
        $('#Product_Numbers').val(parseFloat(rowctr));
   $('#Product_NumbersHide').val(parseFloat(rowctr));
       
   $('#Total_Qty').val(parseFloat(sumQ));
       
     $('#Total_Price').val(parseFloat(sumT) + parseFloat(sumTTD) -  parseFloat(sumTax));
   $('#Total_PriceHide').val(parseFloat(sumT) + parseFloat(sumTTD) -  parseFloat(sumTax));
   $('#Total_PriceW').val(parseFloat(sumT));
       $('#Total_Bill').val(parseFloat(sumT));

           $('#Total_DiscountTT').val(parseFloat(sumTTD).toFixed(2));
   $('#Total_DiscountHideTT').val(parseFloat(sumTTD).toFixed(2));
    
       $('#Total_Discount').val(parseFloat(sumD).toFixed(2));
   $('#Total_DiscountHide').val(parseFloat(sumD).toFixed(2));
       
          $('#Total_Bf_Taxes').val(parseFloat(sumBF)+parseFloat(sumTTD));
   $('#Total_Bf_TaxesHide').val(parseFloat(sumBF)+parseFloat(sumTTD));
       
          $('#Total_Taxes').val(parseFloat(sumTax).toFixed(2));
   $('#Total_TaxesHide').val(parseFloat(sumTax).toFixed(2));
  var Pay =$('#Payment_Method').val();
        var Stat =$('#Status').val();
        var paid =$('#paid').val();
        var resdiual =$('#resdiual').val();
        var total =$('#Total_PriceHide').val();
        var totalDisc =$('#Total_DiscountHideTT').val();

          var totalTax =$('#Total_TaxesHide').val();

 
         var RR= (parseFloat(total) + parseFloat(totalTax) ) - (parseFloat(resdiual) + parseFloat(totalDisc));
             var RRR= parseFloat(total) - (parseFloat(resdiual) + parseFloat(totalDisc));
          $('#TAFterD').val(parseFloat(RRR).toFixed(2));        
         $('#paid').val(parseFloat(RR).toFixed(2));
       
         $('#presenter').val(parseFloat(RR).toFixed(2));
         $('#total').val(parseFloat(sumT).toFixed(2));
            if(HighDisc != 0){
           
         
           if(parseFloat(Discount)  >  parseFloat(HighDisc)){
                     document.getElementById("Action").style.display = "none";  
                   document.getElementById("ActionAlert").style.display = "block";  
           }else{
                   document.getElementById("Action").style.display = "block";   
                document.getElementById("ActionAlert").style.display = "none";   
               
           }
           
           
       }
                                
                       var Qty = $("#QTTY"+r).val();
           var AVQty = $("#AVHide"+r).val();

        if(parseFloat(Qty) > parseFloat(AVQty)){
           
           
      document.getElementById("QTTY"+r).style.border="1px solid darkred";     
             $("#Enough"+r).val(1);
  
       }else{
           
     document.getElementById("QTTY"+r).style.border="none"; 
             $("#Enough"+r).val(0);     
                   
       }

       var enough=0;
    $('input[name^="AllEnough"]').each(function() {
    
    
        enough +=$(this).val();
        
});

         
             if(parseFloat(enough) > 0){
            
               document.getElementById("Action").style.display = "none";  
   document.getElementById("QTYAlert").style.display = "block";     
        }else{
               document.getElementById("Action").style.display = "block";  
   document.getElementById("QTYAlert").style.display = "none";  
            
        }
       
    
   
                  
        
   
                             },
                             complete: function(){
                                 $('#loader').css("visibility", "hidden");
                             }
                         });
                     } else {
   
                         $('select[name="state"]').empty();
                     }
   
   }   
    function PayInstall(){
        
           var Pay= $('#paid').val();
    
          $('#presenter').val(parseFloat(Pay).toFixed(2));
        
    }
</script>
        
<!-- Status -->
<script>
    function Statuss(){
        var Pay =$('#Payment_Method').val();
        var Stat =$('#Status').val();
        var paid =$('#paid').val();
        var resdiual =$('#resdiual').val();
        var total =$('#Total_PriceHide').val();
        var totalDisc =$('#Total_DiscountHideTT').val();

          var totalTax =$('#Total_TaxesHide').val();

 
         var RR= (parseFloat(total) + parseFloat(totalTax) ) - (parseFloat(resdiual) + parseFloat(totalDisc));
             var RRR= parseFloat(total) - (parseFloat(resdiual) + parseFloat(totalDisc));
          $('#TAFterD').val(parseFloat(RRR).toFixed(2));        
         $('#paid').val(parseFloat(RR).toFixed(2));
   $('#Total_PriceW').val(parseFloat(RR));
         $('#presenter').val(parseFloat(RR).toFixed(2));
         $('#total').val(parseFloat(RR).toFixed(2));
  $.fn.rowCount = function() {
     return $('tr', $(this).find('tbody')).length;
   };
   
   var rowctr = $('#dt').rowCount();     
     
   if(Pay == 'Later'  ||  Pay == 'Installment'  &&  Stat == 0 ){
               
             if(paid == 0 || paid < 0){   
        document.getElementById("Submit").style.display = "none";  
             }else{
                 
           if(rowctr == 0){
        document.getElementById("Submit").style.display = "none";    
           
       }else{
           
           
           if(paid != 0  ||  paid == ''){
               
                document.getElementById("Submit").style.display = "block";    
           }else{
               
                     document.getElementById("Submit").style.display = "none";  
           }
           
       
       }
                 
                 
                 
             }
           
       }else{
           
       if(rowctr == 0){
        document.getElementById("Submit").style.display = "none";    
           
       }else{
           
            if(paid != 0  ||  paid == ''){
               
                document.getElementById("Submit").style.display = "block";    
           }else{
               
                     document.getElementById("Submit").style.display = "none";  
           }
           
       }   
       }
 
        
     if(Pay == 'Installment'){
       
            document.getElementById("Install").style.display = "block";  
         
     }else{
         
          document.getElementById("Install").style.display = "none"; 
         
     }
        
        
               if(Pay == 'Check'){
         
           document.getElementById("CHECK").style.display = "block";  
           
       }else{
           
         document.getElementById("CHECK").style.display = "none";    
       }  
        
               if(Pay == 'Later'){
         
           document.getElementById("Later_Due").style.display = "block";  
                   $('#paid').val('');
           
       }else{
           
         document.getElementById("Later_Due").style.display = "none";    
       }     
        
    }
     
</script> 
        
        <!-- Tax on Total -->
<script>
      function  TaxOn(){
   
   var TaxOnTotalType = $('#TaxOnTotalType').val();
   var TotalNet = $('#Total_PriceW').val();

       
                     if(TaxOnTotalType) {
                         $.ajax({
                             url: 'TaxOnTotalTypeFilter',
                             type:"GET",
                             data:{
                               TaxOnTotalType:TaxOnTotalType  
                             },
                             dataType:"json",
                             beforeSend: function(){
                                 $('#loader').css("visibility", "visible");
                             },
   
                             success:function(data) {
                                 
            if(data.TaxType == 1){
         //Precent
             var i= parseFloat(data.TaxRate)  / parseFloat(100) ;
                
                var ii=  parseFloat(TotalNet) * parseFloat(i) ;  
                 $('#ProfitTax').val(parseFloat(ii)); 
                
                var iii =  $('#ProfitTax').val(); 
                var iiii = parseFloat(iii) + parseFloat(TotalNet); 
                $('#Total_PriceW').val(parseFloat(iiii)); 
                $('#paid').val(parseFloat(iiii)); 
                
                
                
}else if(data.TaxType == 2){
        //Number 
    
         
              
                 $('#ProfitTax').val(parseFloat(data.TaxRate)); 
                
                var iii =  $('#ProfitTax').val(); 
                var iiii = parseFloat(iii) + parseFloat(TotalNet); 
                $('#Total_PriceW').val(parseFloat(iiii)); 
                $('#paid').val(parseFloat(iiii)); 
    
}
                         
                      
           
      
   
   
                             },
                             complete: function(){
                                 $('#loader').css("visibility", "hidden");
                             }
                         });
                     } else {
   
                         $('select[name="state"]').empty();
                     }
       
       
           
   
   }   
</script>
        
<!-- installment Compamies -->
<script>
      function  InstaallComp(){
   
   var InstallCompany = $('#InstallCompany').val();
   var TotalNet = $('#Total_PriceW').val();

       
                     if(InstallCompany) {
                         $.ajax({
                             url: 'InstallCompanyFilter',
                             type:"GET",
                             data:{
                               InstallCompany:InstallCompany,  
                               TotalNet:TotalNet  
                             },
                             dataType:"json",
                             beforeSend: function(){
                                 $('#loader').css("visibility", "visible");
                             },
   
                             success:function(data) {
       
                               $('#ServiceFee').val(data.Fee);  
                               $('#CompanyPrecent').val(data.Prec);  
                               $('#TotalServiceFee').val(data.Tot);  
      
   
   
                             },
                             complete: function(){
                                 $('#loader').css("visibility", "hidden");
                             }
                         });
                     } else {
   
                         $('select[name="state"]').empty();
                     }
       
       
           
   
   }   
</script>
        
          <script type="text/javascript">
        function disableBack() { window.history.forward(); }
        setTimeout("disableBack()", 0);
        window.onunload = function () { null };
    </script>    
        
       <!-- to play audio when click on image -->
       <script>
           
        function play() {
          var audio = document.getElementById("audio");
          audio.play();
        }
      </script>
      <!-- <script src="keyboard/keyboard.js"></script> -->
        
    <?php if($show->Totuch_Screen == 1): ?>    
      <script src="<?php echo e(asset('Admin/keyboard/keyboard-number.js')); ?>"></script>
   <?php endif; ?>
        
    </body>

</html>
<?php /**PATH /Applications/MAMP/htdocs/laravel/ERP/resources/views/admin/Sales/POS.blade.php ENDPATH**/ ?>