示例#1
0
        public int TransferInvoiceToSellType(bool current)
        {
            int         ni = Current.Number;
            InvoiceType it = InvoiceType.sell;

            if (!current)
            {
                GenerateNewInvoiceNumber(InvoiceType.sell);
                it = InvoiceType.proforma;
                db.Query(string.Format(@"UPDATE {4}`invoice` SET `type` = '{0}',`InvoiceId`='{1}' WHERE `InvoiceId`='{2}' AND `type`='{3}'", InvoiceType.sell, ni, Current.Number, it, DBName));
                db.Query(string.Format(@"UPDATE {4}`invoicedetails` SET `type` = '{0}',`InvoiceNo`='{1}' WHERE `InvoiceNo`='{2}' AND `type`='{3}'", InvoiceType.sell, ni, Current.Number, it, DBName));
            }


            decimal customer = GetCustomer(InvoiceType.sell);
            decimal amount   = GetPrice(InvoiceType.sell);

            //////////// NT= New Transaction
            TransactionActivity.Transaction NT = new TransactionActivity.Transaction();

            ////////// TTO= Transaction Type Order
            TransactionActivity.TransactionType TTO = TransactionActivity.TransactionType.Order;

            ///////// TMT= Transaction Method Type
            TransactionActivity.TransactionMethod TMT = TransactionActivity.TransactionMethod.Order;

            //////// set transaction Price
            NT.Amount = amount;
            /////// personal id for this transaction
            NT.PersonalID = customer;

            NT.Method        = TMT;
            NT.Description   = "سفارش فاکتور شماره " + ni.ToString();
            NT.Time          = DateTime.Now.ToShortTimeString();
            NT.Date          = Generals.CreateGenerals().dateManager.GetCurrentPersianDate();
            NT.Type          = TTO;
            NT.RemainAccount = tl.RemainAccount(customer) + amount;
            byte DFF = Convert.ToByte(TransactionActivity.TransactionStatus.Bedehkar);

            NT.Status = DFF;
            //tl.NewTransaction(NT);



            tl.FillTransaction(NT, GetTransactionID(InvoiceType.sell));
            return(ni);
        }
示例#2
0
        private void tsmiAddDue_Click(object sender, EventArgs e)
        {
            if (GS.dialog.InputBox("ثبت پرداخت نقدی", "مبلغ مانده حساب این شخص چقدر است؟", "") == DialogResult.OK)
            {
                if (GS.dialog.InputValue.Length > 3)
                {
                    try
                    {
                        var tl = new TransactionActivity.TransactionLog();

                        //////////// NT= New Transaction
                        TransactionActivity.Transaction NT = new TransactionActivity.Transaction();


                        ////////// TTO= Transaction Type Order
                        TransactionActivity.TransactionType TTO = TransactionActivity.TransactionType.RemainAccount;

                        ///////// TMT= Transaction Method Type
                        TransactionActivity.TransactionMethod TMT = TransactionActivity.TransactionMethod.Old;

                        //////// set transaction Price
                        NT.Amount = Convert.ToDecimal(GS.dialog.InputValue);
                        /////// personal id for this transaction
                        NT.PersonalID = Convert.ToDecimal(CurrentPesonalID);

                        NT.Method        = TMT;
                        NT.Description   = "ثبت مانده حساب";
                        NT.Time          = DateTime.Now.ToShortTimeString();
                        NT.Date          = GS.dateManager.GetCurrentPersianDate();
                        NT.Type          = TTO;
                        NT.RemainAccount = tl.RemainAccount(Convert.ToDecimal(CurrentPesonalID)) + Convert.ToDecimal(NT.Amount);
                        byte DFF = Convert.ToByte(TransactionActivity.TransactionStatus.Bedehkar);
                        NT.Status = DFF;
                        tl.NewTransaction(NT);

                        MessageBox.Show("ثبت مانده حساب با موفقیت انجام شد.");
                    }
                    catch
                    {
                        //PayAmount = 0;
                        MessageBox.Show("لطفا فقط عدد وارد کنید.");
                    }
                }
            }
        }
示例#3
0
        private void btnImportPersonalRemainAccount_Click(object sender, EventArgs e)
        {
            Clients m = new Clients();
            List <Clients.Client> mm = m.getClients("");



            foreach (Clients.Client c in mm)
            {
            }

            return;

            var myDataTable = new DataTable();

            openFileDialog1.ShowDialog(this);
            if (string.IsNullOrEmpty(openFileDialog1.FileName))
            {
                MessageBox.Show("هیچ فایلی انتخاب نشده است.");
                return;
            }
            string dbFile = openFileDialog1.FileName;

            using (var conection = new OleDbConnection("Provider=Microsoft.JET.OLEDB.4.0;" + "data source=" + dbFile + ";"))
                using (DataTable dt = new DataTable())
                {
                    string query = "Select * From `tblmembers`";
                    using (OleDbDataAdapter adapter = new OleDbDataAdapter(query, conection))
                    {
                        adapter.Fill(dt);
                    }
                    foreach (DataRow dr in dt.Rows)
                    {
                        string  AllDue = dr["Alldue"].ToString();
                        string  AllPay = dr["TotPayment"].ToString();
                        decimal Result = Convert.ToDecimal(AllDue) - Convert.ToDecimal(AllPay);
                        if (Result > 0)
                        {
                            MessageBox.Show(dr["mname"].ToString() + " | " + Result.ToString());
                        }
                        //}
                        //    return;
                        var tl = new TransactionActivity.TransactionLog();

                        //////////// NT= New Transaction
                        TransactionActivity.Transaction NT = new TransactionActivity.Transaction();
                        ////////// TTO= Transaction Type Order
                        TransactionActivity.TransactionType TTO = TransactionActivity.TransactionType.RemainAccount;
                        ///////// TMT= Transaction Method Type
                        TransactionActivity.TransactionMethod TMT = TransactionActivity.TransactionMethod.Old;

                        //////// set transaction Price
                        NT.Amount = Convert.ToDecimal("");
                        /////// personal id for this transaction
                        NT.PersonalID = Convert.ToDecimal("");

                        NT.Method        = TMT;
                        NT.Description   = "مانده حساب از سال مالی گذشته";
                        NT.Time          = DateTime.Now.ToShortTimeString();
                        NT.Date          = GS.dateManager.GetCurrentPersianDate();
                        NT.Type          = TTO;
                        NT.RemainAccount = tl.RemainAccount(Convert.ToDecimal("")) + Convert.ToDecimal(NT.Amount);
                        byte DFF = Convert.ToByte(TransactionActivity.TransactionStatus.Bedehkar);
                        NT.Status = DFF;
                        tl.NewTransaction(NT);
                    }
                }
        }
示例#4
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if ((txtPrice.Text != "") && (GS.IsNumber(txtPrice.Text) == true) && (rbPos.Checked == true || rbCash.Checked == true || rbCheque.Checked == true))
            {
                switch (PayType)
                {
                case 1:
                    PayDescription = "پرداخت وجه نقد - اسکناس" + " - " + txtDescription.Text;
                    break;

                case 2:
                    PayDescription = "پرداخت وجه نقد - کارت" + " - " + txtDescription.Text;
                    break;
                }


                try
                {
                    if (mode == "edit")
                    {
                        if (Payis != "cheque")
                        {
                            TL.Edit(PayId, Convert.ToDouble(txtPrice.Text), PayDescription, txtDate.Text, CurrentPesonalID);
                        }
                        else
                        {
                            TL.Edit(PayId, txtDate.Text);
                        }
                    }
                    else
                    {
                        //////////// NT= New Transaction
                        TransactionActivity.Transaction NT = new TransactionActivity.Transaction();


                        ////////// TTO= Transaction Type Order
                        TransactionActivity.TransactionType TTO = TransactionActivity.TransactionType.pay;

                        ///////// TMT= Transaction Method Type
                        TransactionActivity.TransactionMethod TMT = TransactionActivity.TransactionMethod.cash;

                        //////// set transaction Price
                        NT.Amount = Convert.ToDecimal(txtPrice.Text);
                        /////// personal id for this transaction
                        NT.PersonalID = CurrentPesonalID;

                        NT.Method      = TMT;
                        NT.Description = PayDescription;
                        NT.Time        = DateTime.Now.ToShortTimeString();
                        if (string.IsNullOrEmpty(txtDate.Text))
                        {
                            MessageBox.Show("لطفا تاریخ پرداخت را مشخص کنید.");
                            txtDate.Focus();
                            return;
                        }
                        NT.Date          = txtDate.Text;
                        NT.Type          = TTO;
                        NT.RemainAccount = TL.RemainAccount(CurrentPesonalID) - Convert.ToDecimal(NT.Amount);
                        byte DFF = Convert.ToByte(TransactionActivity.TransactionStatus.Bestankar);
                        NT.Status = DFF;
                        TL.NewTransaction(NT);
                    }
                    MessageBox.Show("ثبت پرداخت با موفقیت انجام شد.");
                    txtPrice.Text = "";
                    txtDate.Text  = "";
                    frmPay_Load(sender, e);
                }
                catch
                {
                    MessageBox.Show("لطفا فقط عدد وارد کنید.");
                }
            }
            else
            {
                MessageBox.Show("لطفا مبلغ و سایر اطلاعات را وارد کنید");
            }/////// end price validation
        }