private static Print_InvoiceList ReturnInvoice(string Id, List <PrintCopies> printcopies) { Const.Invoice invoice = CInvoice_exten.PKId(Id); List <Invoiceitems> invoiceitems = CInvoiceitems_exten.FKId(Id); Company company = CCompany_exten.PKId(Current.Company_id); Party party = CParty_exten.SearchName(invoice.Party_id, new DAL()); Company_bank cmpbank = CCompany_bank_exten.PKId("1"); Print_InvoiceList list = new Print_InvoiceList(); for (int i = 0; i < printcopies.Count; i++) { Print_Invoice row = new Print_Invoice(); row.COPY_NAME = printcopies[i].Copies; row.SALES_TYPE = invoice.Salestype_id; row.TAX_TYPE = invoice.Taxtype_id; row.COMPANY_NAME = company.Display_name; row.COMPANY_ADDRESS_1 = company.Street1 + ", " + company.Street2; row.COMPANY_ADDRESS_2 = company.City_id + "- " + company.Pincode_id + ", " + company.State_id + " - (" + Ccoreplus.GetStateCode(company.State_id) + ") . Email :- " + company.Email; row.COMPANY_PHONE = company.Phone; row.COMPANY_CELL1 = company.Cell1; row.COMPANY_CELL2 = company.Cell2; row.COMPANY_EMAIL = company.Email; row.COMPANY_WEBSITE = company.Website; if (company.Gstin.Trim().Length != 0) { row.COMPANY_GSTIN = "GSTIN : " + company.Gstin; if (company.Cell1.Trim().Length != 0) { row.COMPANY_GSTIN = "GSTIN : " + company.Gstin + " , Mobile : " + company.Cell1; if (company.Cell2.Trim().Length != 0) { row.COMPANY_GSTIN = "GSTIN : " + company.Gstin + " , Mobile : " + company.Cell1 + ", " + company.Cell2; } } } else { row.COMPANY_GSTIN = ""; } row.INVOICE_ID = invoice.Invoice_id; row.INVOICE_NO = ":. " + invoice.Invoice_no; row.INVOICE_DATE = ": " + ConvertTO.Date2S(invoice.Invoice_date); row.TRANSPORT = ": " + invoice.Transport_id; row.DELIVERYTO = ": " + invoice.Deliveredto_id; row.BUNDEL = ": " + invoice.Bundel; row.PARTY_NAME = party.Party_name; row.PARTY_STREET_1 = party.Street_1 + ","; if (party.Street_2.Trim().Length != 0) { row.PARTY_STREET_2 = party.Street_2 + ","; } if (party.Pincode_id.Trim().Length == 6) { row.PARTY_CITY = party.City_id + " - :" + party.Pincode_id + ","; } else { row.PARTY_CITY = party.City_id + ","; } row.PARTY_STATE = party.State_id + " - (" + Ccoreplus.GetStateCode(party.State_id) + ")."; row.PARTY_STATE_CODE = ""; row.PARTY_COUNTRY = party.Country_id; row.PARTY_PINCODE = party.Pincode_id; if (party.Gstin.Trim().Length != 0) { row.PARTY_GSTIN = "GSTIN :" + party.Gstin; } row.TOTAL_QTY = invoice.Total_qty.ToString(); row.TAXABLE_VALUE = invoice.Total_taxable_amount.ToString(); if (Customised.TaxType == Core.SGST) { row.CGST_PERCENT = " Add CGST " + (invoiceitems[0].Cgst_percent.ToString()) + " %"; row.SGST_PERCENT = " Add SGST " + (invoiceitems[0].Sgst_percent.ToString()) + " %"; row.TOTAL_CGST = invoice.Total_cgst.ToString(); row.TOTAL_SGST = invoice.Total_sgst.ToString(); } else if (Customised.TaxType == Core.IGST) { row.CGST_PERCENT = ""; row.SGST_PERCENT = " Add IGST " + (invoiceitems[0].Igst_percent.ToString()) + " %"; row.TOTAL_CGST = ""; row.TOTAL_SGST = invoice.Total_igst.ToString(); } row.TOTAL_SUB = invoice.Grandtotal.ToString(); row.LEDGER = CLedger_exten.GetName_Id(invoice.Ledger_id); if (invoice.Additional != 0) { row.ADDITIONAL = invoice.Additional.ToString(); } else { row.ADDITIONAL = ""; } row.ROUNDS = invoice.Rounds.ToString(); row.GSTTOTAL = invoice.Gsttotal.ToString(); row.GRANDTOTAL = invoice.Grandtotal.ToString(); row.AMOUNT_IN_WORDS = "Rupees : " + Global.AmountInWords(invoice.Grandtotal); row.NOTES = invoice.Notes; row.ENTRY_BY = invoice.User_id; row.FORSIGN = company.Display_name; if (Customised.InvoiceWithBankDetails) { row.ACCOUNT_NO = "A/C NO : " + cmpbank.Account_number; row.IFSC_CODE = "IFSC CODE : " + cmpbank.Ifsc_code; row.BANK_NAME = "BANK NAME : " + cmpbank.Company_bank_name; row.BRANCH = "BRANCH : " + cmpbank.Branch_name; } else { row.ACCOUNT_NO = ""; row.IFSC_CODE = ""; row.BANK_NAME = ""; row.BRANCH = ""; } row.TERMS_1 = Message.TERMS_1; row.TERMS_2 = Message.TERMS_2; row.TERMS_3 = Message.TERMS_3; row.TERMS_4 = Customised.Terms_4; list.Add(row); } return(list); }
private static Print_InvoiceList GetData(string p_id, List <PrintCopies> printcopies) { Upvc_invoice inv_obj = CUpvc_invoice_exten.PKId(p_id, new DAL()); Print_InvoiceList list = new Print_InvoiceList(); for (int i = 0; i < printcopies.Count; i++) { Print_InvoiceRow row = new Print_InvoiceRow(); row.COPIES = printcopies[i].Copies; row.INVOICE_ID = p_id; //Company obj = Company.SetCompany(Current.Company_id); Company obj = CCompany_exten.PKId(Current.Company_id); row.COMPANY_NAME = obj.Display_name.ToUpper(); row.ADDRESS1 = obj.Street1 + ", " + obj.Street2 + ", " + obj.City_id + " - " + obj.Pincode_id + " , " + obj.State_id + ". State code - 33"; row.ADDRESS2 = "Email : " + obj.Email + " www.smsupvc.com , Mobile no : " + obj.Cell1; row.COMPANY_GST = "GSTIN : " + obj.Gstin; row.SALES_TYPE = "Create Sales Invoice : " + inv_obj.Salestype_id; row.INVOICE_NO = "Serial no.of Invoice : " + inv_obj.Invoice_no + " / " + CAcy_exten.GetName_Id(inv_obj.Acy_id); row.INVOICE_DATE = "Invoice Date : " + ConvertTO.Date2S(inv_obj.Invoice_date); row.TRANSPORT = "Mode of Transport : " + inv_obj.Transport_id; row.VEHICLE_NO = ""; row.PLACE = "Place of Supply : " + Ccoreplus.GetCity_id(inv_obj.Delivered_id); row.PARTY_NAME = inv_obj.Party_id; Party party_obj = CParty_exten.SearchName(inv_obj.Party_id, new DAL()); if (party_obj.Party_name != null) { row.STREET1 = party_obj.Street_1 + ", " + party_obj.Street_2; row.STREET2 = ""; row.CITY = party_obj.City_id + " - " + party_obj.Pincode_id + " , " + party_obj.State_id + ", State Code -" + Ccoreplus.GetStateCode(party_obj.State_id); row.STATE = ""; row.COUNTRY = party_obj.Country_id; row.PINCODE = ""; if (party_obj.Gstin.Trim().Length != 0) { row.GSTIN += "GSTIN No : " + party_obj.Gstin; } } row.SHIPPING_NAME = CParty_exten.GetName_Id(inv_obj.Delivered_id); Party shipping_obj = CParty_exten.PKId(inv_obj.Delivered_id, new DAL()); if (shipping_obj.Party_name != null) { row.SHIPPING_STREET1 = shipping_obj.Street_1 + ", " + shipping_obj.Street_2; row.SHIPPING_STREET2 = ""; row.SHIPPING_CITY = shipping_obj.City_id + " - " + shipping_obj.Pincode_id + " , " + shipping_obj.State_id + ", State Code -" + Ccoreplus.GetStateCode(shipping_obj.State_id); row.SHIPPING_STATE = ""; row.SHIPPING_COUNTRY = shipping_obj.Country_id; row.SHIPPING_PINCODE = ""; if (shipping_obj.Gstin.Trim().Length != 0) { row.SHIPPING_GSTIN += "GSTIN No : " + shipping_obj.Gstin; } } row.TOTAL_QTY = ConvertTO.DecimalToS(inv_obj.Total_qty + ""); row.TOTAL_AREASQ = ConvertTO.DecimalToS(inv_obj.Total_areasq + ""); row.TAXABLE_VALUE = ConvertTO.Decimal2d(inv_obj.Total_taxable_amount + ""); List <Upvc_invoiceitems> klist = CUpvc_invoiceitems_exten.FKId(p_id, new DAL()); row.LBL_SGST = " Add SGST tax @ " + ConvertTO.DecimalToS(klist[0].Sgst_percent.ToString()) + " %"; row.TOTAL_SGST = ConvertTO.Decimal2d(inv_obj.Total_sgst + ""); row.LBL_CGST = " Add CGST tax @ " + ConvertTO.DecimalToS(klist[0].Cgst_percent.ToString()) + " %"; row.TOTAL_CGST = ConvertTO.Decimal2d(inv_obj.Total_cgst + ""); row.TOTAL_SUB = (ConvertTO.Decimal(row.TAXABLE_VALUE) + ConvertTO.Decimal(row.TOTAL_CGST) + ConvertTO.Decimal(row.TOTAL_SGST)).ToString(); if (inv_obj.Ledger_id != null) { if (inv_obj.Ledger_id.Trim() != "") { row.LEDGER = " " + CLedger_exten.GetName_Id(inv_obj.Ledger_id); row.ADDITIONAL = inv_obj.Additional + ""; } else { row.LEDGER = ""; row.ADDITIONAL = ""; } } row.ROUNDS = inv_obj.Rounds + ""; row.GSTTOTAL = inv_obj.Gsttotal + ""; row.GRANDTOTAL = inv_obj.Grandtotal + ""; if (inv_obj.Notes != null) { if (inv_obj.Notes.Trim().Length != 0) { row.NOTES = "Notes : " + inv_obj.Notes; } } row.AMOUNT_IN_WORDS = "Rupees : " + Global.AmountInWords(Convert.ToDecimal(inv_obj.Grandtotal)); row.ENTRY_BY = inv_obj.User_id; list.Add(row); } return(list); }