vitareinforce

transaction warehouse create

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