//This API Is used To save entire GSTR1 invoices public GSTNResult <SaveInfo> Save(GSTR1Total data) { var model = this.Encrypt(data); model.action = "RETSAVE"; var info = this.Put <UnsignedDataInfo, ResponseDataInfo>(model); var output = this.Decrypt <SaveInfo>(info.Data); var model2 = this.BuildResult <SaveInfo>(info, output); return(model2); }
public string GetInvoiceJSONData(List <GST_TRN_INVOICE> invoicelist) { string finalJson = string.Empty; List <B2bOutward> b2b = new List <B2bOutward>(); List <B2bAOutward> b2ba = new List <B2bAOutward>(); List <B2clOutward> b2cl = new List <B2clOutward>(); List <B2clAOutward> b2cla = new List <B2clAOutward>(); List <B2csOutward> b2cs = new List <B2csOutward>(); List <B2CSAOutward> b2csa = new List <B2CSAOutward>(); GSTR1Total model = new GSTR1Total(); foreach (var invoice in invoicelist) { model.gstin = invoice.AspNetUser.GSTNNo; model.gt += Convert.ToDouble(invoice.GST_TRN_INVOICE_DATA.Sum(s => s.TotalAmount)); model.cur_gt += Convert.ToDouble(invoice.GST_TRN_INVOICE_DATA.Sum(s => s.TaxableAmount)); model.fp = invoice.InvoiceMonth.ToString() + invoice.GST_MST_FINYEAR.Finyear; if (invoice.InvoiceType == (byte)EnumConstants.InvoiceType.B2B) { if (invoice.InvoiceStatus == (byte)EnumConstants.InvoiceStatus.Fresh) { model.b2b = GetB2BJson(b2b, invoice); } else if (invoice.InvoiceStatus == (byte)EnumConstants.InvoiceStatus.Amended) { model.b2ba = GetB2BAJson(b2ba, invoice); } } else if (invoice.InvoiceType == (byte)EnumConstants.InvoiceType.B2C) { if (invoice.InvoiceSpecialCondition == (byte)EnumConstants.InvoiceSpecialCondition.B2CL) { if (invoice.InvoiceStatus == (byte)EnumConstants.InvoiceStatus.Fresh) { model.b2cl = GetB2CLJson(b2cl, invoice); } else if (invoice.InvoiceStatus == (byte)EnumConstants.InvoiceStatus.Amended) { model.b2cla = GetB2CLAJson(b2cla, invoice); } } //else if(invoice.InvoiceSpecialCondition == (byte)EnumConstants.InvoiceSpecialCondition.B2CS) //{ // if (invoice.InvoiceStatus == (byte)EnumConstants.InvoiceStatus.Fresh) // { // finalJson += GetB2CSJson(b2cs, model, invoice); // } // else if (invoice.InvoiceStatus == (byte)EnumConstants.InvoiceStatus.Amended) // { // finalJson += GetB2CSAJson(b2csa, model, invoice); // } //} } } finalJson += JsonConvert.SerializeObject(model, Newtonsoft.Json.Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); return(finalJson); }