|
???File Path
|
|
==========
|
|
***...\ClientApp\srcpp\src\account\paid-cheque-return\paid-cheque-return.component.ts
|
|
|
|
|
|
???Check the points
|
|
==================
|
|
1) Check ...\ClientApp\srcpp\srcaseranchranch.component.ts and ...\ClientApp\srcpp\srcase\company\company.component.ts
|
|
2) Main Grouping Must
|
|
-> // @@@@@@@ AREA=> FROM HTML INPUT AREA Called Functions(Not Button bar and List) @@@@@@@@@@@@@@
|
|
-> // @@@@@@@ FROM HTML MAIN LIST Called Functions @@@@@@@@@@@@@@
|
|
-> // @@@@@@@ AREA=> FROM HTML BUTTON BAR Called Functions @@@@@@@@@@@@@@
|
|
-> // @@@@@@@ AREA=> COMMON Functions @@@@@@@@@@@@@@
|
|
3) Set GUI Heading in constructor(Eg:- insGlobalConstants.strGuiHeading = "***";)
|
|
4) Set GUI/Menu System Name in constructor(Eg:- insGlobalConstants.strSysModuleName = "***";) based on menu service
|
|
5) Set GUI Tittle(Browser Tab) in constructor(Eg:- insGlobalFunctions.fnSetGuiBasedBrowserTitle = "***";)
|
|
|
|
|
|
|
|
// ??? Check and Use If you need...
|
|
//---------------------------------
|
|
import { Component, OnInit, AfterViewInit, OnDestroy, ViewChild } from '@angular/core';
|
|
import { DxDataGridComponent } from "devextreme-angular";
|
|
|
|
import * as globalConstantsService from '../../../services/global-constants.service';
|
|
import * as globalFunctionsService from '../../../services/global-functions.service';
|
|
import * as globalDataService from '../../../services/global-data.service';
|
|
import * as baseDataService from '../../../services/base/base-data.service';
|
|
import * as jspdfService from '../../../services/jspdf.service';
|
|
import * as menuService from '../../../services/menu.service';
|
|
import { MdlPaidChequeReturn, MdlReqPaidChequeReturn, MdlResPaidChequeReturn, MdlResPaidChequeReturnInit, MdlResPaidChequeReturnList } from '../../../models/account/paidcheque.model';
|
|
import { MdlResponse, MdlBaseIntId, MdlReqBaseIntId } from "../../../models/common.model";
|
|
import { HttpService } from '../../../services/http.service';
|
|
|
|
|
|
|
|
// ??? Check and Use If you need...
|
|
//---------------------------------
|
|
export class PaidChequeReturnComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
// ** initialize data
|
|
public mdlPaidChequeReturn: MdlPaidChequeReturn = new MdlPaidChequeReturn();
|
|
public intActivePaidChequeReturnIndex: number = -1;
|
|
// ** Select and Auto-completion
|
|
// ??? Remove not use items !!!
|
|
lstMdlDocumentsBaseIntId: MdlBaseIntId[] = [];
|
|
lstMdlPaidChequeBaseIntId: MdlBaseIntId[] = [];
|
|
lstMdlPaidChequeDetailsBaseIntId: MdlBaseIntId[] = [];
|
|
lstMdlBankChargeBaseIntId: MdlBaseIntId[] = [];
|
|
lstMdlBankCrCustomerBaseIntId: MdlBaseIntId[] = [];
|
|
lstMdlBankExpenseBaseIntId: MdlBaseIntId[] = [];
|
|
lstMdlServiceTaxBaseIntId: MdlBaseIntId[] = [];
|
|
|
|
// ** GUI Control
|
|
public blnBtnDisabled: boolean = false;
|
|
public blnMoreDivExpanded: boolean = false;
|
|
// ** PaidChequeReturn List
|
|
@ViewChild('#idDgPaidChequeReturnList') idDgPaidChequeReturnList!: DxDataGridComponent;
|
|
public lstAllPaidChequeReturn: MdlPaidChequeReturn[] = [];
|
|
public blnDgPaidChequeReturnShowFilterRow: boolean = false;
|
|
public blnDgPaidChequeReturnHeaderFilter: boolean = false;
|
|
public intActivePaidChequeReturnListItemIndex = -1;
|
|
|
|
|
|
|
|
// ??? If you need, import and create instance other common classes !!!
|
|
constructor(public insGlobalConstants: globalConstantsService.GlobalConstantsService,
|
|
public insGlobalFunctions: globalFunctionsService.GlobalFunctionsService,
|
|
public insGlobalData: globalDataService.GlobalDataService,
|
|
public insBaseData: baseDataService.BaseDataService,
|
|
private insHttpService: HttpService,
|
|
public insJspdf: jspdfService.JspdfService) {
|
|
|
|
insGlobalConstants.strGuiHeading = 'paidChequeReturn';
|
|
// ??? Check menu service !!!
|
|
insGlobalConstants.strSysModuleName = "PAIDCHEQUERETURN_MASTER";
|
|
insGlobalFunctions.fnSetGuiBasedBrowserTitle("PaidChequeReturn");
|
|
}
|
|
|
|
ngOnInit(): void {
|
|
this.blnBtnDisabled = true;
|
|
document.body.style.cursor = "wait";
|
|
|
|
this.fnDefaultView();
|
|
|
|
// initialize Data Request
|
|
this.insHttpService.get('Base/Organization/GetPaidChequeReturnInitializeData')
|
|
.then((mdlResPaidChequeReturnInit: MdlResPaidChequeReturnInit) => {
|
|
if (mdlResPaidChequeReturnInit.sinStatus == 1) {
|
|
this.lstMdlPaidChequeReturn = mdlResPaidChequeReturnInit.lstMdlPaidChequeReturn;
|
|
|
|
// ??? Remove not use items !!!
|
|
this.lstMdlDocumentsBaseIntId = mdlResPaidChequeReturnInit.lstMdlDocumentsBaseIntId;
|
|
this.lstMdlPaidChequeBaseIntId = mdlResPaidChequeReturnInit.lstMdlPaidChequeBaseIntId;
|
|
this.lstMdlPaidChequeDetailsBaseIntId = mdlResPaidChequeReturnInit.lstMdlPaidChequeDetailsBaseIntId;
|
|
this.lstMdlBankChargeBaseIntId = mdlResPaidChequeReturnInit.lstMdlBankChargeBaseIntId;
|
|
this.lstMdlBankCrCustomerBaseIntId = mdlResPaidChequeReturnInit.lstMdlBankCrCustomerBaseIntId;
|
|
this.lstMdlBankExpenseBaseIntId = mdlResPaidChequeReturnInit.lstMdlBankExpenseBaseIntId;
|
|
this.lstMdlServiceTaxBaseIntId = mdlResPaidChequeReturnInit.lstMdlServiceTaxBaseIntId;
|
|
|
|
} else {
|
|
console.log(mdlResPaidChequeReturnInit.strMessage + " => " + mdlResPaidChequeReturnInit.strErrorCode + ' -> ' + mdlResPaidChequeReturnInit.strSysError);
|
|
}
|
|
})
|
|
.catch((err: any) => {
|
|
console.log("Error->PAIDCHEQUERETURN.COMPONENT.TS#001: " + JSON.stringify(err));
|
|
});
|
|
|
|
document.body.style.cursor = "default";
|
|
this.blnBtnDisabled = false;
|
|
}
|
|
|
|
ngAfterViewInit(): void {
|
|
}
|
|
|
|
ngOnDestroy() {
|
|
}
|
|
|
|
|
|
|
|
// @@@@@@@ AREA=> FROM HTML INPUT AREA Called Functions(Not Button bar and List) @@@@@@@@@@@@@
|
|
|
|
|
|
// ??? AUTO/ENTRY COMPLETE - Set Id[, Code, Name] -> OnFocusOut Event
|
|
|
|
// ??? Any caculation/Display Based on user inputs
|
|
|
|
|
|
|
|
|
|
// @@@@@@@@@@@@@@@@@@@@@@@ AREA=> FROM HTML MAIN LIST Called Functions @@@@@@@@@@@@@@@@@@@@@@@@
|
|
|
|
fnOnPaidChequeReturnListEditButtonClick(objSelRow: any) {
|
|
this.blnBtnDisabled = true;
|
|
document.body.style.cursor = "wait";
|
|
|
|
this.fnSetDataAndGuiEditMode(objSelRow.row.data, objSelRow.row.rowIndex);
|
|
|
|
document.body.style.cursor = "default";
|
|
this.blnBtnDisabled = false;
|
|
}
|
|
|
|
fnOnPaidChequeReturnListRowDblClick(objDblClickRowData: any) {
|
|
this.blnBtnDisabled = true;
|
|
document.body.style.cursor = "wait";
|
|
|
|
this.fnSetDataAndGuiEditMode(objDblClickRowData.data, objDblClickRowData.rowIndex);
|
|
|
|
document.body.style.cursor = "default";
|
|
this.blnBtnDisabled = false;
|
|
}
|
|
|
|
fnOnDgFilterRowEnableDisableClick() {
|
|
this.blnDgShowFilterRow = !this.blnDgShowFilterRow;
|
|
}
|
|
|
|
fnOnDgHeadeFilterEnableDisableClick() {
|
|
this.blnDgHeaderFilter = !this.blnDgHeaderFilter;
|
|
}
|
|
|
|
|
|
|
|
// @@@@@@@@@@@@@@@@@@@@@@ AREA=> FROM HTML BUTTON BAR Called Functions @@@@@@@@@@@@@@@@@@@@@@@@
|
|
|
|
async fnOnSaveButtonClick() {
|
|
this.blnBtnDisabled = true;
|
|
document.body.style.cursor = "wait";
|
|
this.fnDefaultView(false, true, true, false);
|
|
|
|
// Add or Update
|
|
try {
|
|
// Input Validation
|
|
this.fnInputValidation(this.mdlPaidChequeReturn);
|
|
|
|
// Input Data set
|
|
//....
|
|
|
|
// Set Save Request Inputs
|
|
let mdlReqPaidChequeReturn: MdlReqPaidChequeReturn = new MdlReqPaidChequeReturn();
|
|
mdlReqPaidChequeReturn.mdlPaidChequeReturn = JSON.parse(JSON.stringify(this.mdlPaidChequeReturn));
|
|
|
|
// Request Data Reset
|
|
//....
|
|
|
|
// Save Request
|
|
await this.insHttpService.post('Base/Organization/SavePaidChequeReturn', mdlReqPaidChequeReturn)
|
|
.then((mdlResPaidChequeReturn: MdlResPaidChequeReturn) => {
|
|
if (mdlResPaidChequeReturn.sinStatus == 1) {
|
|
this.mdlPaidChequeReturn = mdlResPaidChequeReturn.mdlPaidChequeReturn;
|
|
if (this.intActivePaidChequeReturnIndex == -1) {
|
|
// New Item
|
|
this.intActivePaidChequeReturnIndex = this.lstMdlPaidChequeReturn.length;
|
|
this.lstMdlPaidChequeReturn.push(JSON.parse(JSON.stringify(this.mdlPaidChequeReturn)));
|
|
}
|
|
else {
|
|
// Update
|
|
this.lstMdlPaidChequeReturn[this.intActivePaidChequeReturnIndex] = JSON.parse(JSON.stringify(this.mdlPaidChequeReturn));
|
|
//this.lstMdlPaidChequeReturn.splice(this.intActivePaidChequeReturnIndex, 1, this.mdlPaidChequeReturn);
|
|
}
|
|
|
|
this.insGlobalConstants.fnSetSuccessMessage(mdlResPaidChequeReturn.strMessage);
|
|
} else {
|
|
this.insGlobalConstants.fnSetErrorMessage(mdlResPaidChequeReturn.strMessage, mdlResPaidChequeReturn.strSysError);
|
|
console.log(mdlResPaidChequeReturn);
|
|
}
|
|
})
|
|
.catch((err: any) => {
|
|
this.insGlobalConstants.fnSetErrorMessage(JSON.stringify(err));
|
|
});
|
|
|
|
} catch (ex: unknown) {
|
|
if (ex instanceof Error) {
|
|
//this.insGlobalConstants.strErrorMessages = ex.message;
|
|
this.insGlobalConstants.fnSetErrorMessage(ex.message);
|
|
}
|
|
console.log("Error->PAIDCHEQUERETURN.COMPONENT.TS#002: " + ex);
|
|
}
|
|
|
|
this.fnDefaultView(false, false, true, false);
|
|
document.body.style.cursor = "default";
|
|
this.blnBtnDisabled = false;
|
|
}
|
|
|
|
fnOnNewButtonClick() {
|
|
this.blnBtnDisabled = true;
|
|
document.body.style.cursor = "wait";
|
|
|
|
this.fnDefaultView(true, true, true, false);
|
|
|
|
document.body.style.cursor = "default";
|
|
this.blnBtnDisabled = false;
|
|
}
|
|
|
|
async fnOnDeleteButtonClick() {
|
|
this.blnBtnDisabled = true;
|
|
document.body.style.cursor = "wait";
|
|
this.fnDefaultView(false, true, false, false);
|
|
|
|
// Delete
|
|
try {
|
|
|
|
// Input Validation
|
|
if (this.mdlPaidChequeReturn.binPaidChequeReturnId == null || this.mdlPaidChequeReturn.binPaidChequeReturnId < 1) {
|
|
throw new Error('Select PaidChequeReturn for DELETE.');
|
|
}
|
|
|
|
// Set Delete Request Inputs
|
|
let mdlReqPaidChequeReturnBaseIntId: MdlReqBaseIntId = new MdlReqBaseIntId();
|
|
mdlReqPaidChequeReturnBaseIntId.mdlBaseIntId.binPkId = this.mdlPaidChequeReturn.binPaidChequeReturnId;
|
|
mdlReqPaidChequeReturnBaseIntId.mdlBaseIntId.binCustomValue = this.mdlPaidChequeReturn.intSysActionId;
|
|
|
|
// Delete Request
|
|
await this.insHttpService.post('Base/Organization/DeletePaidChequeReturn', mdlReqPaidChequeReturnBaseIntId)
|
|
.then((mdlResponse: MdlResponse) => {
|
|
if (mdlResponse.sinStatus == 1) {
|
|
this.lstMdlPaidChequeReturn.splice(this.intActivePaidChequeReturnIndex, 1);
|
|
this.fnDefaultView(true, false, false, false);
|
|
this.insGlobalConstants.fnSetSuccessMessage(mdlResponse.strMessage);
|
|
} else {
|
|
this.insGlobalConstants.fnSetErrorMessage(mdlResponse.strMessage, mdlResponse.strSysError);
|
|
console.log(mdlResponse);
|
|
}
|
|
})
|
|
.catch((err: any) => {
|
|
this.insGlobalConstants.fnSetErrorMessage(JSON.stringify(err));
|
|
});
|
|
|
|
} catch (ex: unknown) {
|
|
if (ex instanceof Error) {
|
|
this.insGlobalConstants.fnSetErrorMessage(ex.message);
|
|
}
|
|
console.log("Error->PAIDCHEQUERETURN.COMPONENT.TS#003: " + ex);
|
|
}
|
|
|
|
document.body.style.cursor = "default";
|
|
this.blnBtnDisabled = false;
|
|
}
|
|
|
|
|
|
|
|
|
|
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ AREA=> COMMON Functions @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
|
|
|
|
fnDefaultView(blnClearData: boolean = true, blnClearMessages: boolean = true, blnMoreDivExpanded: boolean = false, blnGotoBottom: boolean = false) {
|
|
if (blnClearData) {
|
|
this.mdlPaidChequeReturn = new MdlPaidChequeReturn();
|
|
this.intActivePaidChequeReturnIndex = -1;
|
|
}
|
|
|
|
this.blnMoreDivExpanded = blnMoreDivExpanded;
|
|
|
|
if (blnClearMessages) {
|
|
this.insGlobalConstants.strErrorMessages = "";
|
|
this.insGlobalConstants.strSuccessMessages = "";
|
|
}
|
|
|
|
if (!blnGotoBottom)
|
|
this.insGlobalFunctions.fnWindowScrollTop();
|
|
else {
|
|
this.insGlobalFunctions.fnWindowScrollbottom();
|
|
}
|
|
}
|
|
|
|
fnSetDataAndGuiEditMode(mdlPaidChequeReturn: MdlPaidChequeReturn, intRowIndex: number) {
|
|
this.mdlPaidChequeReturn = JSON.parse(JSON.stringify(mdlPaidChequeReturn));
|
|
this.intActivePaidChequeReturnIndex = intRowIndex;
|
|
this.fnDefaultView(false, true, true, false);
|
|
}
|
|
|
|
fnInputValidation(mdlPaidChequeReturn: MdlPaidChequeReturn) {
|
|
// ??? CHECK
|
|
|
|
if (mdlPaidChequeReturn.binDocumentsId == 0) {
|
|
throw new Error('Enter/Select Documents.');
|
|
}
|
|
|
|
if (mdlPaidChequeReturn.binPaidChequeId == 0) {
|
|
throw new Error('Enter/Select Paid Cheque.');
|
|
}
|
|
|
|
if (mdlPaidChequeReturn.binPaidChequeDetailsId == 0) {
|
|
throw new Error('Enter/Select Paid Cheque Details.');
|
|
}
|
|
|
|
|
|
// ??? CHECK CODE and NAME [Other UNIQUE Fields] Already exists
|
|
}
|
|
|
|
|