Ejemplo n.º 1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sw"></param>
 /// <param name="date"></param>
 public void AddHeader(StreamWriter sw, StockParameter entity, int pageNo)
 {
     sw.WriteLine("                                          TamilNadu Civil Supplies Corporation       " + entity.RName);
     sw.WriteLine("                                             Stock Statement Details of " + entity.GName + " Godown");
     sw.WriteLine("     From : " + report.FormatDate(entity.FDate) + "    To : " + report.FormatDate(entity.ToDate) + "                                           Page No :" + pageNo.ToString());
     sw.WriteLine("|------------------------------------------------------------------------------------------------------------------------------------------------|");
     sw.WriteLine("|S.No| Commodity      |Ope.Bal      |Receipt      |Total(OB+Receipt)|Total Issue  |Closing.Bal  |Cummulative Shortage|Current CS   |Phy.Bal      |");
     sw.WriteLine("|------------------------------------------------------------------------------------------------------------------------------------------------|");
 }
Ejemplo n.º 2
0
        public List <DailyStockDetailsEntity> ProcessStockStatement(StockParameter stockParameter)
        {
            decimal _BookBalanceWeight = 0, _PhysicalBalanceWeight = 0, _CumulitiveShortage = 0, _Shortage = 0;
            decimal _receiptuptoYesterday = 0, _receipttotay = 0, _issuesuptoYesterday = 0,
                    _issuestoday = 0, _otherIssuesuptoYesterday = 0, _otherIssuestoday = 0, _writeOFFAll = 0,
                    _openingBookBalance = 0, _closingBookBalance = 0, _phycialbalance = 0;
            string _itemCode = string.Empty;
            string _ITDescription = string.Empty;
            List <DailyStockDetailsEntity> dailyStockDetailsEntities = new List <DailyStockDetailsEntity>();

            try
            {
                ManageSQLConnection manageSQLConnection = new ManageSQLConnection();
                DataSet             dataSetMaster       = new DataSet();
                List <KeyValuePair <string, string> > _mastersqlParameters = new List <KeyValuePair <string, string> >();
                _mastersqlParameters.Add(new KeyValuePair <string, string>("@GCode", stockParameter.GCode));
                _mastersqlParameters.Add(new KeyValuePair <string, string>("@RCode", stockParameter.RCode));
                _mastersqlParameters.Add(new KeyValuePair <string, string>("@Date", stockParameter.FDate));
                dataSetMaster = manageSQLConnection.GetDataSetValues("GetMasterDataToProcessCB", _mastersqlParameters);
                DataSet todayIssues          = new DataSet();
                DataSet todayReceipt         = new DataSet();
                DataSet issuesUptoYesterday  = new DataSet();
                DataSet receiptUptoYesterday = new DataSet();
                List <KeyValuePair <string, string> > sqlParameters = new List <KeyValuePair <string, string> >();


                sqlParameters.Add(new KeyValuePair <string, string>("@GodownCode", stockParameter.GCode));
                sqlParameters.Add(new KeyValuePair <string, string>("@FromDate", stockParameter.FDate));
                sqlParameters.Add(new KeyValuePair <string, string>("@ToDate", stockParameter.ToDate));
                sqlParameters.Add(new KeyValuePair <string, string>("@RCode", stockParameter.RCode));
                todayIssues          = manageSQLConnection.GetDataSetValues("GetTodayIssuesByDate", sqlParameters);
                todayReceipt         = manageSQLConnection.GetDataSetValues("GetTodayReceiptByDate", sqlParameters);
                issuesUptoYesterday  = manageSQLConnection.GetDataSetValues("GetIssuesUptoYesterdayByDate", sqlParameters);
                receiptUptoYesterday = manageSQLConnection.GetDataSetValues("GetReceiptUptoYesterdayByDate", sqlParameters);
                if (dataSetMaster.Tables.Count > 0)
                {
                    foreach (DataRow godown in dataSetMaster.Tables[2].Rows)   // godown details.
                    {
                        foreach (DataRow item in dataSetMaster.Tables[1].Rows) // item master details.
                        {
                            DailyStockDetailsEntity stockDetailsEntity = new DailyStockDetailsEntity();
                            _itemCode      = Convert.ToString(item["ITCode"]);
                            _ITDescription = Convert.ToString(item["ITDescription"]);

                            stockDetailsEntity.ItemCode      = _itemCode;
                            stockDetailsEntity.ITDescription = _ITDescription;
                            stockDetailsEntity.GodownCode    = Convert.ToString(godown["TNCSCode"]);
                            stockDetailsEntity.RegionCode    = Convert.ToString(godown["TNCSRegn"]);
                            stockDetailsEntity.RName         = Convert.ToString(godown["RGNAME"]);
                            stockDetailsEntity.GName         = Convert.ToString(godown["TNCSName"]);
                            stockDetailsEntity.TNCSCapacity  = Convert.ToDecimal(manageReport.DecimalformatForWeight(Convert.ToString(godown["TNCSCapacity"])));
                            // sqlParameters.Add(new KeyValuePair<string, string>("@ItemCode", _itemCode));



                            //get opening balance for particualr item.
                            DataRow[] openingBalance = dataSetMaster.Tables[0].Select("GodownCode='" + stockDetailsEntity.GodownCode + "' and CommodityCode='" + stockDetailsEntity.ItemCode + "'");

                            DataRow[] receiptuptoYesterday     = receiptUptoYesterday.Tables[0].Select("GCode='" + stockDetailsEntity.GodownCode + "' and ITCode='" + _itemCode + "'");
                            DataRow[] receipttotay             = todayReceipt.Tables[0].Select("GCode='" + stockDetailsEntity.GodownCode + "' and ITCode='" + _itemCode + "'");
                            DataRow[] issuesuptoYesterday      = issuesUptoYesterday.Tables[1].Select("GCode='" + stockDetailsEntity.GodownCode + "' and ITCode='" + _itemCode + "'");
                            DataRow[] issuestoday              = todayIssues.Tables[0].Select("GCode='" + stockDetailsEntity.GodownCode + "' and ITCode='" + _itemCode + "'");
                            DataRow[] otherIssuesuptoYesterday = issuesUptoYesterday.Tables[0].Select("GCode='" + stockDetailsEntity.GodownCode + "' and ITCode='" + _itemCode + "'");
                            DataRow[] otherIssuestoday         = todayIssues.Tables[1].Select("GCode='" + stockDetailsEntity.GodownCode + "' and ITCode='" + _itemCode + "'");

                            DataRow[] writeOFFuptoYesterday = issuesUptoYesterday.Tables[2].Select("GCode='" + stockDetailsEntity.GodownCode + "' and ITCode='" + _itemCode + "'");

                            _BookBalanceWeight     = 0;
                            _PhysicalBalanceWeight = 0;
                            _CumulitiveShortage    = 0;
                            _Shortage                 = 0;
                            _receiptuptoYesterday     = 0;
                            _receipttotay             = 0;
                            _issuesuptoYesterday      = 0;
                            _issuestoday              = 0;
                            _otherIssuesuptoYesterday = 0;
                            _otherIssuestoday         = 0;
                            _openingBookBalance       = 0;
                            _closingBookBalance       = 0;
                            _phycialbalance           = 0;
                            _writeOFFAll              = 0;
                            if (openingBalance != null && openingBalance.Count() > 0)
                            {
                                _BookBalanceWeight     = Convert.ToDecimal(manageReport.DecimalformatForWeight(Convert.ToString(openingBalance[0]["BookBalanceWeight"])));
                                _PhysicalBalanceWeight = Convert.ToDecimal(manageReport.DecimalformatForWeight(Convert.ToString(openingBalance[0]["PhysicalBalanceWeight"])));
                                _CumulitiveShortage    = Convert.ToDecimal(manageReport.DecimalformatForWeight(Convert.ToString(openingBalance[0]["CumulitiveShortage"])));
                                _Shortage = Convert.ToDecimal(manageReport.DecimalformatForWeight(Convert.ToString(openingBalance[0]["WriteOff"])));
                            }
                            if (receiptuptoYesterday != null && receiptuptoYesterday.Count() > 0)
                            {
                                _receiptuptoYesterday = Convert.ToDecimal(manageReport.DecimalformatForWeight(Convert.ToString(receiptuptoYesterday[0]["TOTAL"])));
                            }
                            if (receipttotay != null && receipttotay.Count() > 0)
                            {
                                _receipttotay = Convert.ToDecimal(manageReport.DecimalformatForWeight(Convert.ToString(receipttotay[0]["TOTAL"])));
                            }
                            if (issuesuptoYesterday != null && issuesuptoYesterday.Count() > 0)
                            {
                                _issuesuptoYesterday = Convert.ToDecimal(manageReport.DecimalformatForWeight(Convert.ToString(issuesuptoYesterday[0]["TOTAL"])));
                            }
                            if (issuestoday != null && issuestoday.Count() > 0)
                            {
                                _issuestoday = Convert.ToDecimal(manageReport.DecimalformatForWeight(Convert.ToString(issuestoday[0]["TOTAL"])));
                            }
                            if (otherIssuesuptoYesterday != null && otherIssuesuptoYesterday.Count() > 0)
                            {
                                _otherIssuesuptoYesterday = Convert.ToDecimal(manageReport.DecimalformatForWeight(Convert.ToString(otherIssuesuptoYesterday[0]["TOTAL"])));
                            }
                            if (otherIssuestoday != null && otherIssuestoday.Count() > 0)
                            {
                                _otherIssuestoday = Convert.ToDecimal(manageReport.DecimalformatForWeight(Convert.ToString(otherIssuestoday[0]["TOTAL"])));
                            }
                            if (writeOFFuptoYesterday.Count() > 0)
                            {
                                _writeOFFAll = Convert.ToDecimal(manageReport.DecimalformatForWeight(Convert.ToString(writeOFFuptoYesterday[0]["TOTAL"])));
                            }
                            _openingBookBalance = (_BookBalanceWeight + _receiptuptoYesterday) - (_issuesuptoYesterday + _otherIssuesuptoYesterday);
                            _closingBookBalance = (_openingBookBalance + _receipttotay) - (_issuestoday + _otherIssuestoday);
                            _CumulitiveShortage = _CumulitiveShortage - _writeOFFAll;
                            _phycialbalance     = _closingBookBalance - (_CumulitiveShortage + _Shortage);
                            _Shortage           = _CumulitiveShortage > 0 ? _Shortage : (_CumulitiveShortage + _Shortage);
                            _CumulitiveShortage = _CumulitiveShortage > 0 ? _CumulitiveShortage : 0;
                            stockDetailsEntity.OpeningBalance = _openingBookBalance;
                            stockDetailsEntity.ClosingBalance = _closingBookBalance;
                            stockDetailsEntity.PhycialBalance = _phycialbalance;
                            stockDetailsEntity.CSBalance      = _CumulitiveShortage;
                            stockDetailsEntity.Shortage       = _Shortage;
                            stockDetailsEntity.TotalReceipt   = _receipttotay;
                            stockDetailsEntity.IssueSales     = _issuestoday;
                            stockDetailsEntity.IssueOthers    = _otherIssuestoday;
                            stockDetailsEntity.LastUpdated    = DateTime.Now;
                            stockDetailsEntity.Remarks        = string.Empty;
                            stockDetailsEntity.Flag           = true;
                            // InsertData(stockDetailsEntity);
                            //}
                            // Data checking
                            decimal CheckData = stockDetailsEntity.OpeningBalance + stockDetailsEntity.ClosingBalance +
                                                stockDetailsEntity.TotalReceipt + stockDetailsEntity.IssueSales
                                                + stockDetailsEntity.IssueOthers;
                            if (CheckData > 0)
                            {
                                dailyStockDetailsEntities.Add(stockDetailsEntity);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                AuditLog.WriteError(" Process Daily Stock " + ex.Message);
            }
            ManageStockStatement manageStockStatement = new ManageStockStatement();

            Task.Run(() => manageStockStatement.GenerateStockStatementReport(dailyStockDetailsEntities, stockParameter)); //Generate the Report
            return(dailyStockDetailsEntities);
        }
Ejemplo n.º 3
0
        public List <StockCBEntity> GetDailyCB(StockParameter stockParameter)
        {
            List <DailyStockDetailsEntity> dailyStockDetails = new List <DailyStockDetailsEntity>();
            List <StockCBEntity>           cBEntities        = new List <StockCBEntity>();

            StockStatementByDate statementByDate = new StockStatementByDate();

            dailyStockDetails = statementByDate.ProcessStockStatement(stockParameter);

            ManageSQLConnection manageSQLConnection = new ManageSQLConnection();
            DataSet             dataSetApproval     = new DataSet();
            List <KeyValuePair <string, string> > _mastersqlParameters = new List <KeyValuePair <string, string> >();

            _mastersqlParameters.Add(new KeyValuePair <string, string>("@GCode", stockParameter.GCode));
            _mastersqlParameters.Add(new KeyValuePair <string, string>("@RCode", stockParameter.RCode));
            _mastersqlParameters.Add(new KeyValuePair <string, string>("@Date", stockParameter.FDate));
            dataSetApproval = manageSQLConnection.GetDataSetValues("GetApprovalStatus", _mastersqlParameters);

            var result = dailyStockDetails.GroupBy(a => a.GodownCode).Select(b => b.FirstOrDefault());

            foreach (var item in result)
            {
                StockCBEntity stockCB        = new StockCBEntity();
                bool          isValue        = false;
                var           newData        = dailyStockDetails.Where(a => a.GodownCode == item.GodownCode).ToList();
                DataRow[]     godownApproval = dataSetApproval.Tables[0].Select("GCode='" + item.GodownCode + "'");
                DataRow[]     regionApproval = dataSetApproval.Tables[1].Select("GCode='" + item.GodownCode + "'");
                stockCB.GCode        = item.GodownCode;
                stockCB.RCode        = item.RegionCode;
                stockCB.RNAME        = newData[0].RName;
                stockCB.TNCSName     = newData[0].GName;
                stockCB.TNCSCapacity = newData[0].TNCSCapacity;
                stockCB.RStatus      = GetApprovalStatus(regionApproval);
                stockCB.GStatus      = GetApprovalStatus(godownApproval);
                stockCB.RRemark      = GetApprovalRemark(regionApproval);
                stockCB.GRemark      = GetApprovalRemark(godownApproval);
                foreach (var Details in newData)
                {
                    if (Details.ItemCode == "IT001")
                    {
                        isValue         = true;
                        stockCB.PADDY_A = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT003")
                    {
                        isValue = true;
                        stockCB.PADDY_COMMON = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT009")
                    {
                        isValue = true;
                        stockCB.RAW_RICE_COMMON = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT012")
                    {
                        isValue = true;
                        stockCB.BOILED_RICE_COMMON = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT013")
                    {
                        isValue       = true;
                        stockCB.SUGAR = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT014")
                    {
                        isValue       = true;
                        stockCB.WHEAT = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT015")
                    {
                        isValue      = true;
                        stockCB.RAVA = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT016")
                    {
                        isValue       = true;
                        stockCB.MAIDA = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT018")
                    {
                        isValue            = true;
                        stockCB.TOOR_DHALL = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT019")
                    {
                        isValue            = true;
                        stockCB.URID_DHALL = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT020")
                    {
                        isValue = true;
                        stockCB.MAZOOR__DHALL = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT021")
                    {
                        isValue = true;
                        stockCB.GREEN_GRAM_DHALL = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT024")
                    {
                        isValue            = true;
                        stockCB.GREEN_GRAM = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT025")
                    {
                        isValue             = true;
                        stockCB.BENGAL_GRAM = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT026")
                    {
                        isValue = true;
                        stockCB.PALMOLIEN_OIL = GetCBQty(Details.PhycialBalance, 0);
                    }
                    else if (Details.ItemCode == "IT027")
                    {
                        isValue      = true;
                        stockCB.SALT = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT029")
                    {
                        isValue     = true;
                        stockCB.TEA = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT030")
                    {
                        isValue          = true;
                        stockCB.KEROSENE = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT033")
                    {
                        isValue            = true;
                        stockCB.RAW_RICE_A = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT034")
                    {
                        isValue = true;
                        stockCB.BOILED_RICE_A = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT041")
                    {
                        isValue            = true;
                        stockCB.JUTE_TWINE = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT059")
                    {
                        isValue = true;
                        stockCB.PALMOLIEN_POUCH = GetCBQty(Details.PhycialBalance, 0);
                    }
                    else if (Details.ItemCode == "IT064")
                    {
                        isValue = true;
                        stockCB.CEMENT_IMPORTED = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT065")
                    {
                        isValue      = true;
                        stockCB.ATTA = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT066")
                    {
                        isValue = true;
                        stockCB.CEMENT_REGULAR = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT112")
                    {
                        isValue = true;
                        stockCB.URID_DHALL_SPLIT = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT120")
                    {
                        isValue = true;
                        stockCB.Candian_Yellow_lentil_TD = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT121")
                    {
                        isValue         = true;
                        stockCB.SALT_FF = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT123")
                    {
                        isValue = true;
                        stockCB.RAW_RICE_A_HULLING = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT124")
                    {
                        isValue = true;
                        stockCB.RAW_RICE_COM_HULLING = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT132")
                    {
                        isValue = true;
                        stockCB.YELLOW_LENTAL_US = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT133")
                    {
                        isValue         = true;
                        stockCB.URAD_SQ = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT139")
                    {
                        isValue = true;
                        stockCB.BOILED_RICE_A_HULLING = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT140")
                    {
                        isValue = true;
                        stockCB.BOILED_RICE_C_HULLING = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT166")
                    {
                        isValue = true;
                        stockCB.LIARD_LENTIL_GREEN = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT175")
                    {
                        isValue           = true;
                        stockCB.TUR_LEMON = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT176")
                    {
                        isValue          = true;
                        stockCB.URAD_FAQ = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT190")
                    {
                        isValue            = true;
                        stockCB.TUR_ARUSHA = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT191")
                    {
                        isValue = true;
                        stockCB.URID_DHALL_FAQ = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT192")
                    {
                        isValue = true;
                        stockCB.URID_DHALL_SQ = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT209")
                    {
                        isValue = true;
                        stockCB.AMMA_SALT_RFFIS = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT210")
                    {
                        isValue = true;
                        stockCB.AMMA_SALT_DFS = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT211")
                    {
                        isValue = true;
                        stockCB.AMMA_SALT_LSS = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT212")
                    {
                        isValue             = true;
                        stockCB.AMMA_CEMENT = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT215")
                    {
                        isValue = true;
                        stockCB.AMMA_SALT_CIS = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT225")
                    {
                        isValue             = true;
                        stockCB.OMR_HULLING = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT229")
                    {
                        isValue = true;
                        stockCB.BOILED_RICE_FORTIFIED = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT254")
                    {
                        isValue = true;
                        stockCB.Fortified_Rice_Kernels = GetCBQty(Details.PhycialBalance, 1);
                    }
                    else if (Details.ItemCode == "IT255")
                    {
                        isValue = true;
                        stockCB.FRK_Blended_Rice = GetCBQty(Details.PhycialBalance, 1);
                    }
                }
                if (isValue)
                {
                    cBEntities.Add(stockCB);
                }
            }
            return(cBEntities);
        }
Ejemplo n.º 4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sw"></param>
 /// <param name="entity"></param>
 public void StockStatementReport(StreamWriter sw, List <DailyStockDetailsEntity> stockDetailsEntity, StockParameter entity)
 {
     try
     {
         int count  = 8;
         int pageNo = 1;
         AddHeader(sw, entity, pageNo);
         int i = 1;
         foreach (var data in stockDetailsEntity)
         {
             if (count >= 50)
             {
                 //Add header again
                 pageNo++;
                 count = 8;
                 sw.WriteLine("|------------------------------------------------------------------------------------------------------------------------------------------------|");
                 sw.WriteLine((char)12);
                 AddHeader(sw, entity, pageNo);
             }
             sw.Write("|");
             sw.Write(report.StringFormat(i.ToString(), 4, 2));
             sw.Write(report.StringFormat(data.ITDescription.ToString(), 16, 2));
             sw.Write(report.StringFormat(report.DecimalformatForWeight(data.OpeningBalance.ToString()), 13, 1));
             sw.Write(report.StringFormat(report.DecimalformatForWeight(data.TotalReceipt.ToString()), 13, 1));
             sw.Write(report.StringFormat((report.DecimalformatForWeight((data.TotalReceipt + data.OpeningBalance).ToString())), 17, 1));
             sw.Write(report.StringFormat((report.DecimalformatForWeight((data.IssueSales + data.IssueOthers).ToString())), 13, 1));
             sw.Write(report.StringFormat(report.DecimalformatForWeight(data.ClosingBalance.ToString()), 13, 1));
             sw.Write(report.StringFormat(report.DecimalformatForWeight(data.CSBalance.ToString()), 20, 1));
             sw.Write(report.StringFormat(report.DecimalformatForWeight(data.Shortage.ToString()), 13, 1));
             sw.Write(report.StringFormat(report.DecimalformatForWeight(data.PhycialBalance.ToString()), 13, 1));
             sw.WriteLine("");
             count = count + 1;
             i++;
         }
         sw.WriteLine("|------------------------------------------------------------------------------------------------------------------------------------------------|");
         sw.WriteLine((char)12);
     }
     catch (Exception ex)
     {
         AuditLog.WriteError(ex.Message + " " + ex.StackTrace);
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="entity"></param>
        public void GenerateStockStatementReport(List <DailyStockDetailsEntity> stockDetailsEntity, StockParameter param)
        {
            string       fPath = string.Empty, subF_Path = string.Empty, fileName = string.Empty, filePath = string.Empty;
            StreamWriter streamWriter = null;

            try
            {
                fileName = (param.GCode + GlobalVariable.StockStatementFileName);
                fPath    = GlobalVariable.ReportPath + "Reports";
                report.CreateFolderIfnotExists(fPath);     // create a new folder if not exists
                subF_Path = fPath + "//" + param.UserName; //ManageReport.GetDateForFolder();
                report.CreateFolderIfnotExists(subF_Path);
                //delete file if exists
                filePath = subF_Path + "//" + fileName + ".txt";
                report.DeleteFileIfExists(filePath);

                streamWriter = new StreamWriter(filePath, true);
                StockStatementReport(streamWriter, stockDetailsEntity, param);

                //List<DailyStockDetailsEntity> dailyStocks = new List<DailyStockDetailsEntity>();
                //dailyStocks = report.ConvertDataTableToList<DailyStockDetailsEntity>(dailyStocks);
                streamWriter.Flush();
            }
            catch (Exception ex)
            {
                AuditLog.WriteError(ex.Message + " " + ex.StackTrace);
            }
            finally
            {
                streamWriter.Close();
                fPath        = string.Empty; fileName = string.Empty;
                streamWriter = null;
            }
        }