Last active
March 22, 2023 16:55
-
-
Save bayramcetin/0d2af34d5631e4b2255a664d0e453e37 to your computer and use it in GitHub Desktop.
Dict class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BoraxLegalDiscountsProcess | |
{ | |
BoraxLegalDiscounts tmp, tmpGroup; | |
SysDictClass dictClass; | |
BorAxYear borAxYear; | |
BorAxMonth borAxMonth; | |
BoraxEmplId boraxEmplId; | |
BorAXDivision borAXDivision; | |
TransDate transDate; | |
BorAXJournalTransType borAXJournalTransType; | |
BorAXBudgetCodeId budgetCodeIdForisQueryPromptIsFalse; | |
FromDate fromDate; | |
BorAXJournalTrans firstBorAXJournalTrans, firstBorAXJournalTransIncomeTax, firstBorAXJournalTrans05746; | |
public BorAXBudgetCodeId parmBudgetCodeIdForisQueryPromptIsFalse(BorAXBudgetCodeId _budgetCodeIdForisQueryPromptIsFalse = budgetCodeIdForisQueryPromptIsFalse) | |
{ | |
budgetCodeIdForisQueryPromptIsFalse = _budgetCodeIdForisQueryPromptIsFalse; | |
return budgetCodeIdForisQueryPromptIsFalse; | |
} | |
private BorAXEmplTable boraxEmplTable(BoraxLegalDiscounts _tmp, BoraxEmplId emplId) | |
{ | |
//... | |
} | |
public void boraxJournalTrans(BorAXJournalTrans borAXJournalTrans) | |
{ | |
//... | |
} | |
private void calc05510Discount( | |
BorAXJournalTrans borAXJournalTrans, | |
BorAXEmplTable borAXEmplTable, | |
BorAXDivisionParameters borAXDivisionParameters, | |
BorAxCPSSKLaws borAxCPSSKLaws) | |
{ | |
//... | |
} | |
//arge methodu | |
private void calc05746Discount( | |
BorAXJournalTrans borAXJournalTrans, | |
BorAXEmplTable borAXEmplTable, | |
BorAXDivisionParameters borAXDivisionParameters, | |
BorAxCPSSKLaws borAxCPSSKLaws) | |
{ | |
//... | |
} | |
private void calc17103Discount( | |
BorAXJournalTrans borAXJournalTrans, | |
BorAXEmplTable borAXEmplTable, | |
BorAXDivisionParameters borAXDivisionParameters, | |
BorAxCPSSKLaws borAxCPSSKLaws) | |
{ | |
//... | |
} | |
private void calc27103Discount( | |
BorAXJournalTrans borAXJournalTrans, | |
BorAXEmplTable borAXEmplTable, | |
BorAXDivisionParameters borAXDivisionParameters, | |
BorAxCPSSKLaws borAxCPSSKLaws) | |
{ | |
//... | |
} | |
private void calcAmountDiscount( | |
BorAXJournalTrans borAXJournalTrans, | |
BorAXEmplTable borAXEmplTable, | |
BorAXDivisionParameters borAXDivisionParameters, | |
BorAxCPSSKLaws borAxCPSSKLaws) | |
{ | |
//... | |
} | |
private void calcDiscount(QueryRun queryRun) | |
{ | |
BorAXEmplTable borAXEmplTable; | |
BorAXJournalTrans borAXJournalTrans; | |
BorAXDivisionParameters borAXDivisionParameters; | |
BorAxCPSSKLaws borAxCPSSKLaws; | |
BoraxRDTrans boraxRDTrans; | |
boolean isRun; | |
str methodName; | |
int countJournalByEmpl; | |
while (queryRun.next()) | |
{ | |
if(!isRun) | |
{ | |
if(!this.validate(queryRun)) | |
break; | |
isRun = true; | |
} | |
borAXJournalTrans = queryRun.get(tableNum(BorAXJournalTrans)); | |
tmp.clear(); | |
this.boraxJournalTrans(borAXJournalTrans); | |
fromDate = mkDate(1, tmp.BorAxMonth, tmp.BorAxYear); | |
borAXEmplTable = this.boraxEmplTable(tmp, borAXJournalTrans.EmplId); | |
borAXDivisionParameters = BorAXDivisionParameters::find(borAXJournalTrans.BorAXDivision); | |
borAxCPSSKLaws = this.getSSILaw(tmp, borAXEmplTable); | |
boraxRDTrans = BoraxRDTrans::find(tmp.BorAxYear, tmp.BorAxMonth, tmp.EmplId, tmp.BudgetCodeId); | |
tmp.RDDays = boraxRDTrans.RDDays; | |
if(borAXEmplTable.PyrStatusCode && boraxRDTrans.RDDays > 0) | |
{ | |
//gelir vergisi | |
this.calcDiscountIncomeTax(borAXJournalTrans, borAXEmplTable, borAXDivisionParameters, boraxRDTrans); | |
//damga vergisi | |
this.calcDiscountStampTax(borAXJournalTrans, borAXEmplTable, borAXDivisionParameters, boraxRDTrans); | |
} | |
if(tmp.SSILawId2) | |
{ | |
methodName = strFmt("calc%1Discount", tmp.SSILawId2); | |
} | |
else if(tmp.SSILawId1) | |
{ | |
methodName = strFmt("calc%1Discount", tmp.SSILawId1); | |
} | |
if (dictClass.hasObjectMethod(methodName)) | |
{ | |
//kanuna özel method varsa çalışacak | |
dictClass.callObject(methodName, this, borAXJournalTrans, borAXEmplTable, borAXDivisionParameters, borAxCPSSKLaws); | |
} | |
else | |
{ | |
//method yoksa ortak methodlar çalışacak | |
switch (borAxCPSSKLaws.BoraxSGKDiscType) | |
{ | |
case BoraxSGKDiscType::Rate: | |
this.calcPercentDiscount(borAXJournalTrans, borAXEmplTable, borAXDivisionParameters, borAxCPSSKLaws); | |
break; | |
case BoraxSGKDiscType::Amount: | |
this.calcAmountDiscount(borAXJournalTrans, borAXEmplTable, borAXDivisionParameters, borAxCPSSKLaws); | |
break; | |
} | |
} | |
tmp = this.calcDiscountCOC(tmp); | |
tmp.insert(); | |
} | |
} | |
public BoraxLegalDiscounts calcDiscountCOC(BoraxLegalDiscounts _tmp) | |
{ | |
return _tmp; | |
} | |
//gelir vergisi | |
private void calcDiscountIncomeTax( | |
BorAXJournalTrans borAXJournalTrans, | |
BorAXEmplTable borAXEmplTable, | |
BorAXDivisionParameters borAXDivisionParameters, | |
BoraxRDTrans boraxRDTrans) | |
{ | |
//... | |
} | |
/// <summary> | |
/// GVM'den indirimlerin düşüldüğü method | |
/// </summary> | |
/// <param name = "_amount"></param> | |
/// <param name = "_borAXJournalTrans"></param> | |
/// <returns></returns> | |
private Amount BoraxRDIncomeTaxDiscount(Amount _amount, BorAXJournalTrans _borAXJournalTrans) | |
{ | |
//... | |
} | |
//Damga vergisi | |
private void calcDiscountStampTax( | |
BorAXJournalTrans borAXJournalTrans, | |
BorAXEmplTable borAXEmplTable, | |
BorAXDivisionParameters borAXDivisionParameters, | |
BoraxRDTrans boraxRDTrans) | |
{ | |
//... | |
} | |
//Oransal teşvikler buradan hesaplanır | |
private void calcPercentDiscount( | |
BorAXJournalTrans borAXJournalTrans, | |
BorAXEmplTable borAXEmplTable, | |
BorAXDivisionParameters borAXDivisionParameters, | |
BorAxCPSSKLaws borAxCPSSKLaws) | |
{ | |
//... | |
} | |
private Query createQuery() | |
{ | |
//... | |
} | |
private BorAxCPSSKLaws getSSILaw(BoraxLegalDiscounts _tmp, BorAXEmplTable borAXEmplTable) | |
{ | |
BorAxCPSSKLaws borAxCPSSKLaws; | |
BoraxEmplSGKLaw boraxEmplSGKLaw; | |
EndDate endDate; | |
endDate = mkDate(31, _tmp.BorAxMonth, _tmp.BorAxYear); | |
if(_tmp.BudgetCodeId == "") | |
{ | |
select boraxEmplSGKLaw | |
where boraxEmplSGKLaw.EmplId == _tmp.EmplId | |
&& boraxEmplSGKLaw.StartDate <= mkDate(1,_tmp.BorAxMonth,_tmp.BorAxYear) | |
&& boraxEmplSGKLaw.EndDate >= mkDate(31,_tmp.BorAxMonth,_tmp.BorAxYear) | |
&& boraxEmplSGKLaw.BudgetCodeId == _tmp.BudgetCodeId; | |
} | |
else | |
{ | |
select boraxEmplSGKLaw | |
order by StartDate desc | |
where boraxEmplSGKLaw.EmplId == _tmp.EmplId | |
&& boraxEmplSGKLaw.StartDate <= mkDate(1,_tmp.BorAxMonth,_tmp.BorAxYear); | |
} | |
if (boraxEmplSGKLaw.DefSGKLawId != "") | |
{ | |
if(boraxEmplSGKLaw.BoraxSGKLawId == "17103" || boraxEmplSGKLaw.BoraxSGKLawId == "27103" || boraxEmplSGKLaw.BoraxSGKLawId == "37103") | |
{ | |
_tmp.SSILawId1 = boraxEmplSGKLaw.BoraxSGKLawId; | |
} | |
else | |
{ | |
_tmp.SSILawId1 = boraxEmplSGKLaw.DefSGKLawId; | |
_tmp.SSILawId2 = boraxEmplSGKLaw.BoraxSGKLawId; | |
} | |
} | |
else | |
{ | |
_tmp.SSILawId1 = boraxEmplSGKLaw.BoraxSGKLawId; | |
} | |
if (_tmp.SSILawId1) | |
{ | |
borAxCPSSKLaws = BorAxCPSSKLaws::find(_tmp.SSILawId1); | |
_tmp.SSILawRate1 = borAxCPSSKLaws.DiscountPercent; | |
} | |
if (_tmp.SSILawId2) | |
{ | |
borAxCPSSKLaws = BorAxCPSSKLaws::find(_tmp.SSILawId2); | |
_tmp.SSILawRate2 = borAxCPSSKLaws.DiscountPercent; | |
} | |
return borAxCPSSKLaws; | |
} | |
public BoraxLegalDiscounts getTmp() | |
{ | |
return tmpGroup; | |
} | |
//fiili gün ve kalan güne göre matrah iki parça olarak hesaplanır. | |
private Percent ifForeign(BorAXJournalTrans borAXJournalTrans, BorAXDivisionParameters borAXDivisionParameters, Percent DiscRate, Amount SSIBase) | |
{ | |
//... | |
} | |
public BorAXDivision parmBorAXDivision(BorAXDivision _borAXDivision = borAXDivision) | |
{ | |
borAXDivision = _borAXDivision; | |
return borAXDivision; | |
} | |
public BoraxEmplId parmBoraxEmplId(BoraxEmplId _boraxEmplId = boraxEmplId) | |
{ | |
boraxEmplId = _boraxEmplId; | |
return boraxEmplId; | |
} | |
public BorAxMonth parmBorAxMonth(BorAxMonth _borAxMonth = borAxMonth) | |
{ | |
borAxMonth = _borAxMonth; | |
return borAxMonth; | |
} | |
public BorAxYear parmBorAxYear(BorAxYear _borAxYear = borAxYear) | |
{ | |
borAxYear = _borAxYear; | |
return borAxYear; | |
} | |
public TransDate parmTransDate(TransDate _transDate = transDate) | |
{ | |
transDate = _transDate; | |
return transDate; | |
} | |
public BorAXJournalTransType parmBorAXJournalTransType(BorAXJournalTransType _borAXJournalTransType = borAXJournalTransType) | |
{ | |
borAXJournalTransType = _borAXJournalTransType; | |
return borAXJournalTransType; | |
} | |
private Amount rdDaysRate(BoraxRDTrans boraxRDTrans, Amount amount) | |
{ | |
//... | |
} | |
public void run(boolean isQueryPrompt) | |
{ | |
QueryRun queryRun; | |
dictClass = new SysDictClass(classNum('BoraxLegalDiscountsProcess')); | |
if (isQueryPrompt == false) | |
{ | |
queryRun = new QueryRun(this.createQuery()); | |
this.calcDiscount(queryRun); | |
} | |
else | |
{ | |
this.parmBorAxYear(year(borAXGetToday())); | |
this.parmBorAxMonth(mthOfYr(borAXGetToday())); | |
queryRun = new QueryRun(this.createQuery()); | |
if (queryRun.prompt()) | |
{ | |
this.calcDiscount(queryRun); | |
} | |
} | |
this.tmpGroup(); | |
} | |
//varsayılan groupBy method | |
private void tmpGroup() | |
{ | |
//... | |
} | |
public BoraxLegalDiscounts tmpGroupCOC(BoraxLegalDiscounts _tmpGroup) | |
{ | |
return _tmpGroup; | |
} | |
private boolean validate(QueryRun queryRun) | |
{ | |
//... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment