How to create CheckHed through PaymentEntryAdapter with code?

I want to create PaymentEntry through Erp.Adapters.PaymentEntryAdapter with code because I have used a UD18 table to store the necessary information to create PaymentEntry now in PaymentEntry screen I add an action to create PaymentEntry from the data already in UD18 Limit data entry many times leading to errors

EpiDataView view= oTrans.EpiDataViews["CheckHed"] as EpiDataView;
			
			Erp.BO.PaymentEntryDataSet paymentEntryTableset = adapterPaymentEntry.PaymentEntryData;			
			EpiDataView edvCheckHed = ((EpiDataView)(this.oTrans.EpiDataViews["CheckHed"]));
			//DataTable dtbCheckHed = edvCheckHed.dataView.Table.Clone();	
			DataTable dtbCheckHed = paymentEntryTableset.CheckHed.Clone();				
			//Add Row to DataTable
			DataRow defaultRow = dtbCheckHed.NewRow();
			defaultRow["Company"] = "01";
			defaultRow["GroupID"] = "ct1";
			defaultRow["BankAcctID"] = "11111";
			defaultRow["FiscalYear"] = 2022;
			defaultRow["FiscalPeriod"] = "8";
			defaultRow["CheckSrc"] = "2";
			defaultRow["CheckDate"] = System.DateTime.Now;
			defaultRow["VendorNum"] = 4605;
			defaultRow["Name"] = "CÔNG TY TNHH NHỰA KỸ THUẬT SING VIỆT";
			defaultRow["CheckAmt"] = 33000000;
			defaultRow["DocCheckAmt"] = 33000000;
			defaultRow["CurrencyCode"] = "VND";			
			dtbCheckHed.Rows.Add(defaultRow);
			edvCheckHed.dataView = dtbCheckHed.DefaultView;			
			oTrans.Add("CheckHed", edvCheckHed);
			
			// Cleanup Adapter Reference
			adapterPaymentEntry.Dispose();

:thinking: :thinking:
Thank you! Have a nice day!

You need to do a trace and follow it

1 Like