vitareinforce

transaction warehouse customer

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