public bool SetValue()
 {
     try
     {
         InvCodeNum invCodeNum = new InvCodeNum();
         if ("0000" != this.GetTaxCardCurrentFpNum(ref invCodeNum))
         {
             return(false);
         }
         _InvoiceType invoiceType = this.GetInvoiceType(this.FaPiaoType);
         this.lab_fpzl.Text       = invoiceType.displayfpzl;
         this.lab_fpdm.Text       = invCodeNum.InvTypeCode.Trim();
         this.lab_fpStartNum.Text = invCodeNum.InvNum.Trim();
         int num2 = this.GetTaxCardFPNum(invCodeNum.InvTypeCode, (int)invoiceType.TaxCardfpzl, Aisino.Fwkp.Fpkj.Common.Tool.ObjectToInt(invCodeNum.InvNum));
         if (num2 == 0)
         {
             return(false);
         }
         this.lab_fpHasNum.Text  = num2.ToString();
         this.txt_zuofeiNum.Text = "1";
     }
     catch (Exception exception)
     {
         this.loger.Error(exception.ToString());
         return(false);
     }
     return(true);
 }
        public string GetTaxCardCurrentFpNum(ref InvCodeNum invCodeNum)
        {
            _InvoiceType invoiceType = this.GetInvoiceType(this.FaPiaoType);

            //逻辑修改 本地测试使用假数据
            if (InternetWare.Config.Constants.IsTest)
            {
                invCodeNum = new InvCodeNum()
                {
                    InvTypeCode = "3100153320", InvNum = "88888888", EndNum = "99999999"
                }
            }
            ;
            else
            {
                invCodeNum = base.TaxCardInstance.GetCurrentInvCode(invoiceType.TaxCardfpzl);
            }
            if ((string.IsNullOrEmpty(invCodeNum.InvNum) || string.IsNullOrEmpty(invCodeNum.InvTypeCode)) || (base.TaxCardInstance.RetCode != 0))
            {
                FormMain.CallUpload();
                MessageManager.ShowMsgBox(base.TaxCardInstance.ErrCode);
                return("0001");
            }
            if (!invCodeNum.InvNum.Equals(new string('0', 8)) && !invCodeNum.InvTypeCode.Equals(new string('0', 10)))
            {
                return("0000");
            }
            MessageManager.ShowMsgBox("FPZF-000005");
            return("0001");
        }
Example #3
0
        internal override BaseResult DoService()
        {
            FaPiaoZuoFei_WeiKai form = new FaPiaoZuoFei_WeiKai();

            form.FaPiaoType = CommonMethods.ParseFplx(_args.FpType);
            InvCodeNum invCodeNum = new InvCodeNum();

            if ("0000" != form.GetTaxCardCurrentFpNum(ref invCodeNum))
            {
                return(new BaseResult(_args, new ErrorBase(true, "查询发票信息失败")));
            }
            _InvoiceType invoiceType = form.GetInvoiceType(CommonMethods.ParseFplx(_args.FpType));
            int          fpHasNum    = form.GetTaxCardFPNum(invCodeNum.InvTypeCode, (int)invoiceType.TaxCardfpzl, Aisino.Fwkp.Fpkj.Common.Tool.ObjectToInt(invCodeNum.InvNum));

            return(new WeiKaiChaXunResult(_args, invoiceType.displayfpzl.Trim(), invCodeNum.InvTypeCode.Trim(), invCodeNum.InvNum.Trim(), fpHasNum));
        }
        private void GenerateRegularTaxInvoice()
        {
            _DtSet.Tables["ItemDetails"].Rows.Clear();
            _DtSet.Tables["InvoiceDetailsFooter"].Rows.Clear();
            _DtSet.Tables["InvoiceDetailsAmounts"].Rows.Clear();
            _DtSet.Tables["InvoiceDetailsHeader"].Rows.Clear();

            string query = "SELECT  SlNo, InvoiceNo, convert(varchar(11),InvoiceDate,106) as InvoiceDate, " +
                           "LedgerId, BillingTerms, convert(varchar(11),DueDate,106) as DueDate, " +
                           "BillingTo, BillingAddress, BillingGSTNO, BillingState, BillingStateCode, BuyerOrderNo, " +
                           "convert(varchar(11),BuyerOrderDate,106) as BuyerOrderDate, ChallanNo, " +
                           "convert(varchar(11),ChallanDate,106) as ChallanDate, DispatchThrough, VehiclaNo, " +
                           "ShippingTo,ShippingAddress, ShippingState, ShippingStateCode,TotalQty, TotalAmount, " +
                           "TotalDiscount, TotalTaxAmount, TotalCGST, TotalSGST, TotalIGST, TotalCess, NetAmount, " +
                           "FreightChargs,PackingCharges, OtherCharges, OverAllDiscount,TotalInvoiceAmount, Note,RCM,InvoiceType from Invoice " +
                           "where InvoiceNo = '" + mInvoiceNo + "'";
            DataTable dt0 = SQLHelper.GetInstance().ExcuteNonQuery(query, out msg);

            if (dt0.IsValidDataTable())
            {
                string orgName = "", orgAddress = "", orgLegalNos = "", orgStateCode = "", orgState = "";
                ORG_Tools.GetORGDetails(out orgName, out orgAddress, out orgLegalNos, out orgStateCode, out orgState);
                _DtSet.Tables["InvoiceDetailsHeader"].Rows.Add(orgName, orgAddress, orgStateCode, orgState, orgLegalNos,
                                                               ORG_Tools._LogoByte, dt0.Rows[0]["InvoiceNo"], dt0.Rows[0]["InvoiceDate"], dt0.Rows[0]["ChallanNo"],
                                                               dt0.Rows[0]["ChallanDate"], dt0.Rows[0]["BuyerOrderNo"], dt0.Rows[0]["BuyerOrderDate"],
                                                               dt0.Rows[0]["BillingTerms"], dt0.Rows[0]["DueDate"], dt0.Rows[0]["DispatchThrough"],
                                                               dt0.Rows[0]["VehiclaNo"], dt0.Rows[0]["BillingTo"], dt0.Rows[0]["BillingAddress"],
                                                               dt0.Rows[0]["BillingGSTNO"], dt0.Rows[0]["BillingStateCode"], dt0.Rows[0]["BillingState"],
                                                               dt0.Rows[0]["ShippingTo"], dt0.Rows[0]["ShippingAddress"], dt0.Rows[0]["ShippingStateCode"],
                                                               dt0.Rows[0]["ShippingState"], mInvoiceCopyText);
                //Billing and shipped details
                _DtSet.Tables["InvoiceDetailsAmounts"].Rows.Add(orgName, dt0.Rows[0]["TotalQty"], dt0.Rows[0]["TotalDiscount"],
                                                                dt0.Rows[0]["TotalAmount"], dt0.Rows[0]["TotalTaxAmount"], dt0.Rows[0]["TotalCGST"],
                                                                dt0.Rows[0]["TotalSGST"], dt0.Rows[0]["TotalIGST"], dt0.Rows[0]["TotalCess"],
                                                                dt0.Rows[0]["NetAmount"], dt0.Rows[0]["TotalInvoiceAmount"], dt0.Rows[0]["FreightChargs"], dt0.Rows[0]["PackingCharges"],
                                                                dt0.Rows[0]["OtherCharges"], dt0.Rows[0]["OverAllDiscount"], dt0.Rows[0]["RCM"]);

                ///Footer
                _DtSet.Tables["InvoiceDetailsFooter"].Rows.Add(orgName, INVOICE_TOOLS._DeclarationText, "",
                                                               INVOICE_TOOLS._OrgBankDetailsText, INVOICE_TOOLS._OrgTermsAndConditionText,
                                                               INVOICE_TOOLS._SignatureForText, INVOICE_TOOLS._SignatureAuthorityText);
                /////invoice item details
                query = "SELECT   * from InvoiceDetails where InvoiceNo='" + mInvoiceNo + "'";
                DataTable dt = SQLHelper.GetInstance().ExcuteNonQuery(query, out msg);
                if (dt.IsValidDataTable())
                {
                    foreach (DataRow item in dt.Rows)
                    {
                        object cess = item["CeassAmount"];
                        _DtSet.Tables["ItemDetails"].Rows.Add(orgName, item["ItemName"], item["HSNCode"], item["Quantity"],
                                                              item["Unit"], item["Rate"], item["Amount"], item["DiscountRate"], item["DiscountAmount"],
                                                              item["TaxAmount"], item["CGSTRate"], item["CGSTAmount"], item["SGSTRate"], item["SGSTAmount"],
                                                              item["IGSTRate"], item["IGSTAmount"], item["CessRate"], cess, item["Total"]);
                        if (cess.ISValidObject() && !isCess)
                        {
                            isCess = true;
                        }
                    }
                }
                ///Clarify Invoice type
                #region Invoice Type
                string invoiceType         = dt0.Rows[0]["InvoiceType"].ToString();
                string placeOfsuppllyState = dt0.Rows[0]["BillingState"].ToString();
                if (invoiceType == "Regular")
                {
                    if (ORG_Tools._State == placeOfsuppllyState)
                    {
                        if (isCess)
                        {
                            mInvoiceType = _InvoiceType.CGST_SGST_W_Cess;
                        }
                        else
                        {
                            mInvoiceType = _InvoiceType.CGST_SGST_WO_Cess;
                        }
                    }
                    else
                    {
                        if (isCess)
                        {
                            mInvoiceType = _InvoiceType.IGST_O_Cess;
                        }
                        else
                        {
                            mInvoiceType = _InvoiceType.IGST_WO_Cess;
                        }
                    }
                }
                else
                {
                    mInvoiceType = _InvoiceType.BillOfSupply;
                }
                #endregion
                //Organization details
            }
        }