Ejemplo n.º 1
0
        private void GetTaxDuty()
        {
            JTransferData tmpT = new JTransferData();

            tmpT.GetTaxDuty();
            _Tax  = tmpT._Tax;
            _Duty = tmpT._Duty;
        }
Ejemplo n.º 2
0
        //dele,verify,pay,Duty,Tax,
        private void btnPrint2_Click(object sender, EventArgs e)
        {
            if (jJanusGrid1.DataSource == null)
            {
                JMessages.Error(" ابتدا دکمه جستجو را بزنید ", "");
                return;
            }
            if (jJanusGrid1.SelectedRow == null)
            {
                JMessages.Error(" لطفا سطری را انتخاب کنید ", "");
                return;
            }
            _Code = Convert.ToInt32(jJanusGrid1.SelectedRow.Row["Code"].ToString());
            DataTable dt    = JWeights.GetDataTableAll(_Code, true);
            string    State = "این برگه المثنی" + " قبض شماره " + dt.Rows[0]["BascoolID"].ToString() + " مورخ " + dt.Rows[0]["WDate"].ToString() + "ساعت" + dt.Rows[0]["WTime"].ToString().Trim() + "می باشد";

            JWeight tmpWeight = new JWeight();

            tmpWeight.TruckCode    = Convert.ToInt32(dt.Rows[0]["TruckCode"].ToString());
            tmpWeight.UserPostCode = JMainFrame.CurrentPostCode;
            tmpWeight.PersonCode   = JMainFrame.CurrentPersonCode;
            tmpWeight.pay          = Convert.ToInt32(dt.Rows[0]["pay"].ToString());
            tmpWeight.pay_h        = Convert.ToInt32(dt.Rows[0]["pay"].ToString());
            tmpWeight.BascoolCode  = Convert.ToInt32(dt.Rows[0]["BascoolCode"].ToString());
            tmpWeight.PlokNo       = dt.Rows[0]["P1"].ToString() + dt.Rows[0]["P2"].ToString() + dt.Rows[0]["P3"].ToString() + dt.Rows[0]["P4"].ToString();
            tmpWeight.Weights      = Convert.ToInt32(dt.Rows[0]["Weights"].ToString());
            //tmpWeight.Duty = Convert.ToDecimal(dt.Rows[0]["Duty"].ToString());
            //tmpWeight.Tax = Convert.ToDecimal(dt.Rows[0]["Tax"].ToString());
            JTransferData tmpT = new JTransferData();

            tmpT.GetTaxDuty();
            tmpWeight.Duty = (tmpWeight.pay / (100 + tmpT._Duty + tmpT._Tax)) * tmpT._Duty;
            tmpWeight.Tax  = (tmpWeight.pay / (100 + tmpT._Duty + tmpT._Tax)) * tmpT._Tax;

            tmpWeight.hamrahno    = Convert.ToInt32(dt.Rows[0]["hamrahno"].ToString());
            tmpWeight.ProductCode = Convert.ToInt32(dt.Rows[0]["ProductCode"].ToString());
            tmpWeight.PrintNo     = 2;
            string Min = "";

            if (DateTime.Now.Minute.ToString().Length == 1)
            {
                Min = "0" + DateTime.Now.Minute.ToString();
            }
            else
            {
                Min = DateTime.Now.Minute.ToString();
            }
            string Hour = "";

            if (DateTime.Now.Hour.ToString().Length == 1)
            {
                Hour = "0" + DateTime.Now.Hour.ToString();
            }
            else
            {
                Hour = DateTime.Now.Hour.ToString();
            }
            tmpWeight.WTime = Hour + ":" + Min;

            tmpWeight.BascoolID = JWeights.GetCounter();
            tmpWeight.WDate     = DateTime.Now;

            JTransferData tmpJTransferData = new JTransferData();
            JDataBase     dbMain           = tmpJTransferData.CreateConMainServer(false);

            if (tmpWeight.Insert() > 0)//dbMain
            {
                dt = JWeights.GetDataTableAll(tmpWeight.Code, false);
            }
            dt.Columns.Add("State");
            dt.Columns.Add("StateHamrah");
            dt.Rows[0]["State"] = State;
            if (Convert.ToInt32(dt.Rows[0]["HamrahNO"]) != 0)
            {
                dt.Rows[0]["StateHamrah"] = dt.Rows[0]["HamrahNO"] + "    تعداد همراه  ";
            }
            else
            {
                dt.Rows[0]["StateHamrah"] = "";
            }
            if (dt != null)
            {
                //JDynamicReportForm DRF = new JDynamicReportForm(JReportDesignCodes.Bascool.GetHashCode());
                JDynamicReports DRF = new JDynamicReports(JReportDesignCodes.BillGoods.GetHashCode());
                DRF.Add(dt);
                //DRF.ShowDialog();
                DRF.Print("چاپ قبض", false, false);
            }

            try
            {
                dbMain.setQuery("Update BascolWeights set PrintNo=PrintNo+1 Where Code=" + _Code);
                dbMain.Query_Execute();
            }
            catch (Exception ex)
            {
                JSystem.Except.AddException(ex);
            }
            finally
            {
                dbMain.Dispose();
            }
        }