Skip to content

Instantly share code, notes, and snippets.

@kendhia
Created October 16, 2020 06:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kendhia/c2fd51e99effbbcc8beff339730f5c9f to your computer and use it in GitHub Desktop.
Save kendhia/c2fd51e99effbbcc8beff339730f5c9f to your computer and use it in GitHub Desktop.
const getTransactionSales = () => {
const totalItems = store.getState().cartReducer.totalItems;
let transactionSales = [];
totalItems.forEach(element => {
let info = element.productInfo;
let item = {
amount: info.quantity, // miktar
barcode: info.barcode, // ürün barkodu
campaignDiscount: 0,
chequeDiscount: 0,
code: info.code, // ürün stok kodu
currencyUnitPrice: info.unitPrice, // ürün birim fiyat
customText: '',
parameters: [
{
key: '',
value: info.vat.vatPct, // kdv oranı
},
],
vat: {
id: 0,
num: 0,
parameters: [
{
key: '',
value: info.vat.vatPct, // kdv oranı
},
],
percentage: info.vat.vatPct, // kdv oranı
},
description: info.name, // ürün kısa açıklaması
discountFlag: 0,
discountTotal: calcuateTotaCartDiscount(), // toplamdan gelen indirimler toplamı
firstPrice: 0,
indirectDiscountTotal: info.discountAmount * info.quantity, // satır indirimleri toplamı
keyUsed: 0,
komandatura: 0,
lineNo: '',
optionBitFlag: 0,
orgUnitPrice: info.unitPrice, // birim fiyat
paymentType: {
cash: 0,
cashReturnLimit: 0,
chequeMask: {
chequeDesignMlDef: '',
chequeReturn: 0,
code: '',
defaultDuration: 0,
description: '',
effectChequeSplit: 0,
id: 0,
isPayment: 0,
mask: '',
maxAmount: 0,
multipleUse: 0,
optionBitFlag: 0,
parameters: {
key: '',
value: '',
},
paymentRatio: 0,
},
decimals: 0,
description: '',
id: 0,
limit: 0,
num: 0,
optionBitFlag: 0,
parameters: [
{
key: '',
value: '',
},
],
paymentTypeFiscal: {
description: '',
id: 0,
num: 0,
optionBitFlag: 0,
parameters: {
key: '',
value: '',
},
paymentGroup: 0,
},
posPaymentWithCampaign: 0,
provisionFlag: 0,
symbol: '',
},
pointTotal: 0,
priceChangeReason: {
code: 0,
description: '',
id: 0,
parameters: [
{
key: '',
value: '',
},
],
},
priceChanged: 0,
returnableAmount: 0,
roundingTotal: 0,
saleType: 0,
seller: {
code: '',
id: 0,
name: '',
parameters: [
{
key: '',
value: '',
},
],
password: '',
},
status: 0,
stockCardNo: info.stockCard.code, // stok kodu
stockCodeUsed: 0,
totalPrice: info.quantity * info.netPrice, // amount * satış fiyatı toplamı
transactionCheques: [
{
amount: 0,
chequeCode: '',
id: 0,
parameters: [
{
key: '',
value: '',
},
],
},
],
transactionDiscountDetails: [
{
amount: 0,
id: '',
parameters: '',
saleLine: 0,
},
],
unit: {
baseAmount: 0,
description: '',
id: 0,
num: 0,
optionBitFlag: 0,
parameters: [
{
key: '',
value: '',
},
],
symbol: '',
},
unitPrice: info.unitPrice, // birim fiyat
vatPercent: info.vat.vatPct, // ürün kdvsi
vatTotal: info.unitPrice * info.quantity * info.vat.vatPct, // kdv toplamı
};
transactionSales.push(item);
});
return transactionSales;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment