public container getVoucherInfo(Voucher _VoucherId)
{
CustTrans _CustTrans;
LedgerJournalTrans _LedgerJournalTrans, _LedgerJournalTrans2;
TaxTrans _taxtrans;
TaxTable _taxtable;
TaxData _TaxData;
ProjInvoiceJour _ProjInvoiceJour;
CustTable _CustTable;
CustAccount _CustAccount;
CustInvoiceJour _CustInvoiceJour;
TransDate _VoucherDate;
CurrencyCode _CurrencyCode;
JournalId _JournalNum;
Amount _VoucherTotalAmt;
Amount _TempAmt;
ExchRate _PPNExchRate, _PPhExchRate;
GG_FPJVoucherType _FPJVoucherType;
SalesId _SalesId;
TaxCode taxppn;
TaxValue taxvaluePPN, taxvaluePPh;
TaxAccountGroup _taxgrouppph;
NoYes _NoYes;
;
//cust Id
taxppn = Salesparameters::find().Soltius_TaxCodePPN10;
_taxgrouppph = salesparameters::find().Soltius_TaxGroupPPh22;
_CustTrans = CustTrans::findVoucher(_VoucherId);
/*Select firstonly _CustTrans where
_CustTrans.Voucher == _VoucherId &&
_CustTrans.TransType == LedgerTransType::Payment;
*/
if (_CustTrans)
{
_CustAccount = _CustTrans.AccountNum;
_VoucherDate = _CustTrans.TransDate;
_CurrencyCode = _CustTrans.CurrencyCode;
if (_CustTrans.TransType == LedgerTransType::Project || _CustTrans.TransType == LedgerTransType::Sales || _CustTrans.TransType == LedgerTransType::Cust)
{
if (_CustTrans.AmountCur >= 0)
_FPJVoucherType = GG_FPJVoucherType::Invoice;
else
_FPJVoucherType = GG_FPJVoucherType::ReturnInv;
}
else
{
if (_CustTrans.AmountCur <= 0)
_FPJVoucherType = GG_FPJVoucherType::CashReceipt;
else
_FPJVoucherType = GG_FPJVoucherType::ReturnCR;
}
//_SalesId = CustInvoiceJour::findFromCustTrans(_CustTrans.Invoice, _CustTrans.TransDate, _CustTrans.AccountNum).SalesId;
_SalesId = _CustTrans.Soltius_SalesId;
IF (!_SalesID)
{
IF (_CustTrans.TransType == LedgerTransType::Project)
{
_SalesId = SalesTable::findProjId(ProjTable::findProjInvoiceProjId(ProjInvoiceJour::find(_CustTrans.Voucher, _CustTrans.TransDate).ProjInvoiceProjId).ProjId).SalesId;
//SELECT _ProjInvoiceJour WHERE _ProjInvoiceJour.ProjInvoiceId == _VoucherId;
}
}
}
//other from ledger transaction
select firstonly Voucher, JournalNum from _LedgerJournalTrans
group by Voucher, JournalNum where
_LedgerJournalTrans.Voucher == _VoucherId;
if (_LedgerJournalTrans.Voucher != "")
{
_JournalNum = _LedgerJournalTrans.JournalNum;
while select _LedgerJournalTrans2 where
_LedgerJournalTrans2.Voucher == _LedgerJournalTrans.Voucher &&
((_LedgerJournalTrans2.AccountType == LedgerJournalACType::Cust && _LedgerJournalTrans2.AccountNum != "")||
(_LedgerJournalTrans2.OffsetAccountType == LedgerJournalACType::Cust && _LedgerJournalTrans2.OffsetAccount != ""))
{
_TempAmt = _LedgerJournalTrans2.amount();
if (_PPNExchRate == 0)
{
_PPNExchRate = _LedgerJournalTrans2.ExchRate;
_PPhExchRate = _LedgerJournalTrans2.ExchRate;
}
_VoucherTotalAmt += _TempAmt;
}
}
else
{
switch (_CustTrans.TransType)
{
Case LedgerTransType::Project:
SELECT _ProjInvoiceJour WHERE _ProjInvoiceJour.ProjInvoiceId == _VoucherId;
if (_ProjInvoiceJour)
{
_PPNExchRate = _ProjInvoiceJour.ExchRate;
_PPhExchRate = _ProjInvoiceJour.ExchRate;
_VoucherTotalAmt = _ProjInvoiceJour.InvoiceAmount;
}
Break;
Default:
select firstonly _CustInvoiceJour where
//_CustInvoiceJour.InvoiceId == _VoucherId;
_CustInvoiceJour.LedgerVoucher == _VoucherId;
_VoucherDate = _CustInvoiceJour.InvoiceDate;
_CurrencyCode = _CustInvoiceJour.CurrencyCode;
_PPNExchRate = _CustInvoiceJour.ExchRate;
_PPhExchRate = _CustInvoiceJour.ExchRate;
_VoucherTotalAmt = _CustInvoiceJour.InvoiceAmount;
Break;
}
/*select firstonly _CustInvoiceJour where
_CustInvoiceJour.InvoiceId == _VoucherId;
if (_CustInvoiceJour)
{
_VoucherDate = _CustInvoiceJour.InvoiceDate;
_CurrencyCode = _CustInvoiceJour.CurrencyCode;
_PPNExchRate = _CustInvoiceJour.ExchRate;
_PPhExchRate = _CustInvoiceJour.ExchRate;
_VoucherTotalAmt = _CustInvoiceJour.InvoiceAmount;
}
ELSE
{
SELECT _ProjInvoiceJour WHERE _ProjInvoiceJour.ProjInvoiceId == _VoucherId;
if (_ProjInvoiceJour)
{
_PPNExchRate = _ProjInvoiceJour.ExchRate;
_PPhExchRate = _ProjInvoiceJour.ExchRate;
_VoucherTotalAmt = _ProjInvoiceJour.InvoiceAmount;
}
}*/
}
IF ((CustTable::find(_CustAccount).Soltius_CustTaxId == "070")||
(CustTable::find(_CustAccount).Soltius_CustTaxId == "030"))
_NoYes = NoYes::Yes;
ELSE
_NoYes = NoYes::No;
select _taxtrans
where _taxtrans.Voucher == _VoucherId
&& _taxtrans.TransDate == _VoucherDate
join _taxtable
where _taxtable.TaxCode == _taxtrans.TaxCode
&& _taxtable.TaxType == TaxType::PPN
Join _TaxData
Where _TaxData.TaxCode == _taxtable.TaxCode;
taxvaluePPN = _TaxData.TaxValue;
select _taxtrans
where _taxtrans.Voucher == _VoucherId
&& _taxtrans.TransDate == _VoucherDate
join _taxtable
where _taxtable.TaxCode == _taxtrans.TaxCode
&& _taxtable.TaxType == TaxType::PPh
Join _TaxData
Where _TaxData.TaxCode == _taxtable.TaxCode;
taxvaluePPh = _TaxData.TaxValue;
IF (_FPJVoucherType == GG_FPJVoucherType::Invoice)
{
GRetensi.allowEdit(SalesTable::find(_SalesId).GGRetensi);
//TotalAdv.visible(SalesTable::find(_SalesId).GGRetensi);
TotalAdv.realValue(This.GetTotalAdv(_SalesId));
}
/* // Remarkd by adit
IF (_FPJVoucherType == GG_FPJVoucherType::CashReceipt)
Advance.allowEdit(SalesTable::find(_SalesId).GGRetensi);
*/ // Remarkd by adit
return [_CustAccount, _VoucherDate, _JournalNum, _CurrencyCode, _VoucherTotalAmt, _PPNExchRate, _PPhExchRate, _FPJVoucherType, _SalesID, taxvaluePPN, taxvaluePPh, _NoYes];
}
===================================================CARA PANGGILnya===============================================
public boolean modified()
{
boolean ret;
Amount _DPPFaktur, _PPNFaktur, _PPhFaktur;
container _Cont;
ret = super();
if (GG_FPJVoucher_Voucher.text() != "")
{
_Cont = element.getVoucherInfo(GG_FPJVoucher_Voucher.text());
GG_FPJVoucher_CustAccount.text(conpeek(_Cont, 1));
GG_FPJVoucher_VoucherDate.dateValue(conpeek(_Cont, 2));
GG_FPJVoucher_JournalId.text(conpeek(_Cont, 3));
GG_FPJVoucher_CurrencyCode.text(conpeek(_Cont, 4));
GG_FPJVoucher_TotalVoucherAmount.realValue(conpeek(_Cont, 5));
GG_FPJVoucher_FPJExchRate.realValue(conpeek(_Cont, 6));
GG_FPJVoucher_PPhExchRate.realValue(conpeek(_Cont, 7));
GG_FPJVoucher_FPJVoucherType.selection(conpeek(_Cont, 8));
GGSalesID.text(conpeek(_Cont, 9));
PPNPercent.realValue(conpeek(_Cont, 10));
PPhPercent.realValue(conpeek(_Cont, 11));
Berikat.value(conpeek(_Cont, 12));
[_DPPFaktur, _PPNFaktur, _PPhFaktur] = element.calculateAmountFaktur(GG_FPJVoucher_Voucher.text(), conpeek(_Cont, 9));
element.calculateDPP_VAT_PPh();
OthFaktur.allowEdit(Element.GetOthFaktur(GG_FPJVoucher_Voucher.text()));
// added by adit
if(GG_Fpjvoucher::FindVoucher(GG_FPJVoucher_Voucher.text()).UangMuka == noyes::Yes)
{
Advance.value(noyes::Yes);
Advance.allowEdit(false);
Retention.allowEdit(false);
Cash.allowEdit(false);
Credit.allowEdit(false);
}
if(GG_FPJVoucher::FindVoucher(GG_Fpjvoucher_voucher.text()).Retensi == noyes::Yes)
{
Retention.value(noyes::Yes);
Advance.allowEdit(false);
Retention.allowEdit(false);
Cash.allowEdit(false);
Credit.allowEdit(false);
}
if(GG_FPJVoucher::FindVoucher(GG_FpjVoucher_voucher.text()).BIT_Cash == noyes::Yes)
{
Cash.value(noyes::Yes);
Advance.allowEdit(false);
Retention.allowEdit(false);
Cash.allowEdit(false);
Credit.allowEdit(false);
}
if(GG_FPJVoucher::FindVoucher(GG_FPJVoucher_voucher.text()).BIT_Credit == noyes::Yes)
{
Credit.value(noyes::Yes);
Advance.allowEdit(false);
Retention.allowEdit(false);
Cash.allowEdit(false);
Credit.allowEdit(false);
}
if(GG_FPJVoucher_FPJVoucherType.selection() == GG_FPJVoucherType::CashReceipt)
{
Advance.allowEdit(true);
Retention.allowEdit(true);
Cash.allowEdit(true);
credit.allowEdit(false);
}
if(GG_FPJVoucher_FPJVoucherType.selection() != GG_FPJVoucherType::CashReceipt)
{
Advance.allowEdit(false);
Retention.allowEdit(true);
Cash.allowEdit(false);
Credit.allowEdit(true);
}
// ended by adit
}
return ret;
}
{
CustTrans _CustTrans;
LedgerJournalTrans _LedgerJournalTrans, _LedgerJournalTrans2;
TaxTrans _taxtrans;
TaxTable _taxtable;
TaxData _TaxData;
ProjInvoiceJour _ProjInvoiceJour;
CustTable _CustTable;
CustAccount _CustAccount;
CustInvoiceJour _CustInvoiceJour;
TransDate _VoucherDate;
CurrencyCode _CurrencyCode;
JournalId _JournalNum;
Amount _VoucherTotalAmt;
Amount _TempAmt;
ExchRate _PPNExchRate, _PPhExchRate;
GG_FPJVoucherType _FPJVoucherType;
SalesId _SalesId;
TaxCode taxppn;
TaxValue taxvaluePPN, taxvaluePPh;
TaxAccountGroup _taxgrouppph;
NoYes _NoYes;
;
//cust Id
taxppn = Salesparameters::find().Soltius_TaxCodePPN10;
_taxgrouppph = salesparameters::find().Soltius_TaxGroupPPh22;
_CustTrans = CustTrans::findVoucher(_VoucherId);
/*Select firstonly _CustTrans where
_CustTrans.Voucher == _VoucherId &&
_CustTrans.TransType == LedgerTransType::Payment;
*/
if (_CustTrans)
{
_CustAccount = _CustTrans.AccountNum;
_VoucherDate = _CustTrans.TransDate;
_CurrencyCode = _CustTrans.CurrencyCode;
if (_CustTrans.TransType == LedgerTransType::Project || _CustTrans.TransType == LedgerTransType::Sales || _CustTrans.TransType == LedgerTransType::Cust)
{
if (_CustTrans.AmountCur >= 0)
_FPJVoucherType = GG_FPJVoucherType::Invoice;
else
_FPJVoucherType = GG_FPJVoucherType::ReturnInv;
}
else
{
if (_CustTrans.AmountCur <= 0)
_FPJVoucherType = GG_FPJVoucherType::CashReceipt;
else
_FPJVoucherType = GG_FPJVoucherType::ReturnCR;
}
//_SalesId = CustInvoiceJour::findFromCustTrans(_CustTrans.Invoice, _CustTrans.TransDate, _CustTrans.AccountNum).SalesId;
_SalesId = _CustTrans.Soltius_SalesId;
IF (!_SalesID)
{
IF (_CustTrans.TransType == LedgerTransType::Project)
{
_SalesId = SalesTable::findProjId(ProjTable::findProjInvoiceProjId(ProjInvoiceJour::find(_CustTrans.Voucher, _CustTrans.TransDate).ProjInvoiceProjId).ProjId).SalesId;
//SELECT _ProjInvoiceJour WHERE _ProjInvoiceJour.ProjInvoiceId == _VoucherId;
}
}
}
//other from ledger transaction
select firstonly Voucher, JournalNum from _LedgerJournalTrans
group by Voucher, JournalNum where
_LedgerJournalTrans.Voucher == _VoucherId;
if (_LedgerJournalTrans.Voucher != "")
{
_JournalNum = _LedgerJournalTrans.JournalNum;
while select _LedgerJournalTrans2 where
_LedgerJournalTrans2.Voucher == _LedgerJournalTrans.Voucher &&
((_LedgerJournalTrans2.AccountType == LedgerJournalACType::Cust && _LedgerJournalTrans2.AccountNum != "")||
(_LedgerJournalTrans2.OffsetAccountType == LedgerJournalACType::Cust && _LedgerJournalTrans2.OffsetAccount != ""))
{
_TempAmt = _LedgerJournalTrans2.amount();
if (_PPNExchRate == 0)
{
_PPNExchRate = _LedgerJournalTrans2.ExchRate;
_PPhExchRate = _LedgerJournalTrans2.ExchRate;
}
_VoucherTotalAmt += _TempAmt;
}
}
else
{
switch (_CustTrans.TransType)
{
Case LedgerTransType::Project:
SELECT _ProjInvoiceJour WHERE _ProjInvoiceJour.ProjInvoiceId == _VoucherId;
if (_ProjInvoiceJour)
{
_PPNExchRate = _ProjInvoiceJour.ExchRate;
_PPhExchRate = _ProjInvoiceJour.ExchRate;
_VoucherTotalAmt = _ProjInvoiceJour.InvoiceAmount;
}
Break;
Default:
select firstonly _CustInvoiceJour where
//_CustInvoiceJour.InvoiceId == _VoucherId;
_CustInvoiceJour.LedgerVoucher == _VoucherId;
_VoucherDate = _CustInvoiceJour.InvoiceDate;
_CurrencyCode = _CustInvoiceJour.CurrencyCode;
_PPNExchRate = _CustInvoiceJour.ExchRate;
_PPhExchRate = _CustInvoiceJour.ExchRate;
_VoucherTotalAmt = _CustInvoiceJour.InvoiceAmount;
Break;
}
/*select firstonly _CustInvoiceJour where
_CustInvoiceJour.InvoiceId == _VoucherId;
if (_CustInvoiceJour)
{
_VoucherDate = _CustInvoiceJour.InvoiceDate;
_CurrencyCode = _CustInvoiceJour.CurrencyCode;
_PPNExchRate = _CustInvoiceJour.ExchRate;
_PPhExchRate = _CustInvoiceJour.ExchRate;
_VoucherTotalAmt = _CustInvoiceJour.InvoiceAmount;
}
ELSE
{
SELECT _ProjInvoiceJour WHERE _ProjInvoiceJour.ProjInvoiceId == _VoucherId;
if (_ProjInvoiceJour)
{
_PPNExchRate = _ProjInvoiceJour.ExchRate;
_PPhExchRate = _ProjInvoiceJour.ExchRate;
_VoucherTotalAmt = _ProjInvoiceJour.InvoiceAmount;
}
}*/
}
IF ((CustTable::find(_CustAccount).Soltius_CustTaxId == "070")||
(CustTable::find(_CustAccount).Soltius_CustTaxId == "030"))
_NoYes = NoYes::Yes;
ELSE
_NoYes = NoYes::No;
select _taxtrans
where _taxtrans.Voucher == _VoucherId
&& _taxtrans.TransDate == _VoucherDate
join _taxtable
where _taxtable.TaxCode == _taxtrans.TaxCode
&& _taxtable.TaxType == TaxType::PPN
Join _TaxData
Where _TaxData.TaxCode == _taxtable.TaxCode;
taxvaluePPN = _TaxData.TaxValue;
select _taxtrans
where _taxtrans.Voucher == _VoucherId
&& _taxtrans.TransDate == _VoucherDate
join _taxtable
where _taxtable.TaxCode == _taxtrans.TaxCode
&& _taxtable.TaxType == TaxType::PPh
Join _TaxData
Where _TaxData.TaxCode == _taxtable.TaxCode;
taxvaluePPh = _TaxData.TaxValue;
IF (_FPJVoucherType == GG_FPJVoucherType::Invoice)
{
GRetensi.allowEdit(SalesTable::find(_SalesId).GGRetensi);
//TotalAdv.visible(SalesTable::find(_SalesId).GGRetensi);
TotalAdv.realValue(This.GetTotalAdv(_SalesId));
}
/* // Remarkd by adit
IF (_FPJVoucherType == GG_FPJVoucherType::CashReceipt)
Advance.allowEdit(SalesTable::find(_SalesId).GGRetensi);
*/ // Remarkd by adit
return [_CustAccount, _VoucherDate, _JournalNum, _CurrencyCode, _VoucherTotalAmt, _PPNExchRate, _PPhExchRate, _FPJVoucherType, _SalesID, taxvaluePPN, taxvaluePPh, _NoYes];
}
===================================================CARA PANGGILnya===============================================
public boolean modified()
{
boolean ret;
Amount _DPPFaktur, _PPNFaktur, _PPhFaktur;
container _Cont;
ret = super();
if (GG_FPJVoucher_Voucher.text() != "")
{
_Cont = element.getVoucherInfo(GG_FPJVoucher_Voucher.text());
GG_FPJVoucher_CustAccount.text(conpeek(_Cont, 1));
GG_FPJVoucher_VoucherDate.dateValue(conpeek(_Cont, 2));
GG_FPJVoucher_JournalId.text(conpeek(_Cont, 3));
GG_FPJVoucher_CurrencyCode.text(conpeek(_Cont, 4));
GG_FPJVoucher_TotalVoucherAmount.realValue(conpeek(_Cont, 5));
GG_FPJVoucher_FPJExchRate.realValue(conpeek(_Cont, 6));
GG_FPJVoucher_PPhExchRate.realValue(conpeek(_Cont, 7));
GG_FPJVoucher_FPJVoucherType.selection(conpeek(_Cont, 8));
GGSalesID.text(conpeek(_Cont, 9));
PPNPercent.realValue(conpeek(_Cont, 10));
PPhPercent.realValue(conpeek(_Cont, 11));
Berikat.value(conpeek(_Cont, 12));
[_DPPFaktur, _PPNFaktur, _PPhFaktur] = element.calculateAmountFaktur(GG_FPJVoucher_Voucher.text(), conpeek(_Cont, 9));
element.calculateDPP_VAT_PPh();
OthFaktur.allowEdit(Element.GetOthFaktur(GG_FPJVoucher_Voucher.text()));
// added by adit
if(GG_Fpjvoucher::FindVoucher(GG_FPJVoucher_Voucher.text()).UangMuka == noyes::Yes)
{
Advance.value(noyes::Yes);
Advance.allowEdit(false);
Retention.allowEdit(false);
Cash.allowEdit(false);
Credit.allowEdit(false);
}
if(GG_FPJVoucher::FindVoucher(GG_Fpjvoucher_voucher.text()).Retensi == noyes::Yes)
{
Retention.value(noyes::Yes);
Advance.allowEdit(false);
Retention.allowEdit(false);
Cash.allowEdit(false);
Credit.allowEdit(false);
}
if(GG_FPJVoucher::FindVoucher(GG_FpjVoucher_voucher.text()).BIT_Cash == noyes::Yes)
{
Cash.value(noyes::Yes);
Advance.allowEdit(false);
Retention.allowEdit(false);
Cash.allowEdit(false);
Credit.allowEdit(false);
}
if(GG_FPJVoucher::FindVoucher(GG_FPJVoucher_voucher.text()).BIT_Credit == noyes::Yes)
{
Credit.value(noyes::Yes);
Advance.allowEdit(false);
Retention.allowEdit(false);
Cash.allowEdit(false);
Credit.allowEdit(false);
}
if(GG_FPJVoucher_FPJVoucherType.selection() == GG_FPJVoucherType::CashReceipt)
{
Advance.allowEdit(true);
Retention.allowEdit(true);
Cash.allowEdit(true);
credit.allowEdit(false);
}
if(GG_FPJVoucher_FPJVoucherType.selection() != GG_FPJVoucherType::CashReceipt)
{
Advance.allowEdit(false);
Retention.allowEdit(true);
Cash.allowEdit(false);
Credit.allowEdit(true);
}
// ended by adit
}
return ret;
}
0 comments:
Post a Comment