コード例 #1
0
    private string CreateCreditNoteFlight(string FlightRequestId)
    {
        try
        {
            string  strMessage = string.Empty;
            DataSet objds      = objBAFlightSearch.GetAirTicketingMasterByFlightRequestId(FlightRequestId);
            if (objds.Tables[0].Rows.Count > 0)
            {
                //string strTotalAmout = objds.Tables[0].Rows[0]["Amount"].ToString();
                //string strCancelAmount = objds.Tables[0].Rows[0]["TotalCancelPenalty"].ToString();
                //string ReturnAmount = (Convert.ToDecimal(strTotalAmout) - Convert.ToDecimal(strCancelAmount)).ToString();


                TravelRequestProcess objTravelRequest = new TravelRequestProcess();
                objTravelRequest.costcentre            = objds.Tables[1].Rows[0]["cost_center"].ToString();
                objTravelRequest.creditnotedescription = "Flight Was Canceled " + FlightRequestId;
                objTravelRequest.invoicenumber         = objds.Tables[1].Rows[0]["QuotationRefNo"].ToString().Replace("QT", "INV");
                objTravelRequest.creditnotenumber      = objds.Tables[1].Rows[0]["QuotationRefNo"].ToString().Replace("QT", "CRD");
                objTravelRequest.creditnotedate        = DateTime.Now.ToString("dd-MMM-yyyy").ToUpper();
                objTravelRequest.totamountincvat       = objds.Tables[1].Rows[0]["FlightPrice"].ToString();
                objTravelRequest.supplierno            = _strUKZNsupplierno;
                List <UKZNInoviceDetails> LstObjUKZNInoviceDetails = new List <UKZNInoviceDetails>();

                UKZNInoviceDetails objUKZNInoviceDetails = new UKZNInoviceDetails();

                objUKZNInoviceDetails.invoiceitemnumber = "F_" + FlightRequestId;
                objUKZNInoviceDetails.accountnumber     = objds.Tables[1].Rows[0]["AccountCode"].ToString();
                objUKZNInoviceDetails.itemamountincvat  = objds.Tables[1].Rows[0]["TotalPrice"].ToString();
                objUKZNInoviceDetails.itemvatamount     = _objBoutility.CalculateVat(Convert.ToDecimal(objUKZNInoviceDetails.itemvatamount), _decVarPercentage).ToString();


                objUKZNInoviceDetails.credititemdescription = "Credit note test in tms";
                objUKZNInoviceDetails.alreadycreditedyn     = "N";
                LstObjUKZNInoviceDetails.Add(objUKZNInoviceDetails);

                objTravelRequest.ListObjectUKZNInvoice = LstObjUKZNInoviceDetails;

                strMessage = _objUKZNTravelRequest.validatecrnote(objTravelRequest);
            }
            return(strMessage);
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
コード例 #2
0
    private string UKZNCreateInvoice(string FileNo)
    {
        try
        {
            DataSet objDs         = _objBALFileManager.GetQuotationMasterByFileNo(FileNo);
            string  strMessage    = string.Empty;
            int     ItemInvoiceNo = 0;
            if (objDs.Tables[0].Rows.Count > 0)
            {
                int CreatedBy = Convert.ToInt32(Session["loginId"]);
                int RoleId    = Convert.ToInt32(Session["role_id"]);
                int CompanyId = Convert.ToInt32(Session["CompanyId"]);

                string  QuotationRefNo = objDs.Tables[0].Rows[0]["QuotationMasterId"].ToString();
                DataSet objDsQut       = _objBOQutation.GetQuotationMasterDetailsWithRefNo(Convert.ToInt32(QuotationRefNo), RoleId, CompanyId, CreatedBy, "");
                TravelRequestProcess      objTravelRequest = new TravelRequestProcess();
                List <UKZNInoviceDetails> LstObj           = new List <UKZNInoviceDetails>();
                if (objDsQut.Tables[2].Rows.Count > 0)
                {
                    objTravelRequest.supplierno         = _strUKZNsupplierno;
                    objTravelRequest.invoicenumber      = objDsQut.Tables[2].Rows[0]["QuotationRefNo"].ToString().Replace("QT", "INV");
                    objTravelRequest.totamountincvat    = objDsQut.Tables[2].Rows[0]["TripAmount"].ToString();
                    objTravelRequest.invoicedate        = DateTime.Now.ToString("dd-MMM-yyyy").ToUpper();
                    objTravelRequest.invoicedescription = "Invoice order no " + objDsQut.Tables[2].Rows[0]["ukzn_orderno"].ToString();
                    objTravelRequest.ordernumber        = objDsQut.Tables[2].Rows[0]["ukzn_orderno"].ToString();
                    objTravelRequest.costcentre         = objDsQut.Tables[2].Rows[0]["cost_center"].ToString();
                }
                if (objDsQut.Tables[0].Rows.Count > 0)// Flight Invoice
                {
                    foreach (DataRow QuotationRow in objDsQut.Tables[0].Rows)
                    {
                        ItemInvoiceNo = ItemInvoiceNo + 1;
                        UKZNInoviceDetails objF = new UKZNInoviceDetails();
                        objF.accountnumber          = QuotationRow["AccountCode"].ToString();
                        objF.uniquerequestid        = "F_" + QuotationRow["FlightRequestId"].ToString(); // QuotationRow["Fromcode"].ToString();
                        objF.invoiceitemnumber      = ItemInvoiceNo.ToString();                          // QuotationRow["FlightRequestId"].ToString();//"F_" + QuotationRow["FlightRequestId"].ToString();
                        objF.invoiceitemdescription = "Flight Item invoice created for file no" + FileNo;
                        objF.invoiceitemnote        = "not paid";
                        objF.fullyprocessedyn       = "N"; //QuotationRow["Fromcode"].ToString();
                        objF.alreadypaidyn          = "N"; // QuotationRow["Fromcode"].ToString();
                        objF.itemamountincvat       = QuotationRow["TotalPrice"].ToString();
                        objF.commentstmc            = "Flight invoice created" + QuotationRow["FlightRequestId"].ToString();
                        objF.itemvatamount          = _objBOUtiltiy.CalculateVat(Convert.ToDecimal(objF.itemamountincvat), _decVarPercentage).ToString();

                        LstObj.Add(objF);
                    }
                }
                if (objDsQut.Tables[1].Rows.Count > 0)// Hotel Invoice
                {
                    foreach (DataRow QuotationRow in objDsQut.Tables[1].Rows)
                    {
                        ItemInvoiceNo = ItemInvoiceNo + 1;
                        UKZNInoviceDetails objH = new UKZNInoviceDetails();
                        objH.accountnumber          = QuotationRow["AccountCode"].ToString();
                        objH.uniquerequestid        = "A_" + QuotationRow["HotelRequestId"].ToString(); // QuotationRow["Fromcode"].ToString();
                        objH.invoiceitemdescription = "Hotel Item Invoice Created for file no" + FileNo;
                        objH.invoiceitemnumber      = ItemInvoiceNo.ToString();                         //"A_" + QuotationRow["HotelRequestId"].ToString();
                        objH.invoiceitemnote        = "not paid";
                        objH.fullyprocessedyn       = "N";                                              //QuotationRow["Fromcode"].ToString();
                        objH.alreadypaidyn          = "N";                                              // QuotationRow["Fromcode"].ToString();
                        objH.itemamountincvat       = QuotationRow["TotalFee"].ToString();
                        objH.commentstmc            = "Hotel Invoice Created" + QuotationRow["HotelRequestId"].ToString();
                        objH.itemvatamount          = _objBOUtiltiy.CalculateVat(Convert.ToDecimal(objH.itemamountincvat), _decVarPercentage).ToString();

                        LstObj.Add(objH);
                    }
                }
                objTravelRequest.ListObjectUKZNInvoice = LstObj;
                strMessage = _objUKZNTravelRequest.validateinvoice(objTravelRequest);
                if (strMessage == "Success")
                {
                    _objBALFileManager.UpdateFileMaster(FileNo, "Invoice created in integrator");
                }
            }
            else
            {
                lblMsg.Text = _objBOUtiltiy.ShowMessage("danger", "Error ", "No order find with this order no.");
            }
            return(strMessage);
        }
        catch (Exception ex)
        {
            lblMsg.Text = _objBOUtiltiy.ShowMessage("danger", "Error ", ex.Message);
            return("");
        }
    }
コード例 #3
0
    private string UKZNCreateInvoice(string FileNo)
    {
        try
        {
            decimal TotalAmount   = 0;
            DataSet objDs         = objBALFileManager.GetQuotationMasterByFileNo(FileNo);
            string  strMessage    = string.Empty;
            int     ItemInvoiceNo = 0;
            if (objDs.Tables[0].Rows.Count > 0)
            {
                int CreatedBy = Convert.ToInt32(Session["loginId"]);
                int RoleId    = Convert.ToInt32(Session["role_id"]);
                int CompanyId = Convert.ToInt32(Session["CompanyId"]);

                string  QuotationRefNo = objDs.Tables[0].Rows[0]["QuotationMasterId"].ToString();
                DataSet objDsQut       = _objBOQutation.GetQuotationMasterDetailsWithRefNo(Convert.ToInt32(QuotationRefNo), RoleId, CompanyId, CreatedBy, "");
                TravelRequestProcess      objTravelRequest = new TravelRequestProcess();
                List <UKZNInoviceDetails> LstObj           = new List <UKZNInoviceDetails>();

                int FlightRequestID = 0;
                int HotelRequestId  = 0;
                int CabRequestId    = 0;

                if (objDsQut.Tables[0].Rows.Count > 0)// Flight Invoice
                {
                    foreach (GridViewRow row in gdvFlightBookings.Rows)
                    {
                        CheckBox chk = row.FindControl("chkSelect") as CheckBox;
                        if (chk != null && chk.Checked)
                        {
                            foreach (DataRow QuotationRow in objDsQut.Tables[0].Rows)
                            {
                                ItemInvoiceNo = ItemInvoiceNo + 1;
                                UKZNInoviceDetails objF = new UKZNInoviceDetails();
                                objF.accountnumber          = QuotationRow["AccountCode"].ToString();
                                objF.uniquerequestid        = "F_" + QuotationRow["FlightRequestId"].ToString(); // QuotationRow["Fromcode"].ToString();
                                objF.invoiceitemnumber      = ItemInvoiceNo.ToString();                          // QuotationRow["FlightRequestId"].ToString();//"F_" + QuotationRow["FlightRequestId"].ToString();
                                objF.invoiceitemdescription = "Flight Item invoice created for file no" + FileNo;
                                objF.invoiceitemnote        = "not paid";
                                objF.fullyprocessedyn       = "N"; //QuotationRow["Fromcode"].ToString();
                                objF.alreadypaidyn          = "N"; // QuotationRow["Fromcode"].ToString();
                                objF.itemamountincvat       = QuotationRow["TotalPrice"].ToString();
                                TotalAmount        = TotalAmount + Convert.ToDecimal(QuotationRow["TotalPrice"].ToString());
                                objF.commentstmc   = "Flight invoice created" + QuotationRow["FlightRequestId"].ToString();
                                objF.itemvatamount = _objBoutility.CalculateVat(Convert.ToDecimal(objF.itemamountincvat), _decVarPercentage).ToString();
                                FlightRequestID    = Convert.ToInt32(QuotationRow["FlightRequestId"]);
                                LstObj.Add(objF);
                            }
                        }
                    }
                }
                if (objDsQut.Tables[1].Rows.Count > 0)// Hotel Invoice
                {
                    foreach (DataRow QuotationRow in objDsQut.Tables[1].Rows)
                    {
                        foreach (GridViewRow row in gdvHotelBooking.Rows)
                        {
                            CheckBox chk = row.FindControl("chkSelect") as CheckBox;
                            if (chk != null && chk.Checked)
                            {
                                ItemInvoiceNo = ItemInvoiceNo + 1;
                                UKZNInoviceDetails objH = new UKZNInoviceDetails();
                                objH.accountnumber          = QuotationRow["AccountCode"].ToString();
                                objH.uniquerequestid        = "A_" + QuotationRow["HotelRequestId"].ToString(); // QuotationRow["Fromcode"].ToString();
                                objH.invoiceitemdescription = "Hotel Item Invoice Created for file no" + FileNo;
                                objH.invoiceitemnumber      = ItemInvoiceNo.ToString();                         //"A_" + QuotationRow["HotelRequestId"].ToString();
                                objH.invoiceitemnote        = "not paid";
                                objH.fullyprocessedyn       = "N";                                              //QuotationRow["Fromcode"].ToString();
                                objH.alreadypaidyn          = "N";                                              // QuotationRow["Fromcode"].ToString();
                                objH.itemamountincvat       = QuotationRow["TotalFee"].ToString();
                                objH.commentstmc            = "Hotel Invoice Created" + QuotationRow["HotelRequestId"].ToString();
                                objH.itemvatamount          = _objBoutility.CalculateVat(Convert.ToDecimal(objH.itemamountincvat), _decVarPercentage).ToString();
                                TotalAmount    = TotalAmount + Convert.ToDecimal(QuotationRow["TotalFee"].ToString());
                                HotelRequestId = Convert.ToInt32(QuotationRow["HotelRequestId"]);
                                LstObj.Add(objH);
                            }
                        }
                    }
                }

                if (objDsQut.Tables[3].Rows.Count > 0)// Hotel Invoice
                {
                    foreach (DataRow QuotationRow in objDsQut.Tables[3].Rows)
                    {
                        foreach (GridViewRow row in gvCarBookings.Rows)
                        {
                            CheckBox chk = row.FindControl("chkSelect") as CheckBox;
                            if (chk != null && chk.Checked)
                            {
                                ItemInvoiceNo = ItemInvoiceNo + 1;
                                UKZNInoviceDetails objc = new UKZNInoviceDetails();
                                objc.accountnumber          = "30031";
                                objc.uniquerequestid        = "C_" + QuotationRow["CarDescId"].ToString(); // QuotationRow["Fromcode"].ToString();
                                objc.invoiceitemdescription = "Car Item Invoice Created for file no" + FileNo;
                                objc.invoiceitemnumber      = ItemInvoiceNo.ToString();                    //"A_" + QuotationRow["HotelRequestId"].ToString();
                                objc.invoiceitemnote        = "not paid";
                                objc.fullyprocessedyn       = "N";                                         //QuotationRow["Fromcode"].ToString();
                                objc.alreadypaidyn          = "N";                                         // QuotationRow["Fromcode"].ToString();
                                objc.itemamountincvat       = QuotationRow["TotalPrice"].ToString();
                                objc.commentstmc            = "Hotel Invoice Created" + QuotationRow["CarDescId"].ToString();
                                objc.itemvatamount          = _objBoutility.CalculateVat(Convert.ToDecimal(objc.itemamountincvat), _decVarPercentage).ToString();
                                TotalAmount  = TotalAmount + Convert.ToDecimal(QuotationRow["TotalPrice"].ToString());
                                CabRequestId = Convert.ToInt32(QuotationRow["CarDescId"]);
                                LstObj.Add(objc);
                            }
                        }
                    }
                }
                if (TotalAmount > 0)
                {
                    string Invocie = "0";
                    if (objDsQut.Tables[2].Rows.Count > 0)
                    {
                        BALUser objBALUer = new BALUser();
                        int     InvoiceNo = objBALUer.GenerateInvocieNo();
                        Invocie = "INV" + InvoiceNo.ToString("000");
                        objTravelRequest.supplierno         = _strUKZNsupplierno;
                        objTravelRequest.invoicenumber      = objDsQut.Tables[2].Rows[0]["QuotationRefNo"].ToString().Replace("QT", "IN_"); // Invocie;
                        objTravelRequest.totamountincvat    = TotalAmount.ToString();                                                       // objDsQut.Tables[2].Rows[0]["TripAmount"].ToString();
                        objTravelRequest.invoicedate        = DateTime.Now.ToString("dd-MMM-yyyy").ToUpper();
                        objTravelRequest.invoicedescription = "Invoice order no " + objDsQut.Tables[2].Rows[0]["ukzn_orderno"].ToString();
                        objTravelRequest.ordernumber        = objDsQut.Tables[2].Rows[0]["ukzn_orderno"].ToString();
                        objTravelRequest.costcentre         = objDsQut.Tables[2].Rows[0]["cost_center"].ToString();
                    }
                    objTravelRequest.ListObjectUKZNInvoice = LstObj;
                    strMessage = _objUKZNTravelRequest.validateinvoice(objTravelRequest);
                    if (strMessage == "Success")
                    {
                        objBALFileManager.UpdateFileMaster(FileNo, Invocie);
                        lblMsg.Text = _objBoutility.ShowMessage("succcess", "info ", "Invoice created in integrator");
                    }
                    else
                    {
                        objBALFileManager.UpdateFileMaster(FileNo, strMessage);
                        lblMsg.Text = _objBoutility.ShowMessage("succcess", "info ", strMessage);
                    }
                }
                else
                {
                    lblMsg.Text = _objBoutility.ShowMessage("danger", "Error ", "Please select item");
                }
            }
            else
            {
                lblMsg.Text = _objBoutility.ShowMessage("danger", "Error ", "No order find with this order no.");
            }
            return(strMessage);
        }
        catch (Exception ex)
        {
            lblMsg.Text = _objBoutility.ShowMessage("danger", "Error ", ex.Message);
            return("");
        }
    }