vitareinforce

lihat extractSupplierItem

Sep 16th, 2020
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <template v-if="userData.RoleDetails.IsCreateStockInProcurement || userData.RoleDetails.IsUpdateStockInProcurement || userData.RoleDetails.IsReadStockInProcurement">
  2.     <b-tabs pills card>
  3.         <b-tab title="Pengadaan Pusat" active>
  4.             <div class="row">
  5.                 <div v-if="loading" class="col-lg-12 d-flex justify-content-center mb-3">
  6.                     <b-spinner label="Loading..."></b-spinner>
  7.                 </div>
  8.             </div>
  9.             <div class="row">
  10.                 <div class="col-lg-12 button-back-div">
  11.                     <router-link :to="{ name: 'StockInV3Management.index' }" class="btn btn-primary">Kembali</router-link>
  12.                 </div>
  13.             </div>
  14.             <div class="row">
  15.                 <div class="col-lg-6" style="padding-left: 30px; padding-right: 30px;">
  16.                     <div class="row">
  17.                        
  18.                         <!-- Nama Bendera field -->
  19.                         <div class="col-lg-6">
  20.                             <div class="form-group form-float">
  21.                                 <label for="flagName" class="form-label" style="color: black;">Nama Bendera Penerima</label>
  22.                                 <vue-select disabled v-model="selectedLegalEntity" class="vue-select2" name="role" :options="legalEntity" label="Name"></vue-select>
  23.                             </div>
  24.                         </div>
  25.  
  26.                         <!-- Nama Cabang field -->
  27.                         <div class="col-lg-6">
  28.                             <div class="form-group form-float">
  29.                                 <label for="flagName" class="form-label" style="color: black;">Nama Cabang Penerima</label>
  30.                                 <vue-select disabled v-model="selectedBranch" class="vue-select2" name="role" :options="branch" label="Name"></vue-select>
  31.                             </div>
  32.                         </div>
  33.  
  34.                         <!-- Penerima field -->
  35.                         <div class="col-lg-6">
  36.                             <div class="form-group form-float">
  37.                                 <label for="supplierContact" class="form-label" style="color: black;">Pengirim</label>
  38.                                 <input disabled placeholder="Auto generate..." type="text" v-model="stockIn.SenderName" name="SupplierContact" required     class="validate form-control" style="border: 1px solid black;">
  39.                             </div>
  40.                         </div>
  41.  
  42.                         <!-- Penerima field -->
  43.                         <div class="col-lg-6">
  44.                             <div class="form-group form-float">
  45.                                 <label for="supplierContact" class="form-label" style="color: black;">Penerima</label>
  46.                                 <input disabled placeholder="Auto generate..." type="text" v-model="stockIn.ReceiverName" name="SupplierContact" required     class="validate form-control" style="border: 1px solid black;">
  47.                             </div>
  48.                         </div>
  49.  
  50.                         <!-- Tanggal field -->
  51.                         <div class="col-lg-6">
  52.                             <div class="form-group form-float">
  53.                                 <label for="date" class="form-label" style="color: black;">Tanggal</label>
  54.                                 <input disabled placeholder="Auto generate..." type="text" v-model="stockIn.created_at" name="Date" class="validate form-control" style="border: 1px solid black;">
  55.                             </div>
  56.                         </div>
  57.  
  58.                         <!-- Kode Barang Masuk field -->
  59.                         <div class="col-lg-6">
  60.                             <div class="form-group form-float">
  61.                                 <label for="date" class="form-label" style="color: black;">Kode Barang Masuk</label>
  62.                                 <input disabled placeholder="Auto generate..." type="text" v-model="stockIn.Code" required     class="validate form-control" style="border: 1px solid black;">
  63.                             </div>
  64.                         </div>
  65.  
  66.                         <!-- Nama field -->
  67.                         <div class="col-lg-6">
  68.                             <div class="form-group form-float">
  69.                                 <label for="flagName" class="form-label" style="color: black;">Nama</label>
  70.                                 <input :disabled="$route.name.includes('.detail')" class="form-control" name="Name" v-model="stockIn.Name" placeholder="Ketik nama" />
  71.                                 <label v-if="$v.stockIn.Name.$invalid" class="form-label" style="color: red;">*Wajib diisi</label>
  72.                             </div>
  73.                         </div>
  74.  
  75.                         <!-- Nomor Surat Jalan field -->
  76.                         <div class="col-lg-6">
  77.                             <div class="form-group form-float">
  78.                                 <label for="deliveryOrderID" class="form-label" style="color: black;">Nomor Surat Jalan</label>
  79.                                 <input :disabled="!$route.name.includes('.create')" placeholder="Ketik nomor surat jalan..." type="text" v-model="stockIn.DeliveryOrderCode" name="DeliveryOrderID" required     class="validate form-control" style="border: 1px solid black;">
  80.                                 <label v-if="$v.stockIn.DeliveryOrderCode.$invalid" class="form-label" style="color: red;">*Wajib diisi</label>
  81.                             </div>
  82.                         </div>
  83.  
  84.                         <!-- Nomor Receipt field -->
  85.                         <div class="col-lg-6" v-show="userData.RoleDetails.IsReadBuyingPriceStockInProcurement">
  86.                             <div class="form-group form-float">
  87.                                 <label for="deliveryOrderID" class="form-label" style="color: black;">Nomor Faktur</label>
  88.                                 <input :disabled="!$route.name.includes('.create')" placeholder="Ketik nomor faktur..." type="text" v-model="stockIn.ReceiptCode" name="DeliveryOrderID" required     class="validate form-control" style="border: 1px solid black;">
  89.                                 <label v-if="$v.stockIn.ReceiptCode.$invalid" class="form-label" style="color: red;">*Wajib diisi</label>
  90.                             </div>
  91.                         </div>
  92.  
  93.                         <!-- Opsi Pengadaan Field -->
  94.                         <div class="col-lg-6">
  95.                             <div class="form-group form-float">
  96.                                 <label for="carNumber" class="form-label" style="color: black;">Sumber Barang Masuk</label>
  97.                                 <vue-select :disabled="$route.name.includes('.detail')" v-model="stockIn.Properties" class="vue-select2" name="role" :options="properties" label="Name">
  98.                                 </vue-select>
  99.                             </div>
  100.                         </div>
  101.  
  102.                         <div v-if="$route.name.includes('.detail')" class="col-lg-6">
  103.                             <label for="deliveryOrderID" class="form-label" style="color: black;">Unduh Surat Jalan</label>
  104.                             <button @click="downloadSuratJalan()" class="btn btn-primary" style="width: 100%; background-color: #20c197; border: none;"><img src="@/assets/images/file-text.png" alt="Alternate Text" /> Surat Jalan</button>
  105.                         </div>
  106.  
  107.                         <div v-if="$route.name.includes('.detail')" class="col-lg-6">
  108.                             <label for="deliveryOrderID" class="form-label" style="color: black;">Unduh Faktur</label>
  109.                             <button @click="downloadKwitansi()" class="btn btn-primary" style="width: 100%; background-color: #20c197; border: none;"><img src="@/assets/images/file-text.png" alt="Alternate Text" /> Faktur</button>
  110.                         </div>
  111.  
  112.                     </div>
  113.  
  114.                 </div>
  115.                 <div class="col-lg-6" style="padding-left: 30px; padding-right: 30px;">
  116.  
  117.                     <div class="row">
  118.  
  119.                         <div class="col-lg-12">
  120.                             <label>Jika anda mengirimkan barang dengan armada internal, silahkan mengisi form dibawah ini.</label>
  121.                         </div>
  122.  
  123.                         <!-- Nomor Polisi Kendaraan field -->
  124.                         <div class="col-lg-6">
  125.                             <div class="form-group form-float">
  126.                                 <label for="carNumber" class="form-label" style="color: black;">Nomor Polisi Kendaraan (Penerima)</label>
  127.                                 <vue-select :disabled="$route.name.includes('.detail')" v-model="selectedLicensePlateNumberR" class="vue-select2" name="role" :options="JSON.parse(selectedBranch.ListLicencePlateNumber)" label="LicencePlateNumber"></vue-select>
  128.                                 <!-- <input :disabled="$route.name.includes('.detail')" placeholder="Ketik nomor polisi kendaraan..." type="text" v-model="stockIn.LicensePlateNumber" name="CarNumber" required     class="validate form-control" style="border: 1px solid black;"> -->
  129.                             </div>
  130.                         </div>
  131.  
  132.                         <!-- Nomor Polisi Kendaraan field -->
  133.                         <div class="col-lg-6">
  134.                             <div class="form-group form-float">
  135.                                 <label for="carNumber" class="form-label" style="color: black;">Nomor Polisi Kendaraan (Pengirim)</label>
  136.                                 <input :disabled="$route.name.includes('.detail')" placeholder="Ketik nomor polisi kendaraan..." type="text" v-model="stockIn.LicensePlateNumber" name="CarNumber" required     class="validate form-control" style="border: 1px solid black;">
  137.                             </div>
  138.                         </div>
  139.  
  140.                         <!-- Nama Driver field [Gudang Pusat] -->
  141.                         <div class="col-lg-6">
  142.                             <div class="form-group form-float">
  143.                                 <label for="carNumber" class="form-label" style="color: black;">Nama Driver</label>
  144.                                 <vue-select :disabled="$route.name.includes('.detail')" v-model="selectedDriver" class="vue-select2" name="role" :options="employee.filter(x => x.LegalEntityId == userData.LegalEntityId).filter(y => y.BranchId == userData.BranchId)" label="Name">
  145.                                     <template v-slot:option="option">
  146.                                         {{ option.RegistrationNumber }} - {{ option.Name }}
  147.                                     </template>
  148.                                 </vue-select>
  149.                             </div>
  150.                         </div>
  151.  
  152.                         <!-- Nama Helper [Gudang Pusat] -->
  153.                         <div class="col-lg-6">
  154.                             <div class="form-group form-float">
  155.                                 <label for="carNumber" class="form-label" style="color: black;">Nama Co-Driver</label>
  156.                                 <vue-select :disabled="$route.name.includes('.detail')" v-model="selectedCoDriver" class="vue-select2" name="role" :options="employee.filter(x => x.LegalEntityId == userData.LegalEntityId).filter(y => y.BranchId == userData.BranchId)" label="Name">
  157.                                     <template v-slot:option="option">
  158.                                         {{ option.RegistrationNumber }} - {{ option.Name }}
  159.                                     </template>
  160.                                 </vue-select>
  161.                             </div>
  162.                         </div>
  163.  
  164.                     </div>
  165.  
  166.                     <hr/>
  167.  
  168.                     <div class="row">
  169.  
  170.                         <div class="col-lg-12">
  171.                             <label>Jika anda menggunakan jasa ekspedisi, silahkan mengisi form dibawah ini.</label>
  172.                         </div>
  173.  
  174.                         <div class="col-lg-6">
  175.                             <div class="form-group form-float">
  176.                                 <label for="carNumber" class="form-label" style="color: black;">Nama Ekspedisi</label>
  177.                                 <input :disabled="$route.name.includes('.detail')" placeholder="Ketik nama ekspedisi..." v-model="stockIn.ExpeditionName" type="text" name="CarNumber" required class="validate form-control" style="border: 1px solid black;">
  178.                             </div>
  179.                         </div>
  180.  
  181.                         <div class="col-lg-6">
  182.                             <div class="form-group form-float">
  183.                                 <label for="carNumber" class="form-label" style="color: black;">Nomor Resi</label>
  184.                                 <input :disabled="$route.name.includes('.detail')" placeholder="Ketik nomor resi..." v-model="stockIn.ExpeditionReceipt" type="text" name="CarNumber" required class="validate form-control" style="border: 1px solid black;">
  185.                             </div>
  186.                         </div>
  187.  
  188.                     </div>
  189.  
  190.                     <hr/>
  191.  
  192.                     <div class="row">
  193.                         <div class="col-lg-12">
  194.                             <div class="form-group form-float">
  195.                                 <label for="carNumber" class="form-label" style="color: black;">Keterangan</label>
  196.                                 <textarea :disabled="$route.name.includes('.detail')" placeholder="Ketik keterangan..." v-model="stockIn.Description" type="text" name="CarNumber" required class="validate form-control" style="border: 1px solid black;"></textarea>
  197.                             </div>
  198.                         </div>
  199.                     </div>
  200.                 </div>
  201.                 <div style="padding-left: 30px;"><button :disabled="$v.stockIn.DeliveryOrderCode.$invalid || $v.stockIn.Name.$invalid" v-if="$route.name.includes('.create')" @click="tambahBarang()" class="btn btn-primary" style="margin-top: 30px;">Tambah Barang</button></div>
  202.             </div>
  203.  
  204.             <hr />
  205.  
  206.             <div v-if="$route.name.includes('.draft') || $route.name.includes('.edit')">
  207.                 <div class="row">
  208.                     <div class="col-lg-6" style="padding-left: 30px; padding-right: 30px;">
  209.                         <div class="row">
  210.                             <!-- Kode Barang Masuk field -->
  211.                             <div class="col-lg-12">
  212.                                 <div class="form-group form-float">
  213.                                     <label for="date" class="form-label" style="color: black;">Kode Pembelian</label>
  214.                                     <!-- <select class="form-control" v-model="selectedInventory" @change="onChange(selectedInventory)">
  215.                                         <option v-for="option in inventory" :value="inventory" :key="option.id">{{ option.Code }}</option>
  216.                                     </select> -->
  217.                                     <vue-select v-model="selectedInventory" class="vue-select2" name="role" :options="purchase" label="Code">
  218.                                         <template v-slot:option="option">
  219.                                             {{ option.Code }} - {{ option.Name }}
  220.                                         </template>
  221.                                     </vue-select>
  222.                                     <label v-if="$v.selectedInventory.$invalid" class="form-label" style="color: red;">*Wajib dipilih</label>
  223.                                 </div>
  224.                             </div>
  225.  
  226.                             <!-- Nama Barang field -->
  227.                             <div class="col-lg-6" v-if="stockIn.Properties != 'Pemesanan Terjadwal'">
  228.                                 <div class="form-group form-float">
  229.                                     <label for="productName" class="form-label" style="color: black;">Nama Pengadaan</label>
  230.                                     <input disabled placeholder="Auto generate..." type="text" v-model="selectedInventory.Name" name="PengadaanTotal" required     class="validate form-control" style="border: 1px solid black;">
  231.                                 </div>
  232.                             </div>
  233.  
  234.                             <!-- Kode Barang field -->
  235.                             <div class="col-lg-6" v-if="stockIn.Properties != 'Pemesanan Terjadwal'">
  236.                                 <div class="form-group form-float">
  237.                                     <label for="productNumber" class="form-label" style="color: black;">Kode Pengadaan</label>
  238.                                     <input disabled placeholder="Auto generate..." type="text" v-model="selectedInventory.Code" name="ProductName" required     class="validate form-control" style="border: 1px solid black;">
  239.                                 </div>
  240.                             </div>
  241.  
  242.                             <!-- Nama Barang field -->
  243.                             <div class="col-lg-6" v-if="stockIn.Properties != 'Pemesanan Terjadwal'">
  244.                                 <div class="form-group form-float">
  245.                                     <label for="productName" class="form-label" style="color: black;">Nama Barang</label>
  246.                                     <input v-if="selectedInventory.inventory_branch !== undefined" disabled placeholder="Auto generate..." type="text" v-model="selectedInventory.inventory_branch.inventory.Name" name="PengadaanTotal" required     class="validate form-control" style="border: 1px solid black;">
  247.                                     <div v-if="selectedInventory.inventory_branch === undefined" class="form-control disabled-field"></div>
  248.                                 </div>
  249.                             </div>
  250.  
  251.                             <!-- Nama Barang field -->
  252.                             <div class="col-lg-6" v-if="stockIn.Properties == 'Pemesanan Terjadwal'">
  253.                                 <div class="form-group form-float">
  254.                                     <label for="productName" class="form-label" style="color: black;">Nama Barang</label>
  255.                                     <input disabled placeholder="Auto generate..." type="text" v-model="selectedInventory.Name" name="PengadaanTotal" required     class="validate form-control" style="border: 1px solid black;">
  256.                                 </div>
  257.                             </div>
  258.  
  259.                             <!-- Kode Barang field -->
  260.                             <div class="col-lg-6" v-if="stockIn.Properties != 'Pemesanan Terjadwal'">
  261.                                 <div class="form-group form-float">
  262.                                     <label for="productNumber" class="form-label" style="color: black;">Kode Barang</label>
  263.                                     <input v-if="selectedInventory.inventory_branch !== undefined" disabled placeholder="Auto generate..." type="text" v-model="selectedInventory.inventory_branch.inventory.Code" name="ProductName" required     class="validate form-control" style="border: 1px solid black;">
  264.                                     <div v-if="selectedInventory.inventory_branch === undefined" class="form-control disabled-field"></div>
  265.                                 </div>
  266.                             </div>
  267.  
  268.                             <!-- Kode Barang field -->
  269.                             <div class="col-lg-6" v-if="stockIn.Properties == 'Pemesanan Terjadwal'">
  270.                                 <div class="form-group form-float">
  271.                                     <label for="productNumber" class="form-label" style="color: black;">Kode Barang</label>
  272.                                     <input disabled placeholder="Auto generate..." type="text" v-model="selectedInventory.Code" name="ProductName" required     class="validate form-control" style="border: 1px solid black;">
  273.                                 </div>
  274.                             </div>
  275.  
  276.                             <!-- Kategori field -->
  277.                             <div class="col-lg-6">
  278.                                 <div class="form-group form-float">
  279.                                     <label for="category" class="form-label" style="color: black;">Kategori Barang</label>
  280.                                     <input disabled placeholder="Auto generate..." type="text" v-model="selectedInventory.Category" name="Category" required     class="validate form-control" style="border: 1px solid black;">
  281.                                 </div>
  282.                             </div>
  283.  
  284.                             <!-- Perlu dirakit field -->
  285.                             <div class="col-lg-6">
  286.                                 <div class="form-group form-float">
  287.                                     <label for="productName" class="form-label" style="color: black;">Perlu dirakit?</label>
  288.                                     <!-- <select class="form-control" v-model="tmpitem.BundleIsAssembly">
  289.                                         <option value="0">Tidak</option>
  290.                                         <option value="1">Ya</option>
  291.                                     </select> -->
  292.                                     <vue-select v-model="selectedAssembly" class="vue-select2" name="role" :options="isAssembly" label="Name"></vue-select>
  293.                                     <label v-if="$v.selectedAssembly.$invalid" class="form-label" style="color: red;">*Wajib dipilih</label>
  294.                                 </div>
  295.                             </div>
  296.                         </div>
  297.                        
  298.                         <div class="row" v-if="stockIn.Properties != 'Pemesanan Terjadwal'">
  299.                             <!-- Jumlah Kondisi 100% field -->
  300.                             <div class="col-lg-6">
  301.                                 <div class="form-group form-float">
  302.                                     <label for="pengadaanTotal" class="form-label" style="color: black;">Jumlah Kondisi 100%</label>
  303.                                     <div v-if="selectedInventory.inventory_branch !== undefined" class="form-control disabled-field">{{ selectedInventory.Quantity100 | currency({ symbol: '', thousandsSeparator: '.', fractionCount: '', fractionSeparator: '', symbolPosition: '', symbolSpacing: '' }) }}</div>
  304.                                     <div v-if="selectedInventory.inventory_branch === undefined" class="form-control disabled-field"></div>
  305.                                 </div>
  306.                             </div>
  307.  
  308.                             <!-- Harga Beli Kondisi 100% field -->
  309.                             <div class="col-lg-6" v-show="userData.RoleDetails.IsReadBuyingPriceStockInProcurement">
  310.                                 <div class="form-group form-float">
  311.                                     <label v-if="userData.RoleDetails.IsReadBuyingPriceStockInProcurement || userData.RoleDetails.IsUpdateBuyingPriceStockInProcurement" for="pengadaanTotal" class="form-label" style="color: black;">Harga Beli Kondisi 100% (Rp)</label>
  312.                                     <div v-if="(userData.RoleDetails.IsReadBuyingPriceStockInProcurement || userData.RoleDetails.IsUpdateBuyingPriceStockInProcurement) && selectedInventory.inventory_branch !== undefined" class="form-control disabled-field">{{ selectedInventory.inventory_branch.inventory.BuyingPrice100 | currency }}</div>
  313.                                     <div v-if="selectedInventory.inventory_branch === undefined" class="form-control disabled-field"></div>
  314.                                 </div>
  315.                             </div>
  316.  
  317.                             <!-- Jumlah Kondisi 90% field -->
  318.                             <div class="col-lg-6">
  319.                                 <div class="form-group form-float">
  320.                                     <label for="pengadaanTotal" class="form-label" style="color: black;">Jumlah Kondisi 90%</label>
  321.                                     <div v-if="selectedInventory.inventory_branch !== undefined" class="form-control disabled-field">{{ selectedInventory.Quantity90 | currency({ symbol: '', thousandsSeparator: '.', fractionCount: '', fractionSeparator: '', symbolPosition: '', symbolSpacing: '' }) }}</div>
  322.                                     <div v-if="selectedInventory.inventory_branch === undefined" class="form-control disabled-field"></div>
  323.                                 </div>
  324.                             </div>
  325.  
  326.                             <!-- Harga Beli Kondisi 90% field -->
  327.                             <div class="col-lg-6" v-show="userData.RoleDetails.IsReadBuyingPriceStockInProcurement">
  328.                                 <div class="form-group form-float">
  329.                                     <label v-if="userData.RoleDetails.IsReadBuyingPriceStockInProcurement || userData.RoleDetails.IsUpdateBuyingPriceStockInProcurement" for="pengadaanTotal" class="form-label" style="color: black;">Harga Beli Kondisi 90% (Rp)</label>
  330.                                     <div v-if="(userData.RoleDetails.IsReadBuyingPriceStockInProcurement || userData.RoleDetails.IsUpdateBuyingPriceStockInProcurement) && selectedInventory.inventory_branch !== undefined" class="form-control disabled-field">{{ selectedInventory.inventory_branch.inventory.BuyingPrice90 | currency }}</div>
  331.                                     <div v-if="selectedInventory.inventory_branch === undefined" class="form-control disabled-field"></div>
  332.                                 </div>
  333.                             </div>
  334.  
  335.                             <!-- Jumlah Kondisi 60% field -->
  336.                             <div class="col-lg-6">
  337.                                 <div class="form-group form-float">
  338.                                     <label for="pengadaanTotal" class="form-label" style="color: black;">Jumlah Kondisi 60%</label>
  339.                                     <div v-if="selectedInventory.inventory_branch !== undefined" class="form-control disabled-field">{{ selectedInventory.Quantity60 | currency({ symbol: '', thousandsSeparator: '.', fractionCount: '', fractionSeparator: '', symbolPosition: '', symbolSpacing: '' }) }}</div>
  340.                                     <div v-if="selectedInventory.inventory_branch === undefined" class="form-control disabled-field"></div>
  341.                                 </div>
  342.                             </div>
  343.  
  344.                             <!-- Harga Beli Kondisi 60% field -->
  345.                             <div class="col-lg-6" v-show="userData.RoleDetails.IsReadBuyingPriceStockInProcurement">
  346.                                 <div class="form-group form-float">
  347.                                     <label v-if="userData.RoleDetails.IsReadBuyingPriceStockInProcurement || userData.RoleDetails.IsUpdateBuyingPriceStockInProcurement" for="pengadaanTotal" class="form-label" style="color: black;">Harga Beli Kondisi 60% (Rp)</label>
  348.                                     <div v-if="(userData.RoleDetails.IsReadBuyingPriceStockInProcurement || userData.RoleDetails.IsUpdateBuyingPriceStockInProcurement) && selectedInventory.inventory_branch !== undefined" class="form-control disabled-field">{{ selectedInventory.inventory_branch.inventory.BuyingPrice60 | currency }}</div>
  349.                                     <div v-if="selectedInventory.inventory_branch === undefined" class="form-control disabled-field"></div>
  350.                                 </div>
  351.                             </div>
  352.  
  353.                             <!-- Jumlah Kondisi 30% field -->
  354.                             <div class="col-lg-6">
  355.                                 <div class="form-group form-float">
  356.                                     <label for="pengadaanTotal" class="form-label" style="color: black;">Jumlah Kondisi dibawah 30%</label>
  357.                                     <div v-if="selectedInventory.inventory_branch !== undefined" class="form-control disabled-field">{{ selectedInventory.Quantity30 | currency({ symbol: '', thousandsSeparator: '.', fractionCount: '', fractionSeparator: '', symbolPosition: '', symbolSpacing: '' }) }}</div>
  358.                                     <div v-if="selectedInventory.inventory_branch === undefined" class="form-control disabled-field"></div>
  359.                                 </div>
  360.                             </div>
  361.  
  362.                             <!-- Harga Beli Kondisi 60% field -->
  363.                             <div class="col-lg-6" v-show="userData.RoleDetails.IsReadBuyingPriceStockInProcurement">
  364.                                 <div class="form-group form-float">
  365.                                     <label v-if="userData.RoleDetails.IsReadBuyingPriceStockInProcurement || userData.RoleDetails.IsUpdateBuyingPriceStockInProcurement" for="pengadaanTotal" class="form-label" style="color: black;">Harga Beli Kondisi 30% (Rp)</label>
  366.                                     <div v-if="(userData.RoleDetails.IsReadBuyingPriceStockInProcurement || userData.RoleDetails.IsUpdateBuyingPriceStockInProcurement) && selectedInventory.inventory_branch !== undefined" class="form-control disabled-field">{{ selectedInventory.inventory_branch.inventory.BuyingPrice30 | currency }}</div>
  367.                                     <div v-if="selectedInventory.inventory_branch === undefined" class="form-control disabled-field"></div>
  368.                                 </div>
  369.                             </div>
  370.                         </div>
  371.  
  372.                         <div class="row" v-if="stockIn.Properties == 'Pemesanan Terjadwal'">
  373.                             <!-- Jumlah Kondisi 100% field -->
  374.                             <div class="col-lg-6">
  375.                                 <div class="form-group form-float">
  376.                                     <label for="pengadaanTotal" class="form-label" style="color: black;">Jumlah Kondisi 100%</label>
  377.                                     <div class="form-control disabled-field">{{ selectedInventory.AlocationQuantity | currency({ symbol: '', thousandsSeparator: '.', fractionCount: '', fractionSeparator: '', symbolPosition: '', symbolSpacing: '' }) }}</div>
  378.                                 </div>
  379.                             </div>
  380.  
  381.                             <!-- Harga Beli Kondisi 100% field -->
  382.                             <div class="col-lg-6" v-show="userData.RoleDetails.IsReadBuyingPriceStockInProcurement">
  383.                                 <div class="form-group form-float">
  384.                                     <label v-if="userData.RoleDetails.IsReadBuyingPriceStockInProcurement || userData.RoleDetails.IsUpdateBuyingPriceStockInProcurement" for="pengadaanTotal" class="form-label" style="color: black;">Harga Beli Kondisi 100% (Rp)</label>
  385.                                     <div v-if="(userData.RoleDetails.IsReadBuyingPriceStockInProcurement || userData.RoleDetails.IsUpdateBuyingPriceStockInProcurement)" class="form-control disabled-field">{{ selectedInventory.BuyingPrice100 | currency }}</div>
  386.                                 </div>
  387.                             </div>
  388.  
  389.                             <!-- Jumlah Kondisi 90% field -->
  390.                             <div class="col-lg-6">
  391.                                 <div class="form-group form-float">
  392.                                     <label for="pengadaanTotal" class="form-label" style="color: black;">Jumlah Kondisi 90%</label>
  393.                                     <div class="form-control disabled-field">{{ selectedInventory.Quantity90 | currency({ symbol: '', thousandsSeparator: '.', fractionCount: '', fractionSeparator: '', symbolPosition: '', symbolSpacing: '' }) }}</div>
  394.                                 </div>
  395.                             </div>
  396.  
  397.                             <!-- Harga Beli Kondisi 90% field -->
  398.                             <div class="col-lg-6" v-show="userData.RoleDetails.IsReadBuyingPriceStockInProcurement">
  399.                                 <div class="form-group form-float">
  400.                                     <label v-if="userData.RoleDetails.IsReadBuyingPriceStockInProcurement || userData.RoleDetails.IsUpdateBuyingPriceStockInProcurement" for="pengadaanTotal" class="form-label" style="color: black;">Harga Beli Kondisi 90% (Rp)</label>
  401.                                     <div v-if="(userData.RoleDetails.IsReadBuyingPriceStockInProcurement || userData.RoleDetails.IsUpdateBuyingPriceStockInProcurement) " class="form-control disabled-field">{{ selectedInventory.BuyingPrice90 | currency }}</div>
  402.                                 </div>
  403.                             </div>
  404.  
  405.                             <!-- Jumlah Kondisi 60% field -->
  406.                             <div class="col-lg-6">
  407.                                 <div class="form-group form-float">
  408.                                     <label for="pengadaanTotal" class="form-label" style="color: black;">Jumlah Kondisi 60%</label>
  409.                                     <div class="form-control disabled-field">{{ selectedInventory.Quantity60 | currency({ symbol: '', thousandsSeparator: '.', fractionCount: '', fractionSeparator: '', symbolPosition: '', symbolSpacing: '' }) }}</div>
  410.                                 </div>
  411.                             </div>
  412.  
  413.                             <!-- Harga Beli Kondisi 60% field -->
  414.                             <div class="col-lg-6" v-show="userData.RoleDetails.IsReadBuyingPriceStockInProcurement">
  415.                                 <div class="form-group form-float">
  416.                                     <label v-if="userData.RoleDetails.IsReadBuyingPriceStockInProcurement || userData.RoleDetails.IsUpdateBuyingPriceStockInProcurement" for="pengadaanTotal" class="form-label" style="color: black;">Harga Beli Kondisi 60% (Rp)</label>
  417.                                     <div v-if="(userData.RoleDetails.IsReadBuyingPriceStockInProcurement || userData.RoleDetails.IsUpdateBuyingPriceStockInProcurement)" class="form-control disabled-field">{{ selectedInventory.BuyingPrice60 | currency }}</div>
  418.                                 </div>
  419.                             </div>
  420.  
  421.                             <!-- Jumlah Kondisi 30% field -->
  422.                             <div class="col-lg-6">
  423.                                 <div class="form-group form-float">
  424.                                     <label for="pengadaanTotal" class="form-label" style="color: black;">Jumlah Kondisi dibawah 30%</label>
  425.                                     <div class="form-control disabled-field">{{ selectedInventory.Quantity30 | currency({ symbol: '', thousandsSeparator: '.', fractionCount: '', fractionSeparator: '', symbolPosition: '', symbolSpacing: '' }) }}</div>
  426.                                 </div>
  427.                             </div>
  428.  
  429.                             <!-- Harga Beli Kondisi 60% field -->
  430.                             <div class="col-lg-6" v-show="userData.RoleDetails.IsReadBuyingPriceStockInProcurement">
  431.                                 <div class="form-group form-float">
  432.                                     <label v-if="userData.RoleDetails.IsReadBuyingPriceStockInProcurement || userData.RoleDetails.IsUpdateBuyingPriceStockInProcurement" for="pengadaanTotal" class="form-label" style="color: black;">Harga Beli Kondisi 30% (Rp)</label>
  433.                                     <div v-if="(userData.RoleDetails.IsReadBuyingPriceStockInProcurement || userData.RoleDetails.IsUpdateBuyingPriceStockInProcurement)" class="form-control disabled-field">{{ selectedInventory.BuyingPrice30 | currency }}</div>
  434.                                 </div>
  435.                             </div>
  436.                         </div>
  437.                     </div>
  438.                     <div class="col-lg-6" style="padding-left: 30px; padding-right: 30px;">
  439.                         <div class="row">
  440.                             <!-- Jumlah Pengadaan field -->
  441.                             <div class="col-lg-12">
  442.                                 <div class="form-group form-float">
  443.                                     <label for="pengadaanTotal" class="form-label" style="color: black;">Jumlah Seluruh Pengadaan</label>
  444.                                     <div class="form-control disabled-field">{{ stockIn.ItemQuantity | currency({ symbol: '', thousandsSeparator: '.', fractionCount: '', fractionSeparator: '', symbolPosition: '', symbolSpacing: '' }) }}</div>
  445.                                 </div>
  446.                             </div>
  447.                         </div>
  448.                         <div class="row" v-show="userData.RoleDetails.IsReadBuyingPriceStockInProcurement">
  449.                             <!-- Jenis Pembayaran field -->
  450.                             <div class="col-lg-6">
  451.                                 <div class="form-group form-float">
  452.                                     <label for="productName" class="form-label" style="color: black;">Jenis Pembayaran</label>
  453.                                     <div class="form-group form-float">
  454.                                         <vue-select :disabled="$route.name.includes('.detail')" v-model="stockIn.PaymentStatus" class="vue-select2" name="role" :options="paymentStatus" label="Name"></vue-select>
  455.                                     </div>
  456.                                 </div>
  457.                             </div>
  458.  
  459.                             <!-- Total Pembayaran field -->
  460.                             <div class="col-lg-6">
  461.                                 <div class="form-group form-float">
  462.                                     <label for="pengadaanTotal" class="form-label" style="color: black;">Total Harga Pengadaan (Rp)</label>
  463.                                     <div class="form-control disabled-field">{{ stockIn.Total | currency }}</div>
  464.                                 </div>
  465.                             </div>
  466.  
  467.                             <!-- Nominal Pembayaran field -->
  468.                             <div class="col-lg-6">
  469.                                 <div class="form-group form-float">
  470.                                     <label for="pengadaanTotal" class="form-label" style="color: black;">Nominal Pembayaran Pengadaan (Rp)</label>
  471.                                     <money v-if="!$route.name.includes('.detail')" placeholder="Ketik nominal pembayaran..." type="text" v-model="stockIn.Nominal" class="validate form-control" style="border: 1px solid black;"></money>
  472.                                     <div v-if="$route.name.includes('.detail')" class="form-control disabled-field">{{ stockIn.Nominal | currency }}</div>
  473.                                 </div>
  474.                             </div>
  475.  
  476.                             <!-- Sisa Pembayaran field -->
  477.                             <div class="col-lg-6">
  478.                                 <div class="form-group form-float">
  479.                                     <label for="pengadaanTotal" class="form-label" style="color: black;">Sisa Pembayaran Pengadaan (Rp)</label>
  480.                                     <div class="form-control disabled-field">{{ stockIn.Sisa | currency }}</div>
  481.                                 </div>
  482.                             </div>
  483.                         </div>
  484.                         <hr/>
  485.                         <div class="row" v-if="!$route.name.includes('.detail')">
  486.                             <label style="padding-left: 15px;">Tipe file foto adalah <b>.jpeg/.jpg/.png</b> dan ukuran maksimal foto adalah <b>4 MB</b></label>
  487.                         </div>
  488.                         <div class="row">
  489.                             <label class="form-label" style="color: black; margin-bottom: 15px; margin-left: 15px;">Lampiran</label>
  490.                         </div>
  491.                         <div class="row">
  492.                             <!-- Lampiran 1 -->
  493.                             <div class="col-lg-6">
  494.                                 <img v-if="$route.name.includes('.detail')" :src="'data:image/jpeg;base64,' + stockIn.Picture1" class="img-fluid img-thumbnail" />
  495.                                 <base64-upload v-if="!$route.name.includes('.detail')" class="img-fluid img-thumbnail" imageSrc="/img/uploads.png" @change="changeImage1">Upload photo</base64-upload>
  496.                             </div>
  497.                             <!-- Lampiran 2 -->
  498.                             <div class="col-lg-6">
  499.                                 <img v-if="$route.name.includes('.detail')" :src="'data:image/jpeg;base64,' + stockIn.Picture2" class="img-fluid img-thumbnail" />
  500.                                 <base64-upload v-if="!$route.name.includes('.detail')" class="img-fluid img-thumbnail" imageSrc="/img/uploads.png" @change="changeImage2">Upload photo</base64-upload>                        
  501.                             </div>
  502.                         </div>
  503.                         <div class="row">
  504.                             <!-- Lampiran 3 -->
  505.                             <div class="col-lg-6">
  506.                                 <img v-if="$route.name.includes('.detail')" :src="'data:image/jpeg;base64,' + stockIn.Picture3" class="img-fluid img-thumbnail" />
  507.                                 <base64-upload v-if="!$route.name.includes('.detail')" class="img-fluid img-thumbnail" imageSrc="/img/uploads.png" @change="changeImage3">Upload photo</base64-upload>
  508.                             </div>
  509.                             <!-- Lampiran 4 -->
  510.                             <div class="col-lg-6">
  511.                                 <img v-if="$route.name.includes('.detail')" :src="'data:image/jpeg;base64,' + stockIn.Picture4" class="img-fluid img-thumbnail" />
  512.                                 <base64-upload v-if="!$route.name.includes('.detail')" class="img-fluid img-thumbnail" imageSrc="/img/uploads.png" @change="changeImage4">Upload photo</base64-upload>
  513.                             </div>
  514.                         </div>
  515.                        
  516.                     </div>
  517.                 </div>
  518.  
  519.                 <div class="row" v-if="$route.name.includes('.draft') || $route.name.includes('.edit')">
  520.                     <div class="col-lg-2" style="padding-left: 30px; margin-bottom: 30px;">
  521.                         <button :disabled="$v.selectedInventory.$invalid || $v.selectedAssembly.$invalid" @click="tambah" type="submit" class="btn waves-effect add-btn" style="width: 100%; background-color: #20c197; color: white; margin-top: 30px;">
  522.                             Tambah
  523.                         </button>
  524.                     </div>
  525.                 </div>
  526.                        
  527.             </div>
  528.  
  529.             <div v-if="$route.name.includes('.detail')">
  530.                 <div class="row">
  531.                     <div class="col-lg-6" style="padding-left: 30px; padding-right: 30px;">
  532.                         <div class="row">
  533.                             <!-- Jumlah Pengadaan field -->
  534.                             <div class="col-lg-12">
  535.                                 <div class="form-group form-float">
  536.                                     <label for="pengadaanTotal" class="form-label" style="color: black;">Jumlah Seluruh Pengadaan</label>
  537.                                     <div class="form-control disabled-field">{{ stockIn.ItemQuantity | currency({ symbol: '', thousandsSeparator: '.', fractionCount: '', fractionSeparator: '', symbolPosition: '', symbolSpacing: '' }) }}</div>
  538.                                 </div>
  539.                             </div>
  540.                         </div>
  541.                         <div class="row">
  542.                             <!-- Jenis Pembayaran field -->
  543.                             <div class="col-lg-6">
  544.                                 <div class="form-group form-float">
  545.                                     <label for="productName" class="form-label" style="color: black;">Jenis Pembayaran</label>
  546.                                     <div class="form-group form-float">
  547.                                         <vue-select v-model="stockIn.PaymentStatus" :disabled="$route.name.includes('.detail')" class="vue-select2" name="role" :options="paymentStatus" label="Name"></vue-select>
  548.                                     </div>
  549.                                 </div>
  550.                             </div>
  551.  
  552.                             <!-- Total Pembayaran field -->
  553.                             <div class="col-lg-6">
  554.                                 <div class="form-group form-float">
  555.                                     <label for="pengadaanTotal" class="form-label" style="color: black;">Total Harga Pengadaan (Rp)</label>
  556.                                     <div class="form-control disabled-field">{{ stockIn.Total | currency }}</div>
  557.                                 </div>
  558.                             </div>
  559.  
  560.                             <!-- Nominal Pembayaran field -->
  561.                             <div class="col-lg-6">
  562.                                 <div class="form-group form-float">
  563.                                     <label for="pengadaanTotal" class="form-label" style="color: black;">Nominal Pembayaran Pengadaan (Rp)</label>
  564.                                     <money v-if="!$route.name.includes('.detail')" placeholder="Ketik nominal pembayaran..." type="text" v-model="stockIn.Nominal" class="validate form-control" style="border: 1px solid black;"></money>
  565.                                     <div v-if="$route.name.includes('.detail')" class="form-control disabled-field">{{ stockIn.Nominal | currency }}</div>
  566.                                 </div>
  567.                             </div>
  568.  
  569.                             <!-- Sisa Pembayaran field -->
  570.                             <div class="col-lg-6">
  571.                                 <div class="form-group form-float">
  572.                                     <label for="pengadaanTotal" class="form-label" style="color: black;">Sisa Pembayaran Pengadaan (Rp)</label>
  573.                                     <div class="form-control disabled-field">{{ stockIn.Sisa | currency }}</div>
  574.                                 </div>
  575.                             </div>
  576.                         </div>
  577.                        
  578.                     </div>
  579.  
  580.                     <div class="col-lg-6" style="padding-left: 30px; padding-right: 30px;">
  581.                         <div class="row">
  582.                             <label class="form-label" style="color: black; margin-bottom: 15px; margin-left: 15px;">Lampiran</label>
  583.                         </div>
  584.                         <div class="row">
  585.                             <!-- Lampiran 1 -->
  586.                             <div class="col-lg-6">
  587.                                 <img v-if="$route.name.includes('.detail')" :src="'data:image/jpeg;base64,' + stockIn.Picture1" class="img-fluid img-thumbnail" />
  588.                                 <base64-upload v-if="!$route.name.includes('.detail')" class="img-fluid img-thumbnail" imageSrc="/img/uploads.png" @change="changeImage1">Upload photo</base64-upload>
  589.                             </div>
  590.                             <!-- Lampiran 2 -->
  591.                             <div class="col-lg-6">
  592.                                 <img v-if="$route.name.includes('.detail')" :src="'data:image/jpeg;base64,' + stockIn.Picture2" class="img-fluid img-thumbnail" />
  593.                                 <base64-upload v-if="!$route.name.includes('.detail')" class="img-fluid img-thumbnail" imageSrc="/img/uploads.png" @change="changeImage2">Upload photo</base64-upload>                        
  594.                             </div>
  595.                         </div>
  596.                         <div class="row">
  597.                             <!-- Lampiran 3 -->
  598.                             <div class="col-lg-6">
  599.                                 <img v-if="$route.name.includes('.detail')" :src="'data:image/jpeg;base64,' + stockIn.Picture3" class="img-fluid img-thumbnail" />
  600.                                 <base64-upload v-if="!$route.name.includes('.detail')" class="img-fluid img-thumbnail" imageSrc="/img/uploads.png" @change="changeImage3">Upload photo</base64-upload>
  601.                             </div>
  602.                             <!-- Lampiran 4 -->
  603.                             <div class="col-lg-6">
  604.                                 <img v-if="$route.name.includes('.detail')" :src="'data:image/jpeg;base64,' + stockIn.Picture4" class="img-fluid img-thumbnail" />
  605.                                 <base64-upload v-if="!$route.name.includes('.detail')" class="img-fluid img-thumbnail" imageSrc="/img/uploads.png" @change="changeImage4">Upload photo</base64-upload>
  606.                             </div>
  607.                         </div>
  608.                     </div>
  609.                 </div>
  610.             </div>
  611.  
  612.             <hr v-if="$route.name.includes('.edit') || $route.name.includes('.draft') || $route.name.includes('.detail')"/>
  613.  
  614.             <div class="row" v-if="!$route.name.includes('.create')">
  615.                 <!-- List Appendable Item -->
  616.                 <div class="col-lg-12" style="padding-left: 30px;">
  617.                     <h5>Data Barang</h5>
  618.                 </div>
  619.  
  620.                 <div class="col-lg-12">
  621.                     <div class="table-div-append">
  622.                         <b-table striped hover
  623.                             id="stockInItemCollection"
  624.                             :items="itemdetails"
  625.                             :fields="itemCollectionField"
  626.                             class="table table-hover table-striped"
  627.                             style="margin-top: 10px;">
  628.                             <template v-if="!$route.name.includes('.detail')" v-slot:cell(Delete)="data">
  629.                                 <button class="btn btn-danger" v-if="!$route.name.includes('.detail')" @click="hapus(data.item.Id, data.item)"><span><i class="fa fa-times"></i></span></button>
  630.                             </template>
  631.                             <template v-slot:cell(ItemCode)="data">
  632.                                 <span v-if="stockIn.Properties != 'Pemesanan Terjadwal'">{{ data.item.inventory_branch.inventory.Code}}</span>
  633.                                 <span v-if="stockIn.Properties == 'Pemesanan Terjadwal'">{{ data.item.Code}}</span>
  634.                             </template>
  635.                             <template v-slot:cell(SupplierId)="data">
  636.                                 <label v-if="data.item.SupplierId">{{ supplier[data.item.SupplierId].Name }}</label>
  637.                             </template>
  638.                             <template v-slot:cell(IsAssembly)="data">
  639.                                 <label v-if="data.item.IsAssembly == 1">Ya</label>
  640.                                 <label v-if="data.item.IsAssembly == 0">Tidak</label>
  641.                             </template>
  642.                             <template v-if="userData.RoleDetails.IsReadBuyingPriceStockInProcurement || userData.RoleDetails.IsUpdateBuyingPriceStockInProcurement" v-slot:cell(Price100)="data">
  643.                                 {{ data.item.Price100 | currency }}
  644.                             </template>
  645.                             <template v-if="userData.RoleDetails.IsReadBuyingPriceStockInProcurement || userData.RoleDetails.IsUpdateBuyingPriceStockInProcurement" v-slot:cell(Price90)="data">
  646.                                 {{ data.item.Price90 | currency }}
  647.                             </template>
  648.                             <template v-if="userData.RoleDetails.IsReadBuyingPriceStockInProcurement || userData.RoleDetails.IsUpdateBuyingPriceStockInProcurement" v-slot:cell(Price60)="data">
  649.                                 {{ data.item.Price60 | currency }}
  650.                             </template>
  651.                             <template v-if="userData.RoleDetails.IsReadBuyingPriceStockInProcurement || userData.RoleDetails.IsUpdateBuyingPriceStockInProcurement" v-slot:cell(Price30)="data">
  652.                                 {{ data.item.Price30 | currency }}
  653.                             </template>
  654.                             <template v-slot:cell(Quantity100)="data">
  655.                                 {{ data.item.Quantity100 | currency({ symbol: '', thousandsSeparator: '.', fractionCount: '', fractionSeparator: '', symbolPosition: '', symbolSpacing: '' }) }}
  656.                             </template>
  657.                             <template v-slot:cell(Quantity90)="data">
  658.                                 {{ data.item.Quantity90 | currency({ symbol: '', thousandsSeparator: '.', fractionCount: '', fractionSeparator: '', symbolPosition: '', symbolSpacing: '' }) }}
  659.                             </template>
  660.                             <template v-slot:cell(Quantity60)="data">
  661.                                 {{ data.item.Quantity60 | currency({ symbol: '', thousandsSeparator: '.', fractionCount: '', fractionSeparator: '', symbolPosition: '', symbolSpacing: '' }) }}
  662.                             </template>
  663.                             <template v-slot:cell(Quantity30)="data">
  664.                                 {{ data.item.Quantity30 | currency({ symbol: '', thousandsSeparator: '.', fractionCount: '', fractionSeparator: '', symbolPosition: '', symbolSpacing: '' }) }}
  665.                             </template>
  666.                             <template v-slot:cell(TotalQuantity)="data">
  667.                                 {{ data.item.TotalQuantity | currency({ symbol: '', thousandsSeparator: '.', fractionCount: '', fractionSeparator: '', symbolPosition: '', symbolSpacing: '' }) }}
  668.                             </template>
  669.                         </b-table>
  670.                     </div>
  671.                 </div>
  672.  
  673.                 <div class="col-lg-12" style="display: none;">
  674.                     <div class="table-div-append">
  675.                         <b-table striped hover
  676.                             id="stockInDeliveryOrder"
  677.                             :items="itemdetails"
  678.                             :fields="deliveryOrderField"
  679.                             class="table table-hover table-striped"
  680.                             style="margin-top: 10px;">
  681.                             <template v-if="$route.name.includes('.detail')" v-slot:cell(Delete)="data">
  682.                                 <button class="btn btn-danger" v-if="!$route.name.includes('.detail')" @click="hapus(data.item.Id, data.item)"><span><i class="fa fa-times"></i></span></button>
  683.                             </template>
  684.                             <template v-slot:cell(ItemCode)="data">
  685.                                 {{ data.item.inventory_branch.inventory.Code}}
  686.                             </template>
  687.                             <template v-slot:cell(SupplierId)="data">
  688.                                 <label v-if="data.item.SupplierId">{{ supplier[data.item.SupplierId].Name }}</label>
  689.                             </template>
  690.                             <template v-slot:cell(IsAssembly)="data">
  691.                                 <label v-if="data.item.IsAssembly == 1">Ya</label>
  692.                                 <label v-if="data.item.IsAssembly == 0">Tidak</label>
  693.                             </template>
  694.                             <template v-if="userData.RoleDetails.IsReadBuyingPriceStockInProcurement || userData.RoleDetails.IsUpdateBuyingPriceStockInProcurement" v-slot:cell(Price100)="data">
  695.                                 {{ data.item.Price100 | currency }}
  696.                             </template>
  697.                             <template v-if="userData.RoleDetails.IsReadBuyingPriceStockInProcurement || userData.RoleDetails.IsUpdateBuyingPriceStockInProcurement" v-slot:cell(Price90)="data">
  698.                                 {{ data.item.Price90 | currency }}
  699.                             </template>
  700.                             <template v-if="userData.RoleDetails.IsReadBuyingPriceStockInProcurement || userData.RoleDetails.IsUpdateBuyingPriceStockInProcurement" v-slot:cell(Price60)="data">
  701.                                 {{ data.item.Price60 | currency }}
  702.                             </template>
  703.                             <template v-if="userData.RoleDetails.IsReadBuyingPriceStockInProcurement || userData.RoleDetails.IsUpdateBuyingPriceStockInProcurement" v-slot:cell(Price30)="data">
  704.                                 {{ data.item.Price30 | currency }}
  705.                             </template>
  706.                             <template v-slot:cell(Quantity100)="data">
  707.                                 {{ data.item.Quantity100 | currency({ symbol: '', thousandsSeparator: '.', fractionCount: '', fractionSeparator: '', symbolPosition: '', symbolSpacing: '' }) }}
  708.                             </template>
  709.                             <template v-slot:cell(Quantity90)="data">
  710.                                 {{ data.item.Quantity90 | currency({ symbol: '', thousandsSeparator: '.', fractionCount: '', fractionSeparator: '', symbolPosition: '', symbolSpacing: '' }) }}
  711.                             </template>
  712.                             <template v-slot:cell(Quantity60)="data">
  713.                                 {{ data.item.Quantity60 | currency({ symbol: '', thousandsSeparator: '.', fractionCount: '', fractionSeparator: '', symbolPosition: '', symbolSpacing: '' }) }}
  714.                             </template>
  715.                             <template v-slot:cell(Quantity30)="data">
  716.                                 {{ data.item.Quantity30 | currency({ symbol: '', thousandsSeparator: '.', fractionCount: '', fractionSeparator: '', symbolPosition: '', symbolSpacing: '' }) }}
  717.                             </template>
  718.                             <template v-slot:cell(TotalQuantity)="data">
  719.                                 {{ data.item.TotalQuantity | currency({ symbol: '', thousandsSeparator: '.', fractionCount: '', fractionSeparator: '', symbolPosition: '', symbolSpacing: '' }) }}
  720.                             </template>
  721.                         </b-table>
  722.                     </div>
  723.                 </div>
  724.  
  725.                 <div class="col-lg-12" style="display: none">
  726.                     <div class="table-div-append">
  727.                         <b-table striped hover
  728.                             id="stockInReceipt"
  729.                             :items="itemdetails"
  730.                             :fields="receiptField"
  731.                             class="table table-hover table-striped"
  732.                             style="margin-top: 10px;">
  733.                             <template v-if="$route.name.includes('.detail')" v-slot:cell(Delete)="data">
  734.                                 <button class="btn btn-danger" v-if="!$route.name.includes('.detail')" @click="hapus(data.item.Id, data.item)"><span><i class="fa fa-times"></i></span></button>
  735.                             </template>
  736.                             <template v-slot:cell(ItemCode)="data">
  737.                                 {{ data.item.inventory_branch.inventory.Code}}
  738.                             </template>
  739.                             <template v-slot:cell(SupplierId)="data">
  740.                                 <label v-if="data.item.SupplierId">{{ supplier[data.item.SupplierId].Name }}</label>
  741.                             </template>
  742.                             <template v-slot:cell(IsAssembly)="data">
  743.                                 <label v-if="data.item.IsAssembly == 1">Ya</label>
  744.                                 <label v-if="data.item.IsAssembly == 0">Tidak</label>
  745.                             </template>
  746.                             <template v-if="userData.RoleDetails.IsReadBuyingPriceStockInProcurement || userData.RoleDetails.IsUpdateBuyingPriceStockInProcurement" v-slot:cell(Price100)="data">
  747.                                 {{ data.item.Price100 | currency }}
  748.                             </template>
  749.                             <template v-if="userData.RoleDetails.IsReadBuyingPriceStockInProcurement || userData.RoleDetails.IsUpdateBuyingPriceStockInProcurement" v-slot:cell(Price90)="data">
  750.                                 {{ data.item.Price90 | currency }}
  751.                             </template>
  752.                             <template v-if="userData.RoleDetails.IsReadBuyingPriceStockInProcurement || userData.RoleDetails.IsUpdateBuyingPriceStockInProcurement" v-slot:cell(Price60)="data">
  753.                                 {{ data.item.Price60 | currency }}
  754.                             </template>
  755.                             <template v-if="userData.RoleDetails.IsReadBuyingPriceStockInProcurement || userData.RoleDetails.IsUpdateBuyingPriceStockInProcurement" v-slot:cell(Price30)="data">
  756.                                 {{ data.item.Price30 | currency }}
  757.                             </template>
  758.                             <template v-slot:cell(Quantity100)="data">
  759.                                 {{ data.item.Quantity100 | currency({ symbol: '', thousandsSeparator: '.', fractionCount: '', fractionSeparator: '', symbolPosition: '', symbolSpacing: '' }) }}
  760.                             </template>
  761.                             <template v-slot:cell(Quantity90)="data">
  762.                                 {{ data.item.Quantity90 | currency({ symbol: '', thousandsSeparator: '.', fractionCount: '', fractionSeparator: '', symbolPosition: '', symbolSpacing: '' }) }}
  763.                             </template>
  764.                             <template v-slot:cell(Quantity60)="data">
  765.                                 {{ data.item.Quantity60 | currency({ symbol: '', thousandsSeparator: '.', fractionCount: '', fractionSeparator: '', symbolPosition: '', symbolSpacing: '' }) }}
  766.                             </template>
  767.                             <template v-slot:cell(Quantity30)="data">
  768.                                 {{ data.item.Quantity30 | currency({ symbol: '', thousandsSeparator: '.', fractionCount: '', fractionSeparator: '', symbolPosition: '', symbolSpacing: '' }) }}
  769.                             </template>
  770.                             <template v-slot:cell(TotalQuantity)="data">
  771.                                 {{ data.item.TotalQuantity | currency({ symbol: '', thousandsSeparator: '.', fractionCount: '', fractionSeparator: '', symbolPosition: '', symbolSpacing: '' }) }}
  772.                             </template>
  773.                         </b-table>
  774.                     </div>
  775.                 </div>
  776.             </div>
  777.  
  778.             <div v-if="$route.name.includes('.edit')" class="row">
  779.                 <div class="col-lg-12 button-div">
  780.                     <button :disabled="itemdetails.length == 0" v-on:click="save()" class="btn btn-success">Simpan</button>
  781.                     <router-link :to="{ name: 'StockInV3Management.index' }" class="btn btn-default">Batal</router-link>
  782.                 </div>
  783.             </div>
  784.  
  785.             <div v-if="$route.name.includes('.draft')" class="row">
  786.                 <div class="col-lg-12 button-div">
  787.                     <button :disabled="itemdetails.length == 0" v-on:click="saveDraft()" class="btn btn-success">Simpan</button>
  788.                     <router-link :to="{ name: 'StockInV3Management.index' }" class="btn btn-default">Batal</router-link>
  789.                 </div>
  790.             </div>
  791.         </b-tab>
  792.     </b-tabs>
  793. </template>
  794.  
  795. <style>
  796. .table-div-append {
  797.     height: 100%;
  798.     padding-left: 15px;
  799.     margin-left: 0px !important;
  800.     overflow-x: auto;
  801.     overflow-y: auto;
  802. }
  803.  
  804. .card-header {
  805.     width: 1620px;
  806.     background-color: #20c197;
  807.     border-radius: 0px !important;
  808.     padding-left: 10px;
  809.     padding-top: 0px;
  810.     padding-right: 0px;
  811.     padding-bottom: 0px;
  812. }
  813.  
  814. .nav-pills .nav-link.active, .nav-pills .show>.nav-link {
  815.     color: black;
  816.     background-color: #f8f8ff;
  817.     border-radius: 0px;
  818.     border-bottom: 3px solid #0059aa;
  819. }
  820.  
  821. .button-div {
  822.     text-align: right;
  823.     margin-top: 30px;
  824. }
  825.  
  826. .btn-success {
  827.     width: 132px;
  828.     background-color: #20c197;
  829.     border: none;
  830. }
  831.  
  832. .btn-danger {
  833.     width: 132px;
  834.     margin-left: 15px;
  835.     border: none;
  836. }
  837. </style>
  838.  
  839.  
  840. <script>
  841. import moment from 'moment'
  842. import $ from 'jquery'
  843. // import VueNumeric from 'vue-numeric'
  844.  
  845. import Inventories from '@/services/Inventories/Inventory'
  846. import Supplier from '@/services/Inventories/Supplier'
  847. import Purchases from '@/services/Transactions/Purchases'
  848. import LegalEntities from '@/services/Companies/LegalEntities'
  849. import Branches from '@/services/Companies/Branches'
  850. import StockIn from '@/services/Inventories/StockInV3'
  851. import ItemDetails from '@/services/Inventories/ItemDetails'
  852. // import Bill from '@/services/Accounting/BillV2'
  853. import Bundles from '@/services/Inventories/Bundle'
  854. import OrderPlans from '@/services/Inventories/OrderPlan'
  855. import Employees from '@/services/Employees/Employees'
  856. import VueSelect from 'vue-select'
  857. import 'vue-select/dist/vue-select.css'
  858. import Base64Upload from 'vue-base64-upload'
  859. import jsPDF from 'jspdf'
  860. import 'jspdf-autotable'
  861. import { required } from 'vuelidate/lib/validators'
  862.  
  863. export default {
  864.   name: 'StockInCPV3Management.create',
  865.   components: {
  866.     VueSelect,
  867.     // VueNumeric,
  868.     Base64Upload
  869.   },
  870.   data () {
  871.     return {
  872.         //Loading
  873.         loading: true,
  874.         exportData: [],
  875.         userData: {},
  876.         employee: [],
  877.         orderPlan: [],
  878.         properties: ['Pembelian oleh Admin', 'Pemesanan Terjadwal'],
  879.         selectedDriver: {},
  880.         selectedCoDriver: {},
  881.         selectedEmployee: {},
  882.         selectedLegalEntity: {},
  883.         selectedPurchaseCode: [],
  884.         selectedBranch: {},
  885.         selectedSupplier: {},
  886.         selectedInventory: [],
  887.         selectedAssembly: {},
  888.         selectedLicensePlateNumber: {},
  889.         selectedLicensePlateNumberR: {},
  890.         paymentStatus: ['Lunas','Kredit','Pembayaran Ditunda'],
  891.         isAssembly: ['Ya','Tidak'],
  892.         inventory: [],
  893.         inventoryLookup: [],
  894.         purchase: [],
  895.         supplier: [],
  896.         legalEntity: [],
  897.         branch: [],
  898.         adding: false,
  899.         itemdetails: {},
  900.         item: {},
  901.         stockIn: {
  902.             Total: 0,
  903.             Nominal: 0,
  904.             Sisa: 0,
  905.             ItemQuantity: 0,
  906.             ItemCollection: []
  907.         },
  908.         itemCollectionField: [
  909.             { key: 'Id', label: 'Id', sortable: true },
  910.             { key: 'Code', label: 'Kode', sortable: true },
  911.             { key: 'ItemCode', label: 'Kode Barang', sortable: true },
  912.             { key: 'Name', label: 'Nama', sortable: true },
  913.             { key: 'Category', label: 'Kategori', sortable: true },
  914.             { key: 'SupplierId', label: 'Supplier', sortable: true },
  915.             { key: 'IsAssembly', label: 'Perlu Dirakit', sortable: true },
  916.             { key: 'TotalQuantity', label: 'Jumlah Keseluruhan', sortable: true },
  917.             { key: 'Quantity100', label: 'Jumlah 100%', sortable: true },
  918.             { key: 'Price100', label: 'Harga Beli Kondisi 100%', sortable: true },
  919.             { key: 'Quantity90', label: 'Jumlah Barang Kondisi 90%', sortable: true },
  920.             { key: 'Price90', label: 'Harga Beli Kondisi 90%', sortable: true },
  921.             { key: 'Quantity60', label: 'Jumlah Barang Kondisi 60%', sortable: true },
  922.             { key: 'Price60', label: 'Harga Beli Kondisi 60%', sortable: true },
  923.             { key: 'Quantity30', label: 'Jumlah Barang Kondisi dibawah 30%', sortable: true },
  924.             { key: 'Price30', label: 'Harga Beli Kondisi dibawah 30%', sortable: true },
  925.             { key: 'Delete', label: '' },
  926.         ],
  927.         deliveryOrderField: [
  928.             { key: 'Id', label: 'Id', sortable: true },
  929.             { key: 'Code', label: 'Kode', sortable: true },
  930.             { key: 'ItemCode', label: 'Kode Barang', sortable: true },
  931.             { key: 'Name', label: 'Nama', sortable: true },
  932.             { key: 'Category', label: 'Kategori', sortable: true },
  933.             { key: 'SupplierId', label: 'Supplier', sortable: true },
  934.             { key: 'IsAssembly', label: 'Perlu Dirakit', sortable: true },
  935.             { key: 'TotalQuantity', label: 'Jumlah Keseluruhan', sortable: true },
  936.             { key: 'Quantity100', label: 'Jumlah 100%', sortable: true },
  937.             { key: 'Quantity90', label: 'Jumlah Barang Kondisi 90%', sortable: true },
  938.             { key: 'Quantity60', label: 'Jumlah Barang Kondisi 60%', sortable: true },
  939.             { key: 'Quantity30', label: 'Jumlah Barang Kondisi dibawah 30%', sortable: true },
  940.         ],
  941.         receiptField: [
  942.             { key: 'Id', label: 'Id', sortable: true },
  943.             { key: 'Code', label: 'Kode Barang', sortable: true },
  944.             { key: 'ItemCode', label: 'Kode', sortable: true },
  945.             { key: 'Name', label: 'Nama', sortable: true },
  946.             { key: 'Category', label: 'Kategori', sortable: true },
  947.             { key: 'SupplierId', label: 'Supplier', sortable: true },
  948.             { key: 'IsAssembly', label: 'Perlu Dirakit', sortable: true },
  949.             { key: 'TotalQuantity', label: 'Jumlah Keseluruhan', sortable: true },
  950.             { key: 'Quantity100', label: 'Jumlah 100%', sortable: true },
  951.             { key: 'Price100', label: 'Harga Beli Kondisi 100%', sortable: true },
  952.             { key: 'Quantity90', label: 'Jumlah Barang Kondisi 90%', sortable: true },
  953.             { key: 'Price90', label: 'Harga Beli Kondisi 90%', sortable: true },
  954.             { key: 'Quantity60', label: 'Jumlah Barang Kondisi 60%', sortable: true },
  955.             { key: 'Price60', label: 'Harga Beli Kondisi 60%', sortable: true },
  956.             { key: 'Quantity30', label: 'Jumlah Barang Kondisi dibawah 30%', sortable: true },
  957.             { key: 'Price30', label: 'Harga Beli Kondisi dibawah 30%', sortable: true },
  958.         ]
  959.     }
  960.    },
  961.    validations: {
  962.       stockIn: {
  963.           Name: {
  964.               required
  965.           },
  966.           DeliveryOrderCode: {
  967.               required
  968.           },
  969.           ReceiptCode: {
  970.               required
  971.           }
  972.       },
  973.       selectedInventory: {
  974.           required
  975.       },
  976.       selectedAssembly: {
  977.           required
  978.       }
  979.   },
  980.    beforeUpdate: function () {
  981.  
  982.     this.stockIn.DriverId = this.selectedDriver.Id
  983.     this.stockIn.CoDriverId = this.selectedCoDriver.Id
  984.     this.stockIn.LicensePlateNumberR = this.selectedLicensePlateNumberR.LicencePlateNumber
  985.  
  986.     this.stockIn.ReceiverName = this.selectedLegalEntity.Name + " - " + this.selectedBranch.Name
  987.     // this.stockIn.Total = this.totalPriceItemDetails(this.itemdetails)
  988.  
  989.     this.stockIn.PaymentStatus = this.selectedInventory.PaymentStatus
  990.     this.stockIn.Nominal = this.selectedInventory.Nominal
  991.  
  992.     this.stockIn.SenderName = this.supplier[this.itemdetails[0].SupplierId].Name
  993.     // this.stockIn.Sisa = parseInt(this.stockIn.Total) - parseInt(this.stockIn.Nominal)    
  994. },
  995. created: function () {
  996.     this.init()
  997. },
  998. mounted: function () {
  999.     window.$ = $
  1000.     if(localStorage.userData !== undefined) {
  1001.         this.userData = JSON.parse(localStorage.userData)
  1002.     } else {
  1003.         this.$router.push({ name: 'home' })
  1004.         location.reload()
  1005.     }
  1006. },
  1007. methods: {
  1008.     init: async function () {
  1009.         let inventory = await Inventories.index()
  1010.         let legalEntity = await LegalEntities.detail(1)
  1011.         let branch = await Branches.detail(1)
  1012.         let employee = await Employees.index()
  1013.         let supplier = await Supplier.index()
  1014.  
  1015.         this.inventory = inventory.data
  1016.         this.legalEntity = legalEntity.data
  1017.         this.branch = branch.data
  1018.         this.employee = employee.data
  1019.         this.supplier = this.itemLookup(supplier.data)
  1020.         this.inventoryLookup = this.itemLookup(inventory.data)
  1021.  
  1022.         this.selectedLegalEntity = legalEntity.data
  1023.         this.selectedBranch = branch.data
  1024.         this.loading = false
  1025.  
  1026.         this.stockIn.LegalEntityIdR = 1
  1027.         this.stockIn.BranchIdR = 1
  1028.         this.stockIn.LegalEntityId = this.userData.LegalEntityId
  1029.         this.stockIn.BranchId = this.userData.BranchId
  1030.  
  1031.         if(this.$route.params.id) {
  1032.             let edit = await StockIn.detail(this.$route.params.id)
  1033.             let itemdetails = await ItemDetails.findbymodule('Central Procurement', this.$route.params.id)
  1034.  
  1035.             this.stockIn = edit.data
  1036.             this.itemdetails = itemdetails.data
  1037.            
  1038.             this.selectedDriver = this.lookupData(employee.data, edit.data.DriverId)
  1039.             this.selectedCoDriver = this.lookupData(employee.data, edit.data.CoDriverId)
  1040.             this.selectedLicensePlateNumberR = [edit.data.LicensePlateNumberR]
  1041.  
  1042.             this.stockIn.Total = this.totalPriceItemDetails(this.itemdetails)
  1043.             this.stockIn.Sisa = parseInt(this.stockIn.Total) - parseInt(this.stockIn.Nominal)
  1044.  
  1045.             console.log(this.stockIn.Sisa)
  1046.  
  1047.             if(this.stockIn.Properties == 'Pembelian oleh Admin') {
  1048.                 let purchase = await Purchases.index()
  1049.                 this.purchase = this.extractSupplierItem(purchase.data)
  1050.             }
  1051.  
  1052.             if(this.stockIn.Properties == 'Pemesanan Terjadwal') {
  1053.                 let orderPlan = await OrderPlans.detail(1)
  1054.                 this.purchase = orderPlan.data.OrderPlanDropdown.filter(x => x != null && x.Lot != null)
  1055.  
  1056.             }
  1057.         }      
  1058.     },
  1059.     tambahBarang: async function() {
  1060.         this.stockIn.Type = "Central Procurement"
  1061.         this.stockIn.DeliveryStatus = "Draft"
  1062.         this.stockIn.ItemCollection = "[]"
  1063.         this.stockIn.Source = "Central Procurement"
  1064.         this.stockIn.SourceId = null
  1065.         this.stockIn.TransferType = "StockIn"
  1066.         console.log(this.stockIn)
  1067.         try {
  1068.             this.stockIn.Code = 'MPP/' + this.userData.LegalEntityId + this.userData.BranchId + '/' + moment().format('DD') + moment().format('MM') + moment().format('YY') + "/" + this.userData.Id + "/" + moment().format('HH') + moment().format('mm') + moment().format('ss')
  1069.             let result =  await StockIn.create(this.stockIn)
  1070.             let id = result.data.id
  1071.            
  1072.             if(result.status == 200) {
  1073.                 this.$fire({
  1074.                   title: 'Sukses',
  1075.                   text: 'Data Disimpan sebagai draft',
  1076.                   icon: 'info',
  1077.                   showConfirmButton: false
  1078.                 })
  1079.                 if(id) {
  1080.                     this.$router.push({ name: 'StockInCPV3Management.draft', params: { id: id } })
  1081.                     location.reload()
  1082.                 }
  1083.             } else {
  1084.                 this.$fire({
  1085.                   title: 'Error',
  1086.                   text: 'Input Data Gagal',
  1087.                   icon: 'error',
  1088.                   showConfirmButton: false
  1089.                 })
  1090.                 console.log(result)
  1091.             }
  1092.         } catch (error) {
  1093.             alert("Error : " + error.response.data.message)
  1094.         }
  1095.     },
  1096.     totalItemDetails: function (json) {
  1097.         console.log(json)
  1098.         let total = 0;
  1099.         for(var i = 0; i < json.length; i++) {
  1100.             total = parseInt(total)
  1101.              + parseInt(json[i].Quantity100)
  1102.              + parseInt(json[i].Quantity90)
  1103.              + parseInt(json[i].Quantity60)
  1104.              + parseInt(json[i].Quantity30)
  1105.             console.log(json[i].Quantity100)
  1106.             console.log(total)
  1107.         }
  1108.         console.log(total)
  1109.         return total
  1110.     },
  1111.     totalPriceItemDetails: function(json) {
  1112.         let total = 0;
  1113.         for(var i = 0; i < json.length; i++) {
  1114.             total = parseInt(total)
  1115.              + parseInt(parseInt(json[i].Quantity100) * parseInt(json[i].Price100))
  1116.              + parseInt(parseInt(json[i].Quantity90) * parseInt(json[i].Price90))
  1117.              + parseInt(parseInt(json[i].Quantity60) * parseInt(json[i].Price60))
  1118.              + parseInt(parseInt(json[i].Quantity30) * parseInt(json[i].Price30))
  1119.             console.log(total)
  1120.         }
  1121.         return total
  1122.     },
  1123.     saveDraft: async function() {
  1124.         try {
  1125.  
  1126.             await StockIn.edit(this.$route.params.id, this.stockIn)
  1127.  
  1128.             this.$router.push({ name: 'StockInCPV3Management.detail', params: { id: this.$route.params.id } })
  1129.             location.reload()
  1130.  
  1131.         } catch (error) {
  1132.             alert("Error : " + error.response.data.message)
  1133.         }
  1134.  
  1135.     },
  1136.     save: async function() {
  1137.         this.stockIn.EditorId = this.userData.EmployeeId
  1138.         console.log(this.stockIn)
  1139.         try {
  1140.             let result
  1141.             let modals = []
  1142.        
  1143.             if(this.$route.params.id) {
  1144.                 result = await StockIn.edit(this.$route.params.id, this.stockIn)
  1145.             }
  1146.            
  1147.             if(result.status == 200) {
  1148.                 modals.push({
  1149.                   title: 'Sukses',
  1150.                   text: 'Input Data Barang Masuk Sukses',
  1151.                   icon: 'info',
  1152.                   showConfirmButton: false
  1153.                 })
  1154.  
  1155.             } else {
  1156.                 modals.push({
  1157.                   title: 'Error',
  1158.                   position: 'top',
  1159.                   text: 'Input Data Barang Masuk Gagal',
  1160.                   icon: 'error',
  1161.                   showConfirmButton: false
  1162.                 })
  1163.                 console.log(result)
  1164.             }
  1165.            
  1166.             this.$swal.queue(modals)
  1167.            
  1168.             this.$router.push({ name: 'StockInV3Management.index' })
  1169.             location.reload()
  1170.            
  1171.         } catch (error) {
  1172.             alert("Error : " + error.response.data.message)
  1173.         }
  1174.  
  1175.     },
  1176.     itemLookup: function (json) {
  1177.         let data = []
  1178.         for(var i = 0; i< json.length; i++) {
  1179.             data[json[i].Id] = json[i]
  1180.         }
  1181.         return data
  1182.     },
  1183.     lookupData (json, id) {
  1184.       let data = []
  1185.       for(var i = 0; i < json.length; i++) {
  1186.         data[json[i].Id] = json[i]
  1187.       }
  1188.       return data[id]
  1189.     },
  1190.     paidPurchase (json) {
  1191.       let data = []
  1192.       for(var i = 0; i < json.length; i++) {
  1193.         if(json[i].Paid == 1) {
  1194.             data[i] = json[i]
  1195.         }
  1196.       }
  1197.       return data
  1198.     },
  1199.     approvedProcurement (json) {
  1200.       let data = []
  1201.       for(var i = 0; i < json.length; i++) {
  1202.         if(json[i].ApprovalCentral == 1) {
  1203.             data[i] = json[i]
  1204.         }
  1205.       }
  1206.       return data
  1207.     },
  1208.     formatDate(time) {
  1209.       var formattedTime = moment(time).format('DD MMMM YYYY HH:mm')
  1210.       if(formattedTime == 'Invalid date') {
  1211.         formattedTime = '-'
  1212.       }
  1213.       return formattedTime
  1214.     },
  1215.     extractSupplierItem: function (json) {
  1216.         let result = []
  1217.         let data = json.filter(x => x.Approval == 1).filter(y => y.IsEqual != 1)
  1218.         for(var i = 0; i < data.length; i++) {
  1219.             if(data[i].Approval == 1) {
  1220.                 if(data[i].inventory_branch.inventory.IsBundle == 1) {
  1221.                     // cek bundle id
  1222.                     let itemBranchId = data[i].inventory_branch.Id
  1223.                     // get bundle id dr item branch id                    
  1224.                     Bundles.searchByItemId(itemBranchId).then(function (bundleData) {
  1225.                         // extract item details
  1226.                         ItemDetails.findbymodule("Bundle", bundleData.data.Id).then(function (itemdetailsrequest) {
  1227.                             let itemdetails = itemdetailsrequest.data
  1228.                             // kasih tag IsBundle = 1 di setiap item hasil extractnya
  1229.                             for(var j = 0; j < itemdetails.length; j++) {
  1230.                                 let itemextrackan = itemdetails[j]
  1231.                                 console.log(data[i]) // Ada anomali disini, ga bisa ambil data
  1232.                                 // push isi item details
  1233.                                 // samain format dulu sebelum dimasukin
  1234.                                 let purchaseItem = {
  1235.                                     Approval: 1,
  1236.                                     BranchId: itemextrackan.BranchId,
  1237.                                     Cancel: 0,
  1238.                                     Category: "Bundle - Barang Recahan",
  1239.                                     // Code: data[i].Code + "-" + itemextrackan.Code,
  1240.                                     Code: "RCH -" + itemextrackan.Code,
  1241.                                     Credit: itemextrackan.Price,
  1242.                                     CustomerId: null,
  1243.                                     Debit: 0,
  1244.                                     DeliveryOrderCode: null,
  1245.                                     DeliveryStatus: null,
  1246.                                     DriverId: null,
  1247.                                     EmployeeId: null,
  1248.                                     ExpeditionName: null,
  1249.                                     ExpeditionReceipt: null,
  1250.                                     GroupId: null,
  1251.                                     Id: j,
  1252.                                     ItemId: itemextrackan.ItemId,
  1253.                                     ItemQuantity: itemextrackan.TotalQuantity,
  1254.                                     LegalEntityId: itemextrackan.LegalEntityId,
  1255.                                     Name: itemextrackan.Name,
  1256.                                     Nominal: itemextrackan.Price,
  1257.                                     OrderStatus: null,
  1258.                                     Paid: 1,
  1259.                                     PaymentStatus: "Lunas",
  1260.                                     Picture1: null,
  1261.                                     Picture2: null,
  1262.                                     Picture3: null,
  1263.                                     Picture4: null,
  1264.                                     Price30:  itemextrackan.Price30,
  1265.                                     Price60:  itemextrackan.Price60,
  1266.                                     Price90:  itemextrackan.Price90,
  1267.                                     Price100:  itemextrackan.Price100,
  1268.                                     Quantity30: itemextrackan.Quantity30 * data[i].ItemQuantity,
  1269.                                     Quantity60: itemextrackan.Quantity60 * data[i].ItemQuantity,
  1270.                                     Quantity90: itemextrackan.Quantity90 * data[i].ItemQuantity,
  1271.                                     Quantity100: itemextrackan.Quantity100 * data[i].ItemQuantity,
  1272.                                     Sisa: 0,
  1273.                                     Source: "Bundle",
  1274.                                     SourceId: null,
  1275.                                     SupplierId: itemextrackan.SupplierId,
  1276.                                     Tags: "Kas Kecil",
  1277.                                     Total: itemextrackan.Price,
  1278.                                     TransactionType: "Purchases",
  1279.                                     Type: "Pembelian",
  1280.                                     inventory_branch: {
  1281.                                         Id: itemextrackan.ItemId,
  1282.                                         inventory: {
  1283.                                             Code: itemextrackan.Code,
  1284.                                             Name: itemextrackan.Name
  1285.                                         }
  1286.                                     }
  1287.                                 }
  1288.                                 console.log("7:"+ JSON.stringify(purchaseItem))
  1289.                                 // masukin datanya
  1290.                                 result.push(purchaseItem)
  1291.                             }
  1292.                         })
  1293.                     })
  1294.                 } else {
  1295.                     result.push(data[i])
  1296.                 }
  1297.             }
  1298.         }
  1299.         console.log(result)
  1300.         return result
  1301.     },
  1302.     tambah: async function () {
  1303.        
  1304.         let items = this.selectedInventory
  1305.         if(this.stockIn.Properties == 'Pemesanan Terjadwal') {
  1306.             items.ItemId = items.itembranch[0].Id
  1307.             items.Quantity100 = items.AlocationQuantity
  1308.             items.Quantity90 = 0
  1309.             items.Quantity60 = 0
  1310.             items.Quantity30 = 0
  1311.         }
  1312.         // let items = this.item
  1313.         items.Position = "Masuk"
  1314.         items.Source = "Central Procurement"
  1315.         items.SourceId = this.$route.params.id
  1316.         items.Reason = ''
  1317.         items.EmployeeId = this.userData.EmployeeId
  1318.         items.LegalEntityId = 1
  1319.         items.BranchId = 1
  1320.  
  1321.         /**
  1322.          * Tester
  1323.          */
  1324.         // items.TotalQuantity = parseInt(items.Quantity100) + parseInt(items.Quantity90) + parseInt(items.Quantity60) + parseInt(items.Quantity30)
  1325.  
  1326.         // items.BuyingPrice100 = items.inventory_branch.inventory.BuyingPrice100
  1327.         // items.BuyingPrice90 = items.inventory_branch.inventory.BuyingPrice90
  1328.         // items.BuyingPrice60 = items.inventory_branch.inventory.BuyingPrice60
  1329.         // items.BuyingPrice30 = items.inventory_branch.inventory.BuyingPrice30
  1330.  
  1331.         /**
  1332.          * Base
  1333.          */
  1334.         items.Quantity100 = this.selectedInventory.Quantity100
  1335.         items.Quantity90 = this.selectedInventory.Quantity90
  1336.         items.Quantity60 = this.selectedInventory.Quantity60
  1337.         items.Quantity30 = this.selectedInventory.Quantity30
  1338.         items.TotalQuantity = parseInt(items.Quantity100) + parseInt(items.Quantity90) + parseInt(items.Quantity60) + parseInt(items.Quantity30)
  1339.        
  1340.         /**
  1341.          * Harga Beli
  1342.          */
  1343.         items.BuyingPrice100 = this.selectedInventory.BuyingPrice100
  1344.         items.BuyingPrice90 = this.selectedInventory.BuyingPrice90
  1345.         items.BuyingPrice60 = this.selectedInventory.BuyingPrice60
  1346.         items.BuyingPrice30 = this.selectedInventory.BuyingPrice30
  1347.  
  1348.         this.stockIn.PaymentStatus = this.selectedInventory.PaymentStatus
  1349.         console.log(items)
  1350.        
  1351.         if(this.selectedAssembly == 'Ya') {
  1352.             items.IsAssembly = 1
  1353.             items.UnassemblyQuantity = items.TotalQuantity
  1354.             items.Unassembly100 = this.selectedInventory.Quantity100
  1355.             items.Unassembly90 = this.selectedInventory.Quantity90
  1356.             items.Unassembly60 = this.selectedInventory.Quantity60
  1357.             items.Unassembly30 = this.selectedInventory.Quantity30
  1358.             items.BuyingPrice100 = this.selectedInventory.BuyingPrice100
  1359.             items.BuyingPrice90 = this.selectedInventory.BuyingPrice90
  1360.             items.BuyingPrice60 = this.selectedInventory.BuyingPrice60
  1361.             items.BuyingPrice30 = this.selectedInventory.BuyingPrice30
  1362.             items.AssemblyQuantity = 0
  1363.             items.Assembly100 = 0
  1364.             items.Assembly90 = 0
  1365.             items.Assembly60 = 0
  1366.             items.Assembly30 = 0
  1367.             items.IsRefurbish = 0
  1368.             items.Cancel = 0
  1369.         }
  1370.         if(this.selectedAssembly == 'Tidak') {
  1371.             items.IsAssembly = 0
  1372.             items.IsRefurbish = 0
  1373.            
  1374.         }
  1375.         if(!items.Code.includes('RCH/')) {
  1376.             this.stockIn.SenderName = items.supplier.Name
  1377.         }
  1378.         items.StockInCode = this.stockIn.Code
  1379.  
  1380.         try {
  1381.             let itemdetailsBefore = await ItemDetails.findbymodule('Central Procurement', this.$route.params.id)
  1382.             console.log(itemdetailsBefore.data)
  1383.             if(!isNaN(this.totalItemDetails(itemdetailsBefore.data))) {
  1384.                 console.log(items)
  1385.                 let result =  await ItemDetails.create(items)
  1386.                 let itemdetails = await ItemDetails.findbymodule('Central Procurement', this.$route.params.id)
  1387.                 if(itemdetails.status == 200) {
  1388.                     this.stockIn.ItemQuantity = this.totalItemDetails(itemdetails.data)
  1389.                     await StockIn.edit(this.$route.params.id, this.stockIn)
  1390.                 }
  1391.                
  1392.                 if(result.status == 200) {
  1393.                     if(!items.IsBundle) {
  1394.                         items.IsEqual = false
  1395.                     } else {
  1396.                         items.IsEqual = true
  1397.                     }
  1398.                     if(this.stockIn.Properties != 'Pemesanan Terjadwal') {
  1399.                         if(!items.Code.includes('RCH/')) {
  1400.                             await Purchases.edit(items.Id, items)
  1401.                         }
  1402.                     }
  1403.  
  1404.                     this.$fire({
  1405.                     title: 'Sukses',
  1406.                     text: 'Data barang telah Disimpan',
  1407.                     icon: 'info',
  1408.                     showConfirmButton: false
  1409.                     })
  1410.                     this.$router.push({ name: 'StockInCPV3Management.draft', params: { id: this.$route.params.id } })
  1411.                     location.reload()
  1412.                 } else {
  1413.                     this.$fire({
  1414.                     title: 'Error',
  1415.                     text: 'Input Data Gagal',
  1416.                     icon: 'error',
  1417.                     showConfirmButton: false
  1418.                     })
  1419.                     console.log(result)
  1420.                 }
  1421.             } else {
  1422.                 this.$fire({
  1423.                     title: 'Error',
  1424.                     text: 'Input Data Gagal',
  1425.                     icon: 'error',
  1426.                     showConfirmButton: false
  1427.                 })
  1428.             }
  1429.         } catch (error) {
  1430.             alert("Error : " + error.response.data.message)
  1431.         }
  1432.     },
  1433.     hapus: async function(id, json) {
  1434.         console.log(json)
  1435.         json.EmployeeId = this.userData.EmployeeId
  1436.         json.LegalEntityId = this.userData.LegalEntityId
  1437.         json.BranchId = this.userData.BranchId
  1438.         json.Source = "Central Procurement"
  1439.         json.SourceId = this.$route.params.id
  1440.         json.Reason = ''
  1441.        
  1442.         try {
  1443.             let result =  await ItemDetails.edit(id, json)
  1444.             let itemdetails = await ItemDetails.findbymodule('Central Procurement', this.$route.params.id)
  1445.             if(itemdetails.status == 200) {
  1446.                 this.stockIn.ItemQuantity = this.totalItemDetails(itemdetails.data)
  1447.                 await StockIn.edit(this.$route.params.id, this.stockIn)
  1448.             }
  1449.            
  1450.             if(result.status == 200) {
  1451.                 this.$fire({
  1452.                   title: 'Sukses',
  1453.                   text: 'Data barang telah Dihapus',
  1454.                   icon: 'info',
  1455.                   showConfirmButton: false
  1456.                 })
  1457.                 this.$router.push({ name: 'StockInCPV3Management.draft', params: { id: this.$route.params.id } })
  1458.                 location.reload()
  1459.             } else {
  1460.                 this.$fire({
  1461.                   title: 'Error',
  1462.                   text: 'Input Data Gagal',
  1463.                   icon: 'error',
  1464.                   showConfirmButton: false
  1465.                 })
  1466.                 console.log(result)
  1467.             }
  1468.         } catch (error) {
  1469.             alert("Error : " + error.response.data.message)
  1470.         }
  1471.     },
  1472.     add: function (tmpitem) {
  1473.         console.log(tmpitem)
  1474.         this.item = tmpitem
  1475.         this.item.Id = tmpitem.ItemId
  1476.         this.item.BundleQuantity100 = tmpitem.Quantity100
  1477.         this.item.BundleQuantity90 = tmpitem.Quantity90
  1478.         this.item.BundleQuantity60 = tmpitem.Quantity60
  1479.         this.item.BundleQuantity30 = tmpitem.Quantity30
  1480.         this.item.BundleItemQuantity = tmpitem.ItemQuantity
  1481.         this.stockIn.ItemCollection.push(this.item)
  1482.         this.stockIn.Total = parseInt(this.stockIn.Total) + parseInt((parseInt(this.item.BundleQuantity100) * parseInt(this.item.Price100)) + (parseInt(this.item.BundleQuantity90) * parseInt(this.item.Price90)) + (parseInt(this.item.BundleQuantity60) * parseInt(this.item.Price60)))
  1483.         this.stockIn.ItemQuantity = parseInt(this.stockIn.ItemQuantity) + parseInt(this.item.BundleItemQuantity)
  1484.     },
  1485.     del: function (index) {
  1486.         console.log(this.stockIn.ItemCollection[index])
  1487.         this.stockIn.Total = parseInt(this.stockIn.Total) - parseInt(((parseInt(this.stockIn.ItemCollection[index].BundleQuantity100) * parseInt(this.stockIn.ItemCollection[index].Price100))) + ((parseInt(this.stockIn.ItemCollection[index].BundleQuantity90) * parseInt(this.stockIn.ItemCollection[index].Price90))) + ((parseInt(this.stockIn.ItemCollection[index].BundleQuantity60) * parseInt(this.stockIn.ItemCollection[index].Price60))))
  1488.         this.stockIn.ItemQuantity = parseInt(this.stockIn.ItemQuantity) - parseInt(this.stockIn.ItemCollection[index].BundleItemQuantity)
  1489.         this.$delete(this.stockIn.ItemCollection, index)
  1490.     },
  1491.     changeImage1(file) {
  1492.         this.stockIn.Picture1 = file.base64
  1493.     },
  1494.     changeImage2(file) {
  1495.         this.stockIn.Picture2 = file.base64
  1496.     },
  1497.     changeImage3(file) {
  1498.         this.stockIn.Picture3 = file.base64
  1499.     },
  1500.     changeImage4(file) {
  1501.         this.stockIn.Picture4 = file.base64
  1502.     },
  1503.     addWaterMarkDeliveryOrder(doc) {
  1504.         var totalPages = doc.internal.getNumberOfPages();
  1505.  
  1506.         for (var i = 1; i <= totalPages; i++) {
  1507.             doc.setPage(i);
  1508.             //doc.addImage(imgData, 'PNG', 40, 40, 75, 75);
  1509.             // doc.setTextColor(150);
  1510.             // doc.text('Test', 130, 10);
  1511.  
  1512.             //Header
  1513.             doc.setFontSize(20)
  1514.             doc.text("Surat Jalan", 130, 10)
  1515.             doc.setFontSize(10)
  1516.             doc.text("Nomor                 : " + this.stockIn.DeliveryOrderCode, 30, 20)
  1517.             doc.text("Penerima              : " + this.stockIn.ReceiverName, 30, 30)
  1518.             if(this.stockIn.DriverId != null) {
  1519.                 doc.text("Driver                : " + this.stockIn.employee_driver.Name, 30, 40)
  1520.             } else {
  1521.                 doc.text("Driver                : - " , 30, 40)
  1522.             }
  1523.             if(this.stockIn.CoDriverId != null) {
  1524.                 doc.text("Co Driver           : " + this.stockIn.employee_co_driver.Name, 30, 50)
  1525.             } else {
  1526.                 doc.text("Co Driver           : - ", 30, 50)
  1527.             }
  1528.             doc.text("Tanggal              : " + this.stockIn.created_at, 190, 20)
  1529.             doc.text("Pengirim             : " + this.stockIn.SenderName, 190, 30)
  1530.             if(this.stockIn.ExpeditionName != null) {
  1531.                 doc.text("Ekspedisi           : " + this.stockIn.ExpeditionName, 190, 40)
  1532.             } else {
  1533.                 doc.text("Ekspedisi           : - ", 190, 40)
  1534.             }
  1535.             if(this.stockIn.ExpeditionReceipt != null) {
  1536.                 doc.text("Nomor Resi       : " + this.stockIn.ExpeditionReceipt, 190, 50)
  1537.             } else {
  1538.                 doc.text("Nomor Resi       : - ", 190, 50)
  1539.             }
  1540.             doc.text("======================================================================================================================================", 10, 60)
  1541.  
  1542.             var pageSize = doc.internal.pageSize;
  1543.             var pageHeight = pageSize.height ? pageSize.height : pageSize.getHeight();
  1544.             doc.text('Admin,', 15, pageHeight - 40);
  1545.             doc.text("" + this.stockIn.updated_at, 15, pageHeight - 10)
  1546.             doc.text('Diperiksa,', 70, pageHeight - 40);
  1547.             doc.text('Diterima,', 120, pageHeight - 40);
  1548.             doc.text("" + this.stockIn.ReceiverName, 120, pageHeight - 10)
  1549.             doc.text("=====================================", 200, pageHeight - 40)
  1550.             doc.text("Total Barang : " + this.stockIn.ItemQuantity, 200, pageHeight - 35)
  1551.         }
  1552.         return doc;
  1553.     },
  1554.     addWaterMarkReceipt(doc) {
  1555.         var totalPages = doc.internal.getNumberOfPages();
  1556.  
  1557.         for (var i = 1; i <= totalPages; i++) {
  1558.             doc.setPage(i);
  1559.             //doc.addImage(imgData, 'PNG', 40, 40, 75, 75);
  1560.             // doc.setTextColor(150);
  1561.             // doc.text('Test', 130, 10);
  1562.  
  1563.             //Header
  1564.             doc.setFontSize(20)
  1565.             doc.text("Faktur", 130, 10)
  1566.             doc.setFontSize(10)
  1567.             doc.text("Nomor                 : " + this.stockIn.ReceiptCode, 30, 20)
  1568.             doc.text("Penerima            : " + this.stockIn.ReceiverName, 30, 30)
  1569.             if(this.stockIn.DriverId != null) {
  1570.                 doc.text("Driver                : " + this.stockIn.employee_driver.Name, 30, 40)
  1571.             } else {
  1572.                 doc.text("Driver                : - " , 30, 40)
  1573.             }
  1574.             if(this.stockIn.CoDriverId != null) {
  1575.                 doc.text("Co Driver           : " + this.stockIn.employee_co_driver.Name, 30, 50)
  1576.             } else {
  1577.                 doc.text("Co Driver           : - ", 30, 50)
  1578.             }
  1579.             doc.text("Tanggal              : " + this.stockIn.created_at, 190, 20)
  1580.             doc.text("Pengirim             : " + this.stockIn.SenderName, 190, 30)
  1581.             if(this.stockIn.ExpeditionName != null) {
  1582.                 doc.text("Ekspedisi           : " + this.stockIn.ExpeditionName, 190, 40)
  1583.             } else {
  1584.                 doc.text("Ekspedisi           : - ", 190, 40)
  1585.             }
  1586.             if(this.stockIn.ExpeditionReceipt != null) {
  1587.                 doc.text("Nomor Resi       : " + this.stockIn.ExpeditionReceipt, 190, 50)
  1588.             } else {
  1589.                 doc.text("Nomor Resi       : - ", 190, 50)
  1590.             }
  1591.             doc.text("======================================================================================================================================", 10, 60)
  1592.  
  1593.             var pageSize = doc.internal.pageSize;
  1594.             var pageHeight = pageSize.height ? pageSize.height : pageSize.getHeight();
  1595.             doc.text('Admin,', 15, pageHeight - 40);
  1596.             doc.text("" + this.stockIn.updated_at, 15, pageHeight - 10)
  1597.             doc.text('Diperiksa,', 70, pageHeight - 40);
  1598.             doc.text('Diterima,', 120, pageHeight - 40);
  1599.             doc.text("" + this.stockIn.ReceiverName, 120, pageHeight - 10)
  1600.             doc.text("=====================================", 200, pageHeight - 40)
  1601.             doc.text("Total Barang : " + this.stockIn.ItemQuantity.toString().replace(/\B(?=(\d{3})+(?!\d))/g, "."), 200, pageHeight - 35)
  1602.             doc.text("Total Harga : " + "Rp" + this.stockIn.Total.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + ".00", 200, pageHeight - 30)
  1603.             doc.text("Jenis Pembayaran : " + this.stockIn.PaymentStatus, 200, pageHeight - 25)
  1604.             doc.text("Nominal Pembayaran : " + "Rp" + parseInt(this.stockIn.Nominal).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + ".00", 200, pageHeight - 20)
  1605.             doc.text("Sisa Pembayaran : " + "Rp" + parseInt(this.stockIn.Sisa).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + ".00", 200, pageHeight - 15)
  1606.         }
  1607.         return doc;
  1608.     },
  1609.     downloadSuratJalan() {
  1610.         const doc = new jsPDF({
  1611.             orientation: 'landscape'
  1612.         });
  1613.        
  1614.         doc.autoTable({
  1615.             startY: 70,
  1616.             html: '#stockInDeliveryOrder',
  1617.             margin: {
  1618.                 bottom: 40, //this decides how big your footer area will be
  1619.                 top: 70 //this decides how big your header area will be.
  1620.             }
  1621.         })
  1622.  
  1623.         this.doc = this.addWaterMarkDeliveryOrder(doc)
  1624.  
  1625.         doc.save("Surat Jalan - " + this.stockIn.DeliveryOrderCode + ".pdf");
  1626.     },
  1627.     downloadKwitansi() {
  1628.         const doc = new jsPDF({
  1629.             orientation: 'landscape'
  1630.         });
  1631.        
  1632.         doc.autoTable({
  1633.             startY: 70,
  1634.             html: '#stockInReceipt',
  1635.             margin: {
  1636.                 bottom: 40, //this decides how big your footer area will be
  1637.                 top: 70 //this decides how big your header area will be.
  1638.             }
  1639.         })
  1640.  
  1641.         this.doc = this.addWaterMarkReceipt(doc)
  1642.  
  1643.         doc.save("Kwitansi - " + this.stockIn.ReceiptCode +".pdf");
  1644.     },
  1645.   }
  1646. }
  1647. </script>
Add Comment
Please, Sign In to add comment