public static void CreateJournalForOnlineAgentCollection(int companyId, List <OnlineAgentDetails> agentlist)
        {
            try
            {
                CRSDAL dal    = null;
                string strErr = "";


                for (int i = 0; i < agentlist.Count; i++)
                {
                    if (strErr == "")
                    {
                        OnlineAgentDetails al = agentlist[i];
                        // string narration = AccountingUtil.GetNarration(al);
                        try
                        {
                            dal = new CRSDAL();
                            dal.AddParameter("p_CompanyID", companyId, ParameterDirection.Input);
                            dal.AddParameter("p_JourneyDate", agentlist[i].JourneyDate, ParameterDirection.Input);
                            dal.AddParameter("p_DebitLedgerId", agentlist[i].DebitLedgerId, ParameterDirection.Input);
                            dal.AddParameter("p_CreditLedgerId", agentlist[i].CreditLedgerId, ParameterDirection.Input);
                            dal.AddParameter("p_ClassID", agentlist[i].ClassID, ParameterDirection.Input);
                            dal.AddParameter("p_TotalAmount", agentlist[i].TotalFare, ParameterDirection.Input);
                            dal.AddParameter("p_docnumber", agentlist[i].Docnumber, 300, ParameterDirection.Input);
                            dal.AddParameter("p_AgentComm", agentlist[i].AgentComm, ParameterDirection.Input);
                            dal.AddParameter("p_NetAmount", agentlist[i].NetAmount, ParameterDirection.Input);
                            dal.AddParameter("p_GST", agentlist[i].GST, ParameterDirection.Input);
                            dal.AddParameter("p_Discount", agentlist[i].Discount, ParameterDirection.Input);


                            int status = dal.ExecuteDML("spKabraTallySet_OnlineAgentCollection_Test", CommandType.StoredProcedure, 0, ref strErr);

                            if (strErr != "")
                            {
                                throw new Exception();
                            }

                            EntryCounter.GetInstance().AddCount(1);
                        }
                        catch (Exception ex)
                        {
                            Logger.WriteLog("OnlineAgentAPI", "CreateJournalForOnlineAgentCollection", " Error for Agent: " + agentlist[i].AgentName + " " + ex.Message);
                            Logger.WriteLogAlert2("OnlineAgentAPI" + "CreateJournalForOnlineAgentCollection" + " Error for Agent: " + agentlist[i].AgentName + " " + ex.Message);
                            PostingAPI.UpdatePostingStatusForException(companyId, agentlist[i].JourneyDate, 9);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.WriteLog("OnlineAgentAPI", "CreateJournalForOnlineAgentCollection", ex.Message);
                Logger.WriteLogAlert("OnlineAgentAPI" + "CreateJournalForOnlineAgentCollection" + ex.Message);
            }
        }
        public static void CreateSaleForFranchiseCollection(int companyId, List <Franchise> FranchiseCollectionList)
        {
            try
            {
                CRSDAL dal    = null;
                string strErr = "";

                for (int i = 0; i < FranchiseCollectionList.Count; i++)
                {
                    if (strErr == "")
                    {
                        Franchise fv        = FranchiseCollectionList[i];
                        string    narration = AccountingUtil.GetNarration(fv);
                        try
                        {
                            dal = new CRSDAL();
                            dal.AddParameter("p_CompanyID", companyId, ParameterDirection.Input);
                            dal.AddParameter("p_JourneyDate", FranchiseCollectionList[i].JourneyDate, ParameterDirection.Input);
                            dal.AddParameter("p_DebitLedgerId", FranchiseCollectionList[i].DebitLedgerId, ParameterDirection.Input);
                            dal.AddParameter("p_CreditLedgerId", FranchiseCollectionList[i].CreditLedgerId, ParameterDirection.Input);
                            dal.AddParameter("p_NetAmount", FranchiseCollectionList[i].NetAmount, ParameterDirection.Input);
                            dal.AddParameter("p_TotalAmount", FranchiseCollectionList[i].TotalAmt, ParameterDirection.Input);
                            dal.AddParameter("p_GST", FranchiseCollectionList[i].ServiceTax, ParameterDirection.Input);
                            dal.AddParameter("p_docnumber", FranchiseCollectionList[i].DocNumber, 300, ParameterDirection.Input);
                            dal.AddParameter("p_ClassID", FranchiseCollectionList[i].ClassID, ParameterDirection.Input);
                            dal.AddParameter("p_AgentComm", FranchiseCollectionList[i].AggentComm, ParameterDirection.Input);
                            dal.AddParameter("p_Discount", FranchiseCollectionList[i].Discount, ParameterDirection.Input);

                            int status = dal.ExecuteDML("spKabraTallySet_FranchiseBooking_Test", CommandType.StoredProcedure, 0, ref strErr);
                            if (strErr != "")
                            {
                                throw new Exception();
                            }

                            EntryCounter.GetInstance().AddCount(1);
                        }
                        catch (Exception ex)
                        {
                            Logger.WriteLog("FranchiseCollection", "CreateSaleForFranchiseCollection", " Error for Franchise: " + FranchiseCollectionList[i].FranchiseName + " " + ex.Message);
                            Logger.WriteLogAlert2("FranchiseCollection" + "CreateSaleForFranchiseCollection" + " Error for Franchise: " + FranchiseCollectionList[i].FranchiseName + " " + ex.Message);
                            PostingAPI.UpdatePostingStatusForException(companyId, FranchiseCollectionList[i].JourneyDate, 9);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.WriteLog("FranchiseCollection", "CreateSaleForFranchiseCollection", ex.Message);
                Logger.WriteLogAlert("FranchiseCollection" + "CreateSaleForFranchiseCollection" + ex.Message);
            }
        }
Esempio n. 3
0
        public static void CreateJournalForUserWiseCollection(int companyId, List <Booking> bookingsList)
        {
            try
            {
                CRSDAL dal    = new CRSDAL();
                string strErr = "";



                for (int i = 0; i < bookingsList.Count; i++)
                {
                    Booking b = bookingsList[i];
                    if (strErr == "")
                    {
                        try
                        {
                            dal = new CRSDAL();
                            dal.AddParameter("p_CompanyID", companyId, ParameterDirection.Input);
                            dal.AddParameter("p_JourneyDate", bookingsList[i].JourneyDate, ParameterDirection.Input);
                            dal.AddParameter("p_DebitLedgerId", bookingsList[i].DebitLedgerId, ParameterDirection.Input);
                            dal.AddParameter("p_CreditLedgerId", bookingsList[i].CreditLedgerId, ParameterDirection.Input);
                            dal.AddParameter("p_ClassID", bookingsList[i].ClassId, ParameterDirection.Input);
                            dal.AddParameter("p_TotalAmount", bookingsList[i].TotalAmount, ParameterDirection.Input);
                            dal.AddParameter("p_NetAmount", bookingsList[i].NetAmount, ParameterDirection.Input);
                            dal.AddParameter("p_GST", bookingsList[i].GST, ParameterDirection.Input);
                            dal.AddParameter("p_docnumber", bookingsList[i].DocNumber, 300, ParameterDirection.Input);

                            int status = dal.ExecuteDML("spKabraTallySet_BranchCollection_Test", CommandType.StoredProcedure, 0, ref strErr);
                            EntryCounter.GetInstance().AddCount(1);
                            if (strErr != "")
                            {
                                throw new Exception();
                            }
                        }
                        catch (Exception ex)
                        {
                            Logger.WriteLog("BookingAPI", "CreateJournalForUserWiseCollection", " Error for Branch: " + bookingsList[i].BranchName + " " + ex.Message);
                            Logger.WriteLogAlert2("BookingAPI " + "Error:CreateJournalForUserWiseCollection For JournalID: " + bookingsList[i].BranchName + " " + ex.Message);
                            PostingAPI.UpdatePostingStatusForException(companyId, bookingsList[i].JourneyDate, 9);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.WriteLog("BookingAPI", "CreateJournalForUserWiseCollection", ex.Message);
                Logger.WriteLogAlert("BookingAPI" + "CreateJournalForUserWiseCollection" + ex.Message);
            }
        }