public static Credit[] GetByVoucherCreditID(int voucher_entity_id, bool inc_deleted = false) { DataTable tbl = GetDataTable_ByVoucherCreditID(voucher_entity_id, inc_deleted); Credit[] list = new Credit[tbl.Rows.Count]; for (int i = 0; i < tbl.Rows.Count; i++) { list[i] = CreditDB.LoadAll(tbl.Rows[i]); } return(list); }
public static Credit[] GetByEntityID(int entity_id, string credit_type_ids = null, bool inc_deleted = false) { DataTable tbl = GetDataTable_ByEntityID(entity_id, credit_type_ids, inc_deleted); Credit[] list = new Credit[tbl.Rows.Count]; for (int i = 0; i < tbl.Rows.Count; i++) { list[i] = CreditDB.LoadAll(tbl.Rows[i]); } return(list); }
public static Credit[] GetByInvoiceID(int invoice_id) { DataTable tbl = GetDataTable_ByInvoiceID(invoice_id); Credit[] list = new Credit[tbl.Rows.Count]; for (int i = 0; i < tbl.Rows.Count; i++) { list[i] = CreditDB.LoadAll(tbl.Rows[i]); } return(list); }
protected void Repeater19_ItemCreated(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { DataRowView dr = (DataRowView)e.Item.DataItem; if (dr == null || dr.Row == null) { return; } DataRow row = dr.Row; Invoice invoice = InvoiceDB.LoadAll(row); // get controls Repeater lstVouchers = (Repeater)e.Item.FindControl("lstVouchers"); HtmlGenericControl div_vouchers_list = (HtmlGenericControl)e.Item.FindControl("div_vouchers_list"); HtmlGenericControl span_vouchers_trailing_space_row = (HtmlGenericControl)e.Item.FindControl("span_vouchers_trailing_space_row"); Label lnkAddVoucher = (Label)e.Item.FindControl("lnkAddVoucher"); LinkButton showHideVouchersList = (LinkButton)e.Item.FindControl("showHideVouchersList"); // get refunds DataTable tblCredit = CreditDB.GetDataTable_ByInvoiceID(invoice.InvoiceID); lstVouchers.Visible = tblCredit.Rows.Count > 0; span_vouchers_trailing_space_row.Visible = tblCredit.Rows.Count > 0; if (tblCredit.Rows.Count > 0) { tblCredit.Columns.Add("voucher_url", typeof(string)); tblCredit.Columns.Add("show_status", typeof(string)); tblCredit.Columns.Add("status", typeof(string)); tblCredit.Columns.Add("show_reconcile_link", typeof(string)); tblCredit.Columns.Add("reconcile_link", typeof(string)); tblCredit.Columns.Add("show_reverse_link", typeof(string)); for (int i = 0; i < tblCredit.Rows.Count; i++) { Credit voucher = CreditDB.LoadAll(tblCredit.Rows[i]); tblCredit.Rows[i]["voucher_url"] = voucher.GetViewVoucherUsePopupLinkV2(); bool isReversed = voucher.IsDeleted; tblCredit.Rows[i]["status"] = "Reversed"; tblCredit.Rows[i]["show_status"] = isReversed ? "1" : "0"; tblCredit.Rows[i]["reconcile_link"] = ""; tblCredit.Rows[i]["show_reverse_link"] = voucher.IsDeleted ? "0" : "1"; } lstVouchers.DataSource = tblCredit; lstVouchers.DataBind(); } if (!invoice.IsPaID) // can add items { lnkAddVoucher.Text = Receipt.GetAddReceiptPopupLinkV2(invoice.InvoiceID, "Add Voucher Use", "window.location.href = window.location.href;"); } else { lnkAddVoucher.Text = tblCredit.Rows.Count > 0 ? string.Empty : "No Vouchers"; } //span_add_vouchers_row.Style["text-align"] = (tblReciepts.Rows.Count > 0) ? "center" : null; // if have table, center add link, else left align lnkAddVoucher.Visible = lnkAddVoucher.Text.Length > 0; showHideVouchersList.OnClientClick = "javascript:show_hide_byname('div_vouchers_list_" + invoice.InvoiceID + "'); return false;"; showHideVouchersList.Visible = tblCredit.Rows.Count > 0; div_vouchers_list.Attributes["name"] = "div_vouchers_list_" + invoice.InvoiceID; } }