Пример #1
0
        private async void btnUpdtVehicleNo_Click(object sender, EventArgs e)
        {
            ReqVehicleNoUpdtPl reqVehicleNo = new ReqVehicleNoUpdtPl();

            reqVehicleNo.EwbNo        = 391000800056;
            reqVehicleNo.VehicleNo    = "PQR1234";
            reqVehicleNo.FromPlace    = "BANGALORE";
            reqVehicleNo.FromState    = 29;
            reqVehicleNo.ReasonCode   = "1";
            reqVehicleNo.ReasonRem    = "vehicle broke down";
            reqVehicleNo.TransDocNo   = "1234";
            reqVehicleNo.TransDocDate = "16/03/2018";
            reqVehicleNo.TransMode    = "1";

            TxnRespWithObj <RespVehicleNoUpdtPl> resVehicleNoUpdt = await EWBAPI.UpdateVehicleNosync(EwbSession, reqVehicleNo);

            if (resVehicleNoUpdt.IsSuccess)
            {
                rtbResponce.Text = JsonConvert.SerializeObject(resVehicleNoUpdt.RespObj);
            }
            else
            {
                rtbResponce.Text = resVehicleNoUpdt.TxnOutcome;
            }
        }
Пример #2
0
        private async void btnGenerateCEWB_Click(object sender, EventArgs e)
        {
            ReqGenCEwbPl reqCEWB = new ReqGenCEwbPl();

            reqCEWB.fromPlace         = "BANGALORE SOUTH";
            reqCEWB.fromState         = "29";
            reqCEWB.vehicleNo         = "KA12AB1234";
            reqCEWB.transMode         = "1";
            reqCEWB.TransDocNo        = "1234";
            reqCEWB.TransDocDate      = "26/02/2018";
            reqCEWB.tripSheetEwbBills = new List <ReqGenCEwbPl.TripSheetEwbBills>();
            reqCEWB.tripSheetEwbBills.Add(new ReqGenCEwbPl.TripSheetEwbBills {
                ewbNo = 391000800056,
            });

            TxnRespWithObj <RespGenCEwbPl> respGenCEWB = await EWBAPI.GenCEWBAsync(EwbSession, reqCEWB);

            if (respGenCEWB.IsSuccess)
            {
                rtbResponce.Text = JsonConvert.SerializeObject(respGenCEWB.RespObj);
            }
            else
            {
                rtbResponce.Text = respGenCEWB.TxnOutcome;
            }
        }
Пример #3
0
        private async void btnGetAuthToken_Click(object sender, EventArgs e)
        {
            try
            {
                lblOutCome.Text = "Please Wait...";
                await Task.Delay(200);

                if (GstSession.ApiLoginDetails == null)
                {
                    GstSession.ApiLoginDetails = new APILoginDetails();
                }
                if (GstSession.ApiLoginDetails.GSTIN != txtGSTIN.Text)
                {
                    GstSession.ApiLoginDetails.GSTIN           = txtGSTIN.Text;
                    GstSession.ApiLoginDetails.GstPortalUserID = txtGSTUserID.Text;
                }
                TxnRespWithObj <APISession> AuthResp = await AuthAPI.GetAuthTokenAsync(GstSession, txtOTP.Text);

                lblOutCome.Text = AuthResp.TxnOutcome + "\nAuth Token (Please Store): " + GstSession.ApiLoginDetails.AuthToken +
                                  "\nSession EK: " + GstSession.ApiLoginDetails.SessionEK +
                                  "\nExpiary: " + GstSession.ApiLoginDetails.TokenExp;
                //Save Updated Details
                Shared.SaveAPISetting(GstSession.ApiSetting);
                Shared.SaveAPILoginDetails(GstSession.ApiLoginDetails);
                ShowUpdatedAPILoginDetails();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #4
0
        private async void btnGenEWB_Click(object sender, EventArgs e)
        {
            //Generate Ewb By IRN
            ReqPlGenEwbByIRN reqPlGenEwbByIRN = new ReqPlGenEwbByIRN();

            reqPlGenEwbByIRN.Irn               = "48004d31b8f2afd2bb660911fd58602753c069cfec3bca58eda300822ce0b540";
            reqPlGenEwbByIRN.TransId           = "27AACFM5833D1ZH";//12AWGPV7107B1Z1
            reqPlGenEwbByIRN.TransMode         = "3";
            reqPlGenEwbByIRN.TransDocNo        = "DOC7";
            reqPlGenEwbByIRN.TransDocDt        = "18/11/2020"; //
            reqPlGenEwbByIRN.VehNo             = "ka123458";   //
            reqPlGenEwbByIRN.Distance          = 100;
            reqPlGenEwbByIRN.VehType           = "R";          //R
            reqPlGenEwbByIRN.TransName         = "DFHGF";
            reqPlGenEwbByIRN.ExpShipDtls       = new ExportShipDetails();
            reqPlGenEwbByIRN.ExpShipDtls.Addr1 = "7th block, kuvempu layout";
            reqPlGenEwbByIRN.ExpShipDtls.Addr2 = "kuvempu layout";
            reqPlGenEwbByIRN.ExpShipDtls.Loc   = "Banagalore";
            reqPlGenEwbByIRN.ExpShipDtls.Pin   = 562160;
            reqPlGenEwbByIRN.ExpShipDtls.Stcd  = "29";
            reqPlGenEwbByIRN.DispDtls          = new DispatchedDetails();
            reqPlGenEwbByIRN.DispDtls.Nm       = "ABC company pvt ltd";
            reqPlGenEwbByIRN.DispDtls.Addr1    = "7th block, kuvempu layout";
            reqPlGenEwbByIRN.DispDtls.Addr2    = "kuvempu layout";
            reqPlGenEwbByIRN.DispDtls.Loc      = "Banagalore";
            reqPlGenEwbByIRN.DispDtls.Pin      = 562160;
            reqPlGenEwbByIRN.DispDtls.Stcd     = "29";

            TxnRespWithObj <RespPlGenEwbByIRN> txnRespWithObj = await eInvoiceAPI.GenEwbByIRNAsync(eInvSession, reqPlGenEwbByIRN);

            string ErrorCodes = "";
            string ErrorDesc  = "";

            rtbResponce.Text = "";
            if (txnRespWithObj.IsSuccess)
            {
                rtbResponce.Text = JsonConvert.SerializeObject(txnRespWithObj.RespObj);
            }
            else
            {
                // rtbResponce.Text = txnRespWithObj.TxnOutcome;
                if (txnRespWithObj.ErrorDetails != null)
                {
                    foreach (RespErrDetailsPl errPl in txnRespWithObj.ErrorDetails)
                    {
                        //Process errPl item here
                        ErrorCodes      += errPl.ErrorCode + ",";
                        ErrorDesc       += errPl.ErrorCode + ": " + errPl.ErrorMessage + Environment.NewLine;
                        rtbResponce.Text = ErrorDesc;
                    }
                }
            }


            txtResponceHdr.Text = "Generate IRN Responce...";
        }
Пример #5
0
        private async void btnAuthToken_Click(object sender, EventArgs e)
        {
            TxnRespWithObj <eInvoiceSession> txnRespWithObj = await eInvoiceAPI.GetAuthTokenAsync(eInvSession);

            if (txnRespWithObj.IsSuccess)
            {
                DisplayLoginDetail();
                //rtbResponce.Text = JsonConvert.SerializeObject(rtbResponce.Text);
            }
            txtResponceHdr.Text = "Auth Api Responce";
            rtbResponce.Text    = txnRespWithObj.TxnOutcome;
        }
Пример #6
0
        private async void btnGetApiBal_Click(object sender, EventArgs e)
        {
            try
            {
                TxnRespWithObj <AspApiBalance> txnResp = await GspAPI.GetAspApiBalanceAsync(GstSession);

                lblAPIMsg.Text = txnResp.TxnOutcome;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #7
0
        private async void btnByOthParty_Click(object sender, EventArgs e)
        {
            string Date = "01/03/2018 10:41:00 AM";
            TxnRespWithObj <AssignedEWBItem> TxnResp = await EWBAPI.GetEWBOfOtherPartyAsync(EwbSession, Date);

            if (TxnResp.IsSuccess)
            {
                rtbResponce.Text = JsonConvert.SerializeObject(TxnResp.RespObj);
            }
            else
            {
                rtbResponce.Text = TxnResp.TxnOutcome;
            }
        }
Пример #8
0
        private async void btnAuthToken_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Calling any API method will internally check for valid AuthToken and would try to obtain AuthToken if its is expired.  You don't need to explicitly call GetAuthTokenAsync method. Do you want to proceed?", "AuthToken is Automatic", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                TxnRespWithObj <EWBSession> TxnResp = await EWBAPI.GetAuthTokenAsync(EwbSession);

                if (TxnResp.IsSuccess)
                {
                    //Call Refresh Display Api Login Details to refresh auth token and Exp Time in display
                    DisplayApiLoginDetails();
                }
                rtbResponce.Text = TxnResp.TxnOutcome;
            }
        }
Пример #9
0
        private async void btnGetEWBDetails_Click(object sender, EventArgs e)
        {
            string EwbNo = "391000800056";
            TxnRespWithObj <RespGetEWBDetail> TxnResp = await EWBAPI.GetEWBDetailAsync(EwbSession, EwbNo);

            if (TxnResp.IsSuccess)
            {
                rtbResponce.Text = JsonConvert.SerializeObject(TxnResp.RespObj);
            }
            else
            {
                rtbResponce.Text = TxnResp.TxnOutcome;
            }
        }
Пример #10
0
        private async void btnGetCEWB_Click(object sender, EventArgs e)
        {
            string tripSheetNo = "3410001807";
            TxnRespWithObj <GetConsolidatedEWB> TxnResp = await EWBAPI.GetConsolidatedEWBAsync(EwbSession, tripSheetNo);

            if (TxnResp.IsSuccess)
            {
                rtbResponce.Text = JsonConvert.SerializeObject(TxnResp.RespObj);
            }
            else
            {
                rtbResponce.Text = TxnResp.TxnOutcome;
            }
        }
Пример #11
0
        private async void btnGetEDetails_Click(object sender, EventArgs e)
        {
            string IrnNo = "745df0b4855ee4afb167152bb9d4c4879c496988892027f51fc5bf14be6fc02e";
            TxnRespWithObj <RespPlGenIRN> txnRespWithObj = await eInvoiceAPI.GetEInvDetailsAsync(eInvSession, IrnNo);

            if (txnRespWithObj.IsSuccess)
            {
                rtbResponce.Text = JsonConvert.SerializeObject(txnRespWithObj.RespObj);
            }
            else
            {
                rtbResponce.Text = txnRespWithObj.TxnOutcome;
            }
            txtResponceHdr.Text = "Get IRN Detail Responce...";
        }
Пример #12
0
        private async void btnAsignedByGSTIN_Click(object sender, EventArgs e)
        {
            string genGSTIN = "08AABCW0619D1ZO";
            string Date     = "01/03/2018 10:41:00 AM";
            TxnRespWithObj <AssignedEWBItem> TxnResp = await EWBAPI.GetEWBAssignedForTransByGstinAsync(EwbSession, Date, genGSTIN);

            if (TxnResp.IsSuccess)
            {
                rtbResponce.Text = JsonConvert.SerializeObject(TxnResp.RespObj);
            }
            else
            {
                rtbResponce.Text = TxnResp.TxnOutcome;
            }
        }
Пример #13
0
        private async void btnGSTINDet_Click(object sender, EventArgs e)
        {
            string GSTIN = "************";
            TxnRespWithObj <RespPlGetGSTIN> txnRespWithObj = await eInvoiceAPI.GetGSTINDetailsAsync(eInvSession, GSTIN);

            if (txnRespWithObj.IsSuccess)
            {
                rtbResponce.Text = JsonConvert.SerializeObject(txnRespWithObj.RespObj);
            }
            else
            {
                rtbResponce.Text = txnRespWithObj.TxnOutcome;
            }

            txtResponceHdr.Text = "Get GSTIN Detail Responce...";
        }
Пример #14
0
        private async void btnRejectEWB_Click(object sender, EventArgs e)
        {
            ReqRejectEwbPl reqRejectEWB = new ReqRejectEwbPl();

            reqRejectEWB.ewbNo = "481000612981";
            TxnRespWithObj <RespRejectEwbPl> respRejectEWB = await EWBAPI.RejectEWBAsync(EwbSession, reqRejectEWB);

            if (respRejectEWB.IsSuccess)
            {
                rtbResponce.Text = JsonConvert.SerializeObject(respRejectEWB.RespObj);
            }
            else
            {
                rtbResponce.Text = respRejectEWB.TxnOutcome;
            }
        }
Пример #15
0
        private async void PrintewayBill()
        {
            string strJSON = "";

            if (DateTime.Now < EwbSession.EwbApiLoginDetails.EwbTokenExp)
            {
                lblResponce.Text = EwbSession.EwbApiLoginDetails.EwbAuthToken + "valid Upto:" + EwbSession.EwbApiLoginDetails.EwbTokenExp.ToString();
            }
            else
            {
                TxnRespWithObj <EWBSession> TxnSesResp = await EWBAPI.GetAuthTokenAsync(EwbSession);

                if (TxnSesResp.IsSuccess == true)
                {
                    lblResponce.Text = TxnSesResp.RespObj.EwbApiLoginDetails.EwbAuthToken;
                    strJSON          = JsonConvert.SerializeObject(TxnSesResp.RespObj.EwbApiLoginDetails);
                    Database.CommandExecutor("Update Company set EwbLoginDetail='" + strJSON + "'");
                    UpdateEwayBalance(-1, "On Print Auth");
                    CheckEwayBalance(false);
                }
                else
                {
                    lblResponce.Text = TxnSesResp.TxnOutcome;
                    CheckEwayBalance(false);
                    return;
                }
            }


            string rtbResponce = "";
            TxnRespWithObj <RespGetEWBDetail> TxnResp = await EWBAPI.GetEWBDetailAsync(EwbSession, EwbNo);

            if (TxnResp.IsSuccess == true)
            {
                UpdateEwayBalance(-1, "On Print Detail");
                EWBAPI.PrintEWB(EwbSession, TxnResp.RespObj, "", true, true);
                UpdateEwayBalance(-1, "On Print");
            }
            else
            {
                rtbResponce = TxnResp.TxnOutcome;
                UpdateEwayBalance(-1, TxnResp.TxnOutcome);
            }

            CheckEwayBalance(false);
        }
Пример #16
0
        private async void btnGetEWBByIRN_Click(object sender, EventArgs e)
        {
            {
                string IRN_No = "37d86afc1379fc963c1488a1bcf3c781f0011a920fc6ee7e1cd5ffc177bc7e18";
                TxnRespWithObj <RespGetEWBByIRN> txnRespWithObj = await eInvoiceAPI.GetEWBByIRNAsync(eInvSession, IRN_No);

                if (txnRespWithObj.IsSuccess)
                {
                    rtbResponce.Text = JsonConvert.SerializeObject(txnRespWithObj.RespObj);
                }
                else
                {
                    rtbResponce.Text = txnRespWithObj.TxnOutcome;
                }

                txtResponceHdr.Text = "Get EWB By IRN Responce...";
            }
        }
Пример #17
0
        private async void btnCancelEWB_Click(object sender, EventArgs e)
        {
            ReqCancelEwbPl reqCancelEWB = new ReqCancelEwbPl();

            reqCancelEWB.ewbNo         = "451000613026";
            reqCancelEWB.cancelRsnCode = 2;
            reqCancelEWB.cancelRmrk    = "Cancelled the order";

            TxnRespWithObj <RespCancelEwbPl> respCancelEWB = await EWBAPI.CancelEWBAsync(EwbSession, reqCancelEWB);

            if (respCancelEWB.IsSuccess)
            {
                rtbResponce.Text = JsonConvert.SerializeObject(respCancelEWB.RespObj);
            }
            else
            {
                rtbResponce.Text = respCancelEWB.TxnOutcome;
            }
        }
Пример #18
0
        private async void btnCancelIRN_Click(object sender, EventArgs e)
        {
            ReqPlCancelIRN reqPlCancelIRN = new ReqPlCancelIRN();

            reqPlCancelIRN.CnlRem = "Data Entry Mystake";
            reqPlCancelIRN.CnlRsn = "2";
            reqPlCancelIRN.Irn    = "87463ea6314450564f9325083bcbd7c47509a864908b130c15270794e707f907";
            TxnRespWithObj <RespPlCancelIRN> txnRespWithObj = await eInvoiceAPI.CancelIRNIRNAsync(eInvSession, reqPlCancelIRN);

            if (txnRespWithObj.IsSuccess)
            {
                rtbResponce.Text = JsonConvert.SerializeObject(txnRespWithObj.RespObj);
            }
            else
            {
                rtbResponce.Text = txnRespWithObj.TxnOutcome;
            }

            txtResponceHdr.Text = "Generate IRN Responce...";
        }
Пример #19
0
        private async void btnGetIRNDetailsByDocDetails_Click(object sender, EventArgs e)
        {
            {
                string DocType = "INV";
                string DocNum  = "DOC/189661";
                string DocDate = "01/02/2021";

                TxnRespWithObj <RespPlGenIRN> txnRespWithObj = await eInvoiceAPI.GetIRNDetailsByDocDetailsAsync(eInvSession, DocType, DocNum, DocDate, 250);

                if (txnRespWithObj.IsSuccess)
                {
                    rtbResponce.Text = JsonConvert.SerializeObject(txnRespWithObj.RespObj);
                }
                else
                {
                    rtbResponce.Text = txnRespWithObj.TxnOutcome;
                }

                txtResponceHdr.Text = "Get IRN Details By Doc Detail Responce...";
            }
        }
Пример #20
0
        private async void btnCancelEwayBill_Click(object sender, EventArgs e)
        {
            string         action         = "CANEWB";
            ReqPlCancelEWB reqPlCancelEWB = new ReqPlCancelEWB();

            reqPlCancelEWB.ewbNo         = 251221608254;
            reqPlCancelEWB.cancelRsnCode = 2;
            reqPlCancelEWB.cancelRmrk    = "Cancelled the order";
            TxnRespWithObj <RespPlCancelEWB> txnRespWithObj = await eInvoiceAPI.CancelEWBAsync(eInvSession, reqPlCancelEWB, action);

            if (txnRespWithObj.IsSuccess)
            {
                rtbResponce.Text = JsonConvert.SerializeObject(txnRespWithObj.RespObj);
            }
            else
            {
                rtbResponce.Text = txnRespWithObj.TxnOutcome;
            }

            txtResponceHdr.Text = "Generate IRN Responce...";
        }
Пример #21
0
        private async void btnVerifySignedInv_Click(object sender, EventArgs e)
        {
            string       RespJson     = File.ReadAllText(WorkingFilesPath + @"\RespPlGenIRN.txt");
            VerifyRespPl verifyRespPl = new VerifyRespPl();

            RespPlGenIRN respPlGenIRN = new RespPlGenIRN();

            respPlGenIRN = JsonConvert.DeserializeObject <RespPlGenIRN>(RespJson);
            TxnRespWithObj <VerifyRespPl> txnRespWithObj = await eInvoiceAPI.VerifySignedInvoice(eInvSession, respPlGenIRN);

            if (txnRespWithObj.IsSuccess)
            {
                verifyRespPl.IsVerified   = txnRespWithObj.RespObj.IsVerified;
                verifyRespPl.JwtIssuerIRP = txnRespWithObj.RespObj.JwtIssuerIRP;
                verifyRespPl.VerifiedWithCertificateEffectiveFrom = txnRespWithObj.RespObj.VerifiedWithCertificateEffectiveFrom;
                verifyRespPl.CertificateName = txnRespWithObj.RespObj.CertificateName;
                verifyRespPl.CertStartDate   = txnRespWithObj.RespObj.CertStartDate;
                verifyRespPl.CertExpiryDate  = txnRespWithObj.RespObj.CertExpiryDate;
            }
            else
            {
                verifyRespPl = txnRespWithObj.RespObj;
            }
        }
Пример #22
0
        private async void btnGenEWB_Click(object sender, EventArgs e)
        {
            ReqGenEwbPl ewbGen = new ReqGenEwbPl();

            ewbGen.supplyType      = "O";
            ewbGen.subSupplyType   = "1";
            ewbGen.docType         = "INV";
            ewbGen.docNo           = "123-8";
            ewbGen.docDate         = "15/12/2017";
            ewbGen.fromGstin       = "08AAQPS7478C1Z1";
            ewbGen.fromTrdName     = "welton";
            ewbGen.fromAddr1       = "2ND CROSS NO 59  19  A";
            ewbGen.fromAddr2       = "GROUND FLOOR OSBORNE ROAD";
            ewbGen.fromPlace       = "FRAZER TOWN";
            ewbGen.fromPincode     = 560042;
            ewbGen.fromStateCode   = 29;
            ewbGen.toGstin         = "05ABZPP6384Q1ZB";
            ewbGen.toTrdName       = "sthuthya";
            ewbGen.toAddr1         = "Shree Nilaya";
            ewbGen.toAddr2         = "Dasarahosahalli";
            ewbGen.toPlace         = "Beml Nagar";
            ewbGen.toPincode       = 689788;
            ewbGen.toStateCode     = 28;
            ewbGen.totalValue      = 5609889;
            ewbGen.cgstValue       = 0;
            ewbGen.sgstValue       = 0;
            ewbGen.igstValue       = 168296.67;
            ewbGen.cessValue       = 224395.56;
            ewbGen.transporterId   = "";
            ewbGen.transporterName = "";
            ewbGen.transDocNo      = "";
            ewbGen.transMode       = "1";
            ewbGen.transDistance   = "656";
            ewbGen.transDocDate    = "";
            ewbGen.vehicleNo       = "PVC1234";
            ewbGen.vehicleType     = "R";
            ewbGen.itemList        = new List <ReqGenEwbPl.ItemList>();
            ewbGen.itemList.Add(new ReqGenEwbPl.ItemList
            {
                productName   = "Wheat",
                productDesc   = "Wheat",
                hsnCode       = 1001,
                quantity      = 4,
                qtyUnit       = "BOX",
                cgstRate      = 0,
                sgstRate      = 0,
                igstRate      = 3,
                cessRate      = 4,
                cessAdvol     = 0,
                taxableAmount = 5609889
            });

            TxnRespWithObj <RespGenEwbPl> TxnResp = await EWBAPI.GenEWBAsync(EwbSession, ewbGen);

            if (TxnResp.IsSuccess)
            {
                rtbResponce.Text = JsonConvert.SerializeObject(TxnResp.RespObj);
            }
            else
            {
                rtbResponce.Text = TxnResp.TxnOutcome;
            }
        }
Пример #23
0
        private async void OnlineewayBill()
        {
            //GetAuthenticationToken();

            string strJSON = "";

            if (DateTime.Now < EwbSession.EwbApiLoginDetails.EwbTokenExp)
            {
                lblResponce.Text = EwbSession.EwbApiLoginDetails.EwbAuthToken + "valid Upto:" + EwbSession.EwbApiLoginDetails.EwbTokenExp.ToString();
            }
            else
            {
                TxnRespWithObj <EWBSession> TxnSesResp = await EWBAPI.GetAuthTokenAsync(EwbSession);

                if (TxnSesResp.IsSuccess == true)
                {
                    lblResponce.Text = TxnSesResp.RespObj.EwbApiLoginDetails.EwbAuthToken;
                    strJSON          = JsonConvert.SerializeObject(TxnSesResp.RespObj.EwbApiLoginDetails);
                    Database.CommandExecutor("Update Company set EwbLoginDetail='" + strJSON + "'");
                    UpdateEwayBalance(-1, "On Generate Eway Auth");
                    CheckEwayBalance(false);
                }
                else
                {
                    lblResponce.Text = TxnSesResp.TxnOutcome;
                    UpdateEwayBalance(-1, TxnSesResp.TxnOutcome);
                    CheckEwayBalance(false);
                    return;
                }
            }



            strJSON = JsonConvert.SerializeObject(ewbGen);
            //  System.IO.File.WriteAllText(Applidispcation.StartupPath + "\\EWAYJSON.txt", strJSON);

            //strJSON = System.IO.File.ReadAllText(Application.StartupPath + "\\EWAYJSON.txt");

            if (DateTime.Now > EwbSession.EwbApiLoginDetails.EwbTokenExp)
            {
                return;
            }


            TxnRespWithObj <RespGenEwbPl> TxnResp = await EWBAPI.GenEWBAsync(EwbSession, strJSON);

            if (TxnResp.IsSuccess)
            {
                lblResponce.Text = JsonConvert.SerializeObject(TxnResp.RespObj);
                Database.CommandExecutor("Update voucherinfo set EwayBillno='" + TxnResp.RespObj.ewayBillNo + "' where vi_id='" + gvid + "'");
                EwbNo = long.Parse(TxnResp.RespObj.ewayBillNo);

                UpdateEwayBalance(-1, TxnResp.RespObj.ewayBillNo);
            }
            else
            {
                lblResponce.Text = lblResponce.Text + Environment.NewLine + TxnResp.TxnOutcome;
                UpdateEwayBalance(-1, TxnResp.TxnOutcome);
            }

            CheckEwayBalance(false);
            SideFill();
        }
Пример #24
0
        private async void btnGenIRN_Click(object sender, EventArgs e)
        {
            ReqPlGenIRN reqPlGenIRN = new ReqPlGenIRN();
            //reqPlGenIRN.Version = "1.01";
            //reqPlGenIRN.TranDtls = new ReqPlGenIRN.TranDetails();
            //reqPlGenIRN.TranDtls.TaxSch = "GST";
            //reqPlGenIRN.TranDtls.SupTyp = "B2B";
            //reqPlGenIRN.DocDtls = new ReqPlGenIRN.DocSetails();
            //reqPlGenIRN.DocDtls.Typ = "INV";
            //reqPlGenIRN.DocDtls.No = "DOC-NO/64";
            //reqPlGenIRN.DocDtls.Dt = "11/03/2020";
            //reqPlGenIRN.SellerDtls = new ReqPlGenIRN.SellerDetails();
            //reqPlGenIRN.SellerDtls.Gstin = "************";
            //reqPlGenIRN.SellerDtls.LglNm = "ABC company pvt ltd";
            //reqPlGenIRN.SellerDtls.TrdNm = null;
            //reqPlGenIRN.SellerDtls.Addr1 = "5th block, kuvempu layout";
            //reqPlGenIRN.SellerDtls.Addr2 = null;
            //reqPlGenIRN.SellerDtls.Loc = "GANDHINAGAR";
            //reqPlGenIRN.SellerDtls.Pin = "560002";
            //reqPlGenIRN.SellerDtls.State = "KARNATAKA";
            //reqPlGenIRN.SellerDtls.Ph = null;
            //reqPlGenIRN.SellerDtls.Em = null;
            //reqPlGenIRN.BuyerDtls = new ReqPlGenIRN.BuyerDetails();
            //reqPlGenIRN.BuyerDtls.Gstin = "37BZNPM9430M1kl";
            //reqPlGenIRN.BuyerDtls.LglNm = "XYZ company pvt ltd";
            //reqPlGenIRN.BuyerDtls.TrdNm = null;
            //reqPlGenIRN.BuyerDtls.Pos = "37";
            //reqPlGenIRN.BuyerDtls.Addr1 = "7th block, kuvempu layout";
            //reqPlGenIRN.BuyerDtls.Addr2 = null;
            //reqPlGenIRN.BuyerDtls.Loc = "GANDHINAGAR";
            //reqPlGenIRN.BuyerDtls.Pin = null;
            //reqPlGenIRN.BuyerDtls.State = null;
            //reqPlGenIRN.BuyerDtls.Ph = null;
            //reqPlGenIRN.BuyerDtls.Em = null;
            //reqPlGenIRN.DispDtls = new ReqPlGenIRN.DispatchedDetails();
            //reqPlGenIRN.DispDtls.Nm = "ABC company pvt ltd";
            //reqPlGenIRN.DispDtls.Addr1 = "7th block, kuvempu layout";
            //reqPlGenIRN.DispDtls.Addr2 = null;
            //reqPlGenIRN.DispDtls.Loc = "Banagalore";
            //reqPlGenIRN.DispDtls.Pin = "560043";
            //reqPlGenIRN.DispDtls.Stcd = "29";
            //reqPlGenIRN.ShipDtls = new ReqPlGenIRN.ShippedDetails();
            //reqPlGenIRN.ShipDtls.Gstin = null;
            //reqPlGenIRN.ShipDtls.LglNm = "CBE company pvt ltd";
            //reqPlGenIRN.ShipDtls.TrdNm = null;
            //reqPlGenIRN.ShipDtls.Addr1 = "7th block, kuvempu layout";
            //reqPlGenIRN.ShipDtls.Addr2 = null;
            //reqPlGenIRN.ShipDtls.Loc = "Banagalore";
            //reqPlGenIRN.ShipDtls.Pin = "560043";
            //reqPlGenIRN.ShipDtls.Stcd = "29";
            //reqPlGenIRN.ItemList = new List<ReqPlGenIRN.ItmList>();
            //ReqPlGenIRN.ItmList itm = new ReqPlGenIRN.ItmList();
            //itm.SlNo = "1";
            //itm.IsServc = "N";
            //itm.PrdDesc = null;
            //itm.HsnCd = "1001";
            //itm.BchDtls = null;
            //itm.Qty = null;
            //itm.Unit = null;
            //itm.UnitPrice = 10.00;
            //itm.TotAmt = 10.00;
            //itm.Discount = 0.0;
            //itm.AssAmt = 10.00;
            //itm.GstRt = 10.00;
            //itm.SgstAmt = 0.0;
            //itm.IgstAmt = 0.0;
            //itm.CgstAmt = 0.0;
            //itm.CesRt = 0.0;
            //itm.CesAmt = 0.0;
            //itm.CesNonAdvlAmt = 0.0;
            //itm.StateCesRt = 0.0;
            //itm.StateCesAmt = 0.0;
            //itm.StateCesNonAdvlAmt = 0.0;
            //itm.OthChrg = 0.0;
            //itm.TotItemVal = 10.00;
            //itm.AttribDtls = null;
            //reqPlGenIRN.ItemList.Add(itm);
            //reqPlGenIRN.PayDtls = null;
            //reqPlGenIRN.RefDtls = null;
            //reqPlGenIRN.AddlDocDtls = null;
            //reqPlGenIRN.ExpDtls = null;
            //reqPlGenIRN.EwbDtls = null;
            //reqPlGenIRN.ValDtls = new ReqPlGenIRN.ValDetails();
            //reqPlGenIRN.ValDtls.AssVal = 0.0;
            //reqPlGenIRN.ValDtls.CgstVal = 0.0;
            //reqPlGenIRN.ValDtls.SgstVal = 0.0;
            //reqPlGenIRN.ValDtls.IgstVal = 0.0;
            //reqPlGenIRN.ValDtls.CesVal = 0.0;
            //reqPlGenIRN.ValDtls.StCesVal = 0.0;
            //reqPlGenIRN.ValDtls.RndOffAmt = 0.0;
            //reqPlGenIRN.ValDtls.TotInvVal = 0.0;

            //TxnRespWithObj<RespPlGenIRN> txnRespWithObj = await eInvoiceAPI.GenIRNAsync(eInvSession, reqPlGenIRN);



            //PayLoad in Json Format reading file Json.
            //string ReqJson = File.ReadAllText(WorkingFilesPath + @"\ProductionSampleJsonGenIRN.txt");
            //TxnRespWithObj<RespPlGenIRN> txnRespWithObj = await eInvoiceAPI.GenIRNAsync(eInvSession, ReqJson, 250);

            string ReqJson = File.ReadAllText(txtResponceHdr.Text);



            TxnRespWithObj <RespPlGenIRN> txnRespWithObj = await eInvoiceAPI.GenIRNAsync(eInvSession, rtbResponce.Text, 250);

            RespPlGenIRN respPlGenIRN = txnRespWithObj.RespObj;
            string       ErrorCodes   = "";
            string       ErrorDesc    = "";

            rtbResponce.Text = "";
            if (txnRespWithObj.IsSuccess)
            {
                //Process the Response here
                //For DEMO, just showing the searilized Response Object in text box
                rtbResponce.Text = JsonConvert.SerializeObject(respPlGenIRN);
                //respPlGenIRN.QrCodeImage.Save(@"C:\Users\Desktop\qr1.png");

                //Store respPlGenIRN (manditory - AckDate and SignedInvoice) to verify signed invoice
                //below code is to show how to verify signed invoice
                respPlGenIRN.QrCodeImage = null;
                TxnRespWithObj <VerifyRespPl> txnRespWithObj1 = await eInvoiceAPI.VerifySignedInvoice(eInvSession, respPlGenIRN);


                VerifyRespPl verifyRespPl = new VerifyRespPl();
                if (txnRespWithObj.IsSuccess)
                {
                    verifyRespPl.IsVerified   = txnRespWithObj1.RespObj.IsVerified;
                    verifyRespPl.JwtIssuerIRP = txnRespWithObj1.RespObj.JwtIssuerIRP;
                    verifyRespPl.VerifiedWithCertificateEffectiveFrom = txnRespWithObj1.RespObj.VerifiedWithCertificateEffectiveFrom;
                    verifyRespPl.CertificateName = txnRespWithObj1.RespObj.CertificateName;
                    verifyRespPl.CertStartDate   = txnRespWithObj1.RespObj.CertStartDate;
                    verifyRespPl.CertExpiryDate  = txnRespWithObj1.RespObj.CertExpiryDate;
                }
            }
            else
            {
                //Error has occured
                //Display TxnOutCome in text box - process or show msg to user

                //Process error codes
                if (txnRespWithObj.ErrorDetails != null)
                {
                    foreach (RespErrDetailsPl errPl in txnRespWithObj.ErrorDetails)
                    {
                        //Process errPl item here
                        ErrorCodes      += errPl.ErrorCode + ",";
                        ErrorDesc       += errPl.ErrorCode + ": " + errPl.ErrorMessage + Environment.NewLine;
                        rtbResponce.Text = ErrorDesc;
                    }
                }

                //Process InfoDetails here
                RespInfoDtlsPl respInfoDtlsPl = new RespInfoDtlsPl();
                //Serialize Desc object from InfoDtls as per InfCd
                if (txnRespWithObj.InfoDetails != null)
                {
                    foreach (RespInfoDtlsPl infoPl in txnRespWithObj.InfoDetails)
                    {
                        var strDupIrnPl = JsonConvert.SerializeObject(infoPl.Desc);   //Convert object type to json string
                        switch (infoPl.InfCd)
                        {
                        case "DUPIRN":
                            DupIrnPl dupIrnPl = JsonConvert.DeserializeObject <DupIrnPl>(strDupIrnPl);
                            break;

                        case "EWBERR":
                            List <EwbErrPl> ewbErrPl = JsonConvert.DeserializeObject <List <EwbErrPl> >(strDupIrnPl);
                            break;

                        case "ADDNLNFO":
                            //Deserialize infoPl.Desc as string type and then if this string contains json object, it may be desirilized again as per future releases
                            string strDesc = (string)infoPl.Desc;
                            break;
                        }
                    }
                }
            }
            txtResponceHdr.Text = "Generate IRN Responce...";
        }