private DataSet CreatePrintDataSet(int type, string OrderNo) { string errorMessage = string.Empty; DataSet ds = CO.GetOrderForPrint(type, OrderNo, ref errorMessage); if (errorMessage.Trim().Length == 0) { if (ds.Tables[0].Rows.Count > 0) { ds.Tables[0].Columns.Add(new DataColumn("Header", Type.GetType("System.String"))); ds.Tables[0].Columns.Add(new DataColumn("DateText", Type.GetType("System.String"))); ds.Tables[0].Columns.Add(new DataColumn("TINNo", Type.GetType("System.String"))); ds.Tables[0].Columns.Add(new DataColumn("OrderAmountWords", Type.GetType("System.String"))); ds.Tables[1].Columns.Add(new DataColumn("PriceInclTax", Type.GetType("System.String"))); ds.Tables[0].Columns.Add(new DataColumn("PANNo", Type.GetType("System.String"))); ds.Tables[1].Columns.Add(new DataColumn("IsLocation", Type.GetType("System.String"))); ds.Tables[0].Rows[0]["Header"] = (type == 1 ? "Customer Order" : "Retail Invoice"); ds.Tables[0].Rows[0]["TINNo"] = Common.TINNO; ds.Tables[0].Rows[0]["PANNo"] = Common.PANNO; ds.Tables[0].Columns.Add(new DataColumn("CourierAmount", Type.GetType("System.String"))); ds.Tables[0].Columns.Add(new DataColumn("MiniBranch", Type.GetType("System.String"))); ds.Tables[0].Rows[0]["MiniBranch"] = (Common.IsMiniBranchLocation == 1 ? "N" : "Y"); //if (type == 2) //{ // if (ds.Tables[0].Rows[0]["Password"].ToString() != string.Empty) // { // User objUser = new User(); // ds.Tables[0].Rows[0]["Password"] = objUser.DecryptPassword(ds.Tables[0].Rows[0]["Password"].ToString()); // } // else // { // ds.Tables[0].Rows[0]["Password"] = string.Empty; // } //} } for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { ds.Tables[0].Rows[i]["OrderAmount"] = Math.Round(Convert.ToDecimal(ds.Tables[0].Rows[i]["OrderAmount"]), Common.DisplayAmountRounding, MidpointRounding.AwayFromZero); ds.Tables[0].Rows[i]["TaxAmount"] = Math.Round(Convert.ToDecimal(ds.Tables[0].Rows[i]["TaxAmount"]), Common.DisplayAmountRounding, MidpointRounding.AwayFromZero); ds.Tables[0].Rows[i]["OrderAmountWords"] = Common.AmountToWords.AmtInWord(Convert.ToDecimal(ds.Tables[0].Rows[i]["OrderAmount"]) + Convert.ToDecimal(ds.Tables[0].Rows[i]["TaxAmount"])); ds.Tables[0].Rows[i]["PaymentAmount"] = Math.Round(Convert.ToDecimal(ds.Tables[0].Rows[i]["PaymentAmount"]), Common.DisplayAmountRounding, MidpointRounding.AwayFromZero); ds.Tables[0].Rows[i]["ChangeAmount"] = Math.Round(Convert.ToDecimal(ds.Tables[0].Rows[i]["ChangeAmount"]), Common.DisplayAmountRounding, MidpointRounding.AwayFromZero); ds.Tables[0].Rows[i]["TotalBV"] = Math.Round(Convert.ToDecimal(ds.Tables[0].Rows[i]["TotalBV"]), Common.DisplayAmountRounding, MidpointRounding.AwayFromZero); ds.Tables[0].Rows[i]["TotalPV"] = Math.Round(Convert.ToDecimal(ds.Tables[0].Rows[i]["TotalPV"]), Common.DisplayAmountRounding, MidpointRounding.AwayFromZero); ds.Tables[0].Rows[i]["TotalWeight"] = Math.Round(Convert.ToDecimal(ds.Tables[0].Rows[i]["TotalWeight"]), 3); ds.Tables[0].Rows[i]["DateText"] = (Convert.ToDateTime(ds.Tables[0].Rows[i]["Date"])).ToString(Common.DTP_DATE_FORMAT); } for (int i = 0; i < ds.Tables[1].Rows.Count; i++) { ds.Tables[1].Rows[i]["DP"] = Math.Round(Convert.ToDecimal(ds.Tables[1].Rows[i]["DP"]), Common.DisplayAmountRounding, MidpointRounding.AwayFromZero); ds.Tables[1].Rows[i]["UnitPrice"] = Math.Round(Convert.ToDecimal(ds.Tables[1].Rows[i]["UnitPrice"]), Common.DisplayAmountRounding, MidpointRounding.AwayFromZero); ds.Tables[1].Rows[i]["Qty"] = Math.Round(Convert.ToDecimal(ds.Tables[1].Rows[i]["Qty"]), Common.DisplayQtyRounding, MidpointRounding.AwayFromZero); ds.Tables[1].Rows[i]["Amount"] = Math.Round(Convert.ToDecimal(ds.Tables[1].Rows[i]["Amount"]), Common.DisplayAmountRounding, MidpointRounding.AwayFromZero); ds.Tables[1].Rows[i]["PriceInclTax"] = Math.Round(Convert.ToDecimal(ds.Tables[1].Rows[i]["UnitPrice"]) + (Convert.ToDecimal(ds.Tables[1].Rows[i]["TaxAmount"]) / Convert.ToDecimal(ds.Tables[1].Rows[i]["Qty"])), Common.DisplayAmountRounding, MidpointRounding.AwayFromZero); ds.Tables[1].Rows[i]["TaxAmount"] = Math.Round(Convert.ToDecimal(ds.Tables[1].Rows[i]["TaxAmount"]), Common.DisplayAmountRounding, MidpointRounding.AwayFromZero); if (ds.Tables[1].Rows[i]["TaxPercent"].ToString().Length > 0) { ds.Tables[1].Rows[i]["TaxPercent"] = Math.Round(Convert.ToDecimal(ds.Tables[1].Rows[i]["TaxPercent"]), Common.DisplayAmountRounding, MidpointRounding.AwayFromZero); } ds.Tables[1].Rows[i]["Discount"] = Math.Round(Convert.ToDecimal(ds.Tables[1].Rows[i]["Discount"]), Common.DisplayAmountRounding, MidpointRounding.AwayFromZero); } for (int i = 0; i < ds.Tables[2].Rows.Count; i++) { ds.Tables[2].Rows[i]["PaymentAmount"] = Math.Round(Convert.ToDecimal(ds.Tables[2].Rows[i]["PaymentAmount"]), Common.DisplayAmountRounding, MidpointRounding.AwayFromZero); //Bikram:AED Changes if (Convert.ToInt32(ds.Tables[2].Rows[i]["TenderType"].ToString()) == 101) { ds.Tables[0].Rows[0]["CourierAmount"] = Math.Round(Convert.ToDecimal(ds.Tables[2].Rows[i]["PaymentAmount"]), Common.DisplayAmountRounding, MidpointRounding.AwayFromZero); ds.Tables[2].Rows[i]["PaymentAmount"] = Math.Round(Convert.ToDecimal(0), Common.DisplayAmountRounding, MidpointRounding.AwayFromZero); } } for (int i = 0; i < ds.Tables[3].Rows.Count; i++) { ds.Tables[3].Rows[i]["TaxPercent"] = Math.Round(Convert.ToDecimal(ds.Tables[3].Rows[i]["TaxPercent"]), Common.DisplayAmountRounding, MidpointRounding.AwayFromZero); ds.Tables[3].Rows[i]["TaxAmount"] = Math.Round(Convert.ToDecimal(ds.Tables[3].Rows[i]["TaxAmount"]), Common.DisplayAmountRounding, MidpointRounding.AwayFromZero); } } return(ds); }