public void TruckMemoRegCommodityAbstract(StreamWriter sw, CommonEntity entity)
        {
            // var distinctDate = entity.dataSet.Tables[0].DefaultView.ToTable(true, "Issue_Date");
            //Date wise DO report
            int    iCount  = 11;
            string sIssuer = string.Empty;
            string sDoNo   = string.Empty;

            //foreach (DataRow dateValue in distinctDate.Rows)
            //{
            iCount = 11;
            string sDoNo1 = string.Empty;
            List <TruckMemoRegEntity> dORegEntities = new List <TruckMemoRegEntity>();

            dORegEntities = report.ConvertDataTableToList <TruckMemoRegEntity>(entity.dataSet.Tables[0]);

            // Gets the group by values based on ths column To_Whom_Issued, Commodity,Scheme
            var myResult = from a in dORegEntities
                           orderby a.Commodity ascending
                           group a by new { a.Commodity, a.TRName } into gValue
                select new
            {
                NoBags       = gValue.Sum(s => s.NoBags),
                NetWt        = gValue.Sum(s => s.NetWt),
                GroupByNames = gValue.Key
            };

            AddHeaderforTMCommodityAbstract(sw, entity);
            foreach (var item in myResult)
            {
                if (iCount >= 50)
                {
                    //Add header again
                    iCount = 11;
                    sw.WriteLine("-----------------------------------------------------------------------------------------------------------------------------------");
                    sw.WriteLine((char)12);
                    AddHeaderforTMAbstract(sw, entity);
                }
                sw.Write(report.StringFormatWithoutPipe(item.GroupByNames.TRName, 18, 2));
                sw.Write(report.StringFormatWithoutPipe(item.GroupByNames.Commodity, 44, 2));
                sw.Write(report.StringFormatWithoutPipe(item.NoBags.ToString(), 10, 1));
                sw.Write(report.StringFormatWithoutPipe(report.DecimalformatForWeight(item.NetWt.ToString()), 25, 1));
                iCount++;
                sw.WriteLine("");
            }
            sw.WriteLine("-----------------------------------------------------------------------------------------------------------------------------------");
            sw.WriteLine((char)12);
            // }
        }
Example #2
0
        public void GenerateDeliveryOrderForRegister(CommonEntity entity)
        {
            string       fPath = string.Empty, sPath = string.Empty, sFileName = string.Empty;
            string       filePath = string.Empty;
            StreamWriter sw       = null;

            try
            {
                GName      = entity.dataTable.Rows[0]["Godown"].ToString();
                Regioncode = entity.dataTable.Rows[0]["Region"].ToString();
                sFileName  = entity.GCode + GlobalVariable.StockDORegisterFileName;
                fPath      = GlobalVariable.ReportPath + "Reports";
                report.CreateFolderIfnotExists(fPath);  // create a new folder if not exists
                sPath = fPath + "//" + entity.UserName; //ManageReport.GetDateForFolder();
                report.CreateFolderIfnotExists(sPath);
                //delete file if exists
                filePath = sPath + "//" + sFileName + ".txt";
                report.DeleteFileIfExists(filePath);

                sw = new StreamWriter(filePath, true);

                WriteDORegForDateWise(sw, entity);
                // sw.WriteLine((char)12);
                List <DORegEntity> dORegEntities = new List <DORegEntity>();
                dORegEntities = report.ConvertDataTableToList <DORegEntity>(entity.dataTable);

                WriteDORegforSocityandScheme(sw, dORegEntities, entity);

                WriteDORegforItemandScheme(sw, dORegEntities, entity);

                WriteDORegforItem(sw, dORegEntities, entity);
                sw.Flush();
                //send mail to corresponding godown.
            }
            catch (Exception ex)
            {
                AuditLog.WriteError("GenerateDeliveryOrderForRegister " + ex.Message + " : " + ex.StackTrace);
            }
            finally
            {
                sw.Close();
                sw    = null;
                fPath = string.Empty; sFileName = string.Empty;
            }
        }
Example #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="entity"></param>
        public void GenerateStockReceiptRegister(CommonEntity entity)
        {
            string       fPath = string.Empty, subF_Path = string.Empty, fileName = string.Empty, filePath = string.Empty;
            StreamWriter streamWriter = null;

            try
            {
                GName    = entity.dataSet.Tables[0].Rows[0]["Godownname"].ToString();
                RName    = entity.dataSet.Tables[0].Rows[0]["Region"].ToString();
                fileName = entity.GCode + GlobalVariable.StockReceiptRegisterFileName;
                fPath    = GlobalVariable.ReportPath + "Reports";
                report.CreateFolderIfnotExists(fPath);      // create a new folder if not exists
                subF_Path = fPath + "//" + entity.UserName; //ManageReport.GetDateForFolder();
                report.CreateFolderIfnotExists(subF_Path);
                //delete file if exists
                filePath = subF_Path + "//" + fileName + ".txt";
                report.DeleteFileIfExists(filePath);

                streamWriter = new StreamWriter(filePath, true);
                DateWiseStockReceiptRegister(streamWriter, entity);

                List <StockReceiptList> stockReceiptList = new List <StockReceiptList>();
                stockReceiptList = report.ConvertDataTableToList <StockReceiptList>(entity.dataSet.Tables[0]);

                // DateWiseStockReceiptRegister(streamWriter, entity);
                StockReceiptAbstractRecdTypeAndSchemeWise(streamWriter, stockReceiptList, entity);
                StockReceiptAbstractSchemeAndCommodityWise(streamWriter, stockReceiptList, entity);
                StockReceiptAbstractStackNoAndCommodity(streamWriter, stockReceiptList, entity);
                StockReceiptAbstractCommodityWise(streamWriter, stockReceiptList, entity);

                streamWriter.Flush();
            }
            catch (Exception ex)
            {
                AuditLog.WriteError(ex.Message + " " + ex.StackTrace);
            }
            finally
            {
                streamWriter.Close();
                fPath        = string.Empty; fileName = string.Empty;
                streamWriter = null;
            }
        }
Example #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="entity"></param>
        public void GenerateHullingReport(CommonEntity entity)
        {
            //AuditLog.WriteError("GenerateHullingReport");
            string       fPath = string.Empty, subF_Path = string.Empty, fileName = string.Empty, filePath = string.Empty;
            StreamWriter streamWriter = null;

            try
            {
                GName    = entity.dataSet.Tables[0].Rows[0]["Godownname"].ToString();
                RName    = entity.dataSet.Tables[0].Rows[0]["Region"].ToString();
                fileName = entity.GCode + GlobalVariable.HullingDetailsReportFileName;
                fPath    = GlobalVariable.ReportPath + "Reports";
                report.CreateFolderIfnotExists(fPath);      // create a new folder if not exists
                subF_Path = fPath + "//" + entity.UserName; //ManageReport.GetDateForFolder();
                report.CreateFolderIfnotExists(subF_Path);
                //delete file if exists
                filePath = subF_Path + "//" + fileName + ".txt";
                report.DeleteFileIfExists(filePath);

                streamWriter = new StreamWriter(filePath, true);
                DateWiseHullingDetails(streamWriter, entity);
                List <HullingReportEntity> hullingReportList = new List <HullingReportEntity>();
                hullingReportList = report.ConvertDataTableToList <HullingReportEntity>(entity.dataSet.Tables[0]);
                HullingDetailsAbstract(streamWriter, hullingReportList, entity);

                streamWriter.Flush();
            }
            catch (Exception ex)
            {
                AuditLog.WriteError(ex.Message + " " + ex.StackTrace);
            }
            finally
            {
                streamWriter.Close();
                fPath        = string.Empty; fileName = string.Empty;
                streamWriter = null;
            }
        }
Example #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="entity"></param>
        public void GenerateGUGRReport(CommonEntity entity, GUGRParameter param)
        {
            string       fPath = string.Empty, subF_Path = string.Empty, fileName = string.Empty, filePath = string.Empty;
            StreamWriter streamWriter = null;

            try
            {
                HeaderTitle = (param.Type == "GR") ? "      Gunny Release Details of " : "      Gunny Utilisation Details of ";
                fileName    = (param.Type == "GR") ? (entity.GCode + GlobalVariable.GRReportFileName) : (entity.GCode + GlobalVariable.GUReportFileName);
                fPath       = GlobalVariable.ReportPath + "Reports";
                report.CreateFolderIfnotExists(fPath);      // create a new folder if not exists
                subF_Path = fPath + "//" + entity.UserName; //ManageReport.GetDateForFolder();
                report.CreateFolderIfnotExists(subF_Path);
                //delete file if exists
                filePath = subF_Path + "//" + fileName + ".txt";
                report.DeleteFileIfExists(filePath);

                streamWriter = new StreamWriter(filePath, true);
                DateWiseCommodityWiseGUGRReport(streamWriter, entity);

                List <GUList> guList = new List <GUList>();
                guList = report.ConvertDataTableToList <GUList>(entity.dataSet.Tables[0]);
                WriteGUGRAbstract(streamWriter, guList, entity);
                streamWriter.Flush();
            }
            catch (Exception ex)
            {
                AuditLog.WriteError(ex.Message + " " + ex.StackTrace);
            }
            finally
            {
                streamWriter.Close();
                fPath        = string.Empty; fileName = string.Empty;
                streamWriter = null;
            }
        }
Example #6
0
        public void InsertSalesTaxDetails(DocumentDeliveryOrderEntity deliveryOrderEntity, string SRNo)
        {
            try
            {
                if (deliveryOrderEntity.DOTaxStatus == "YES")
                {
                    //Get values to calculate the GST value.
                    DataSet             ds = new DataSet();
                    ManageSQLConnection manageSQLConnection             = new ManageSQLConnection();
                    List <KeyValuePair <string, string> > sqlParameters = new List <KeyValuePair <string, string> >();
                    sqlParameters.Add(new KeyValuePair <string, string>("@EffectDate", deliveryOrderEntity.DoDate));
                    ds = manageSQLConnection.GetDataSetValues("GetRateMasterData", sqlParameters);
                    ManageReport report = new ManageReport();
                    if (report.CheckDataAvailable(ds))
                    {
                        sqlCommand.Parameters.Clear();
                        sqlCommand.Dispose();
                        List <RateEntity> _rateEntity = new List <RateEntity>();
                        _rateEntity = report.ConvertDataTableToList <RateEntity>(ds.Tables[0]);

                        sqlCommand             = new SqlCommand();
                        sqlCommand.Transaction = objTrans;
                        sqlCommand.Connection  = sqlConnection;
                        sqlCommand.CommandText = "DeleteDOSalesTaxDetails";
                        sqlCommand.CommandType = CommandType.StoredProcedure;
                        sqlCommand.Parameters.AddWithValue("@BillNo", SRNo);
                        sqlCommand.Parameters.AddWithValue("@GCode", deliveryOrderEntity.IssuerCode);
                        sqlCommand.ExecuteNonQuery();

                        var     creditSales = (deliveryOrderEntity.TransactionCode == "TR019") ? true : false;
                        decimal gst = 0, taxPercent = 0, taxAmnt = 0, rate = 0, amnt = 0;
                        foreach (var item in deliveryOrderEntity.documentDeliveryItems)
                        {
                            //Filter the value based on HSN no and Scheme.
                            var result = (from a in _rateEntity
                                          where a.Hsncode == item.HsnCode && a.Scheme == item.Scheme
                                          select a).FirstOrDefault();

                            if (result != null)
                            {
                                item.TaxPercent = Convert.ToString(result.TaxPercentage);
                                rate            = result.Rate;
                            }
                            else
                            {
                                item.TaxPercent = "100";
                                rate            = 0;
                            }

                            sqlCommand.Parameters.Clear();
                            sqlCommand.Dispose();
                            sqlCommand             = new SqlCommand();
                            sqlCommand.Transaction = objTrans;
                            sqlCommand.Connection  = sqlConnection;
                            sqlCommand.CommandText = "InsertIntoGSTSalesTax";
                            sqlCommand.CommandType = CommandType.StoredProcedure;
                            sqlCommand.Parameters.AddWithValue("@BillNo", SRNo);
                            sqlCommand.Parameters.AddWithValue("@BillDate", deliveryOrderEntity.DoDate);
                            sqlCommand.Parameters.AddWithValue("@Month", deliveryOrderEntity.Month);
                            sqlCommand.Parameters.AddWithValue("@Year", deliveryOrderEntity.Year);
                            sqlCommand.Parameters.AddWithValue("@CompanyID", deliveryOrderEntity.PartyID);
                            sqlCommand.Parameters.AddWithValue("@CreditSales", creditSales);
                            sqlCommand.Parameters.AddWithValue("@TaxPercentage", item.TaxPercent);
                            sqlCommand.Parameters.AddWithValue("@Hsncode", item.HsnCode);
                            sqlCommand.Parameters.AddWithValue("@CommodityID", item.Itemcode);
                            sqlCommand.Parameters.AddWithValue("@TaxType", "CGST");
                            sqlCommand.Parameters.AddWithValue("@Measurement", item.Wtype);
                            sqlCommand.Parameters.AddWithValue("@Quantity", item.NetWeight);
                            taxPercent = (Convert.ToDecimal(item.TaxPercent) / 2);
                            //   rate = ((Convert.ToDouble(item.Rate)) - ((Convert.ToDouble(item.Rate) * Convert.ToDouble(item.TaxPercent)) / 100));
                            sqlCommand.Parameters.AddWithValue("@Rate", rate);
                            amnt = (Convert.ToDecimal(item.NetWeight) * rate);
                            sqlCommand.Parameters.AddWithValue("@Amount", amnt);
                            gst = ((amnt * taxPercent) / 100);
                            sqlCommand.Parameters.AddWithValue("@CGST", gst);
                            sqlCommand.Parameters.AddWithValue("@SGST", gst);
                            taxAmnt = (gst * 2);
                            sqlCommand.Parameters.AddWithValue("@TaxAmount", taxAmnt);
                            sqlCommand.Parameters.AddWithValue("@Total", (amnt + taxAmnt));
                            sqlCommand.Parameters.AddWithValue("@RCode", item.Rcode);
                            sqlCommand.Parameters.AddWithValue("@GCode", deliveryOrderEntity.IssuerCode);
                            sqlCommand.Parameters.AddWithValue("@CreatedBy", deliveryOrderEntity.UserID);
                            sqlCommand.Parameters.AddWithValue("@Scheme", item.Scheme);
                            sqlCommand.Parameters.AddWithValue("@DORate", item.Rate);
                            sqlCommand.Parameters.AddWithValue("@DOTotal", item.Total);
                            sqlCommand.ExecuteNonQuery();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                AuditLog.WriteError(ex.Message);
            }
        }