Exemple #1
0
        private void Pardakhti_Click(object sender, EventArgs e)
        {
            DataTable       dt = new DataTable();
            PardakhtiReport pardakhtiReport = new PardakhtiReport(dt);

            pardakhtiReport.Show();
            this.Hide();
        }
Exemple #2
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            DataTable       dt   = new DataTable();
            PardakhtiReport form = new PardakhtiReport(dt);

            form.Show();
            this.Hide();
        }
Exemple #3
0
        private void filter_Click(object sender, EventArgs e)
        {
            DateTime trkFrom = dateFrom.GetSelectedDateInPersianDateTime().ToShortDateString().ToGeorgianDateTime();
            DateTime trkTo   = dateTo.GetSelectedDateInPersianDateTime().ToShortDateString().ToGeorgianDateTime();
            Int64    prcFrom = Int64.Parse(priceFrom.Text);
            Int64    prcTo   = Int64.Parse(priceTo.Text);

            List <Model.archive> lst = new List <archive>();

            var plist = from p in context.Archives
                        join t in context.tamins on p.shomareTamin equals t.shomareSanad
                        select new { shomareTamin = t.shomareSanad, shnesnameTitle = t.shnesnameTitle, radifTitle = t.radifTitle, ID = p.ID, tarikh = p.tarikh, hesab = p.hesab, bankName = p.bankName, checkNumber = p.checkNumber, mablagh = t.mablagh, radif = t.radif, subject = t.subject, project = t.project, markaz = t.markaz, shomareSanad = p.shomareSanad, type = t.type };



            string rdf = "";

            if (radif.SelectedValue != null)
            {
                rdf = radif.SelectedValue.ToString();
            }
            ;
            string prj = "";

            if (project.SelectedValue != null)
            {
                prj = project.SelectedValue.ToString();
            }

            if (project.SelectedItem != null)
            {
                plist = plist.Where(x => x.project == prj);
            }

            if (subject.Text != "")
            {
                plist = plist.Where(x => x.subject == subject.Text);
            }
            if (radif.SelectedItem != null)
            {
                plist = plist.Where(x => x.radif == rdf);
            }
            if (markaz.Text != "")
            {
                plist = plist.Where(x => x.markaz == markaz.Text);
            }
            if (shomareSanad.Text != "")
            {
                plist = plist.Where(x => x.shomareSanad == shomareSanad.Text);
            }

            if (moneytype.Text != "")
            {
                plist = plist.Where(x => x.type == moneytype.Text);
            }
            if (true)
            {
                plist = plist.Where(x => x.hesab == "0");
                plist = plist.Where(x => x.tarikh >= trkFrom && x.tarikh <= trkTo);
                plist = plist.Where(x => x.mablagh >= prcFrom && x.mablagh <= prcTo);
            }
            foreach (var item in plist)
            {
                lst.Add(new archive
                {
                    bankName       = item.bankName,
                    checkNumber    = item.checkNumber,
                    hesab          = item.hesab,
                    ID             = item.ID,
                    imageName      = "",
                    mablagh        = item.mablagh,
                    markaz         = item.markaz,
                    project        = item.project,
                    radif          = item.radif,
                    radifTitle     = item.radifTitle,
                    shnesnameTitle = item.shnesnameTitle,
                    shomareSanad   = item.shomareSanad,
                    shomareTamin   = item.shomareTamin,
                    subject        = item.subject,
                    tarikh         = item.tarikh,
                    type           = item.type
                });
            }



            DataTable       dt       = ToDataTable(lst);
            PardakhtiReport daryafti = new PardakhtiReport(dt);

            daryafti.Show();
        }
Exemple #4
0
        private void filter_Click(object sender, EventArgs e)
        {
            var tamintxt = tamin.Text;

            if (tamintxt == "")
            {
                header.Text      = "تامین  انتخاب نشده است";
                header.ForeColor = Color.Red;
                return;
            }

            tamin model = context.tamins.SingleOrDefault(x => x.shomareSanad == tamintxt);

            if (model == null)
            {
                header.Text      = "شماره تامین وجود ندارد";
                header.ForeColor = Color.Red;
                return;
            }

            Context dbcontext = new Context();
            string  sanad     = shomareSanad1.Text;

            if (sanad == "")
            {
                header.Text      = "شماره سند انتخاب نشده است";
                header.ForeColor = Color.Red;
                return;
            }

            Int64 mbl = model.mablagh;

            string  shenasnameTitle = model.shnesnameTitle;
            archive pastmodel       = dbcontext.Archives.SingleOrDefault(x => x.shomareTamin == tamintxt && x.shomareSanad == sanad);

            if (pastmodel != null)
            {
                header.Text      = "برای پارامتر های موجود فاکتور انتخاب شده است";
                header.ForeColor = Color.Red;
                return;
            }



            functions fns       = new functions();
            var       directory = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);


            string mrk = "";

            mrk = (from sh in dbcontext.shenasnames
                   join ma in dbcontext.markazs on sh.markaz equals ma.parent
                   where sh.title == shenasnameTitle
                   select ma).First().title;


            string root = Path.Combine(directory, "FIM");

            System.IO.Directory.CreateDirectory(root);
            string markazPath = Path.Combine(root, mrk);

            System.IO.Directory.CreateDirectory(markazPath);
            string shenasnamePath = Path.Combine(markazPath, shenasnameTitle);

            System.IO.Directory.CreateDirectory(shenasnamePath);
            string pardPath = Path.Combine(shenasnamePath, "فاکتور های پرداختی");

            System.IO.Directory.CreateDirectory(pardPath);



            string sourcAddress = sourceLable.Text;
            string trkh         = date.GetSelectedDateInPersianDateTime().ToShortDateString().Replace("/", "");
            string finalPrice   = "";



            float intprice = model.mablagh;

            if (intprice / 1000000 > 1)
            {
                finalPrice = (intprice / 1000000) + "MT";
            }
            else
            {
                finalPrice = (intprice / 1000) + "HT";
            }
            string finalname = "";

            if (bank.Text == "")
            {
                finalname = "تامینی" + "_" + shomareSanad1.Text + Path.GetExtension(sourcAddress);
            }
            else
            {
                string sv = checkNumber.SelectedValue.ToString();
                finalname = "check" + "_" + bank.Text + "_" + sv + Path.GetExtension(sourcAddress);
            }

            imageName.Text = Path.Combine(pardPath, finalname).Replace(directory, "");
            string finalPath = pardPath + "\\" + finalname;



            bool isreferbish = referbish.Text == "0" ? false : true;

            DateTime trk = date.GetSelectedDateInPersianDateTime().ToShortDateString().ToGeorgianDateTime();

            archive newITem = new archive()
            {
                radif          = "",
                mablagh        = 0,
                markaz         = "",
                project        = "",
                shnesnameTitle = "",
                radifTitle     = "",
                shomareSanad   = sanad,
                shomareTamin   = tamintxt,
                subject        = "",
                tarikh         = trk,
                type           = "",
                hesab          = "0",
                imageName      = imageName.Text,
                bankName       = bank.Text,
                checkNumber    = checkNumber.Text,
                referbish      = isreferbish
            };

            check checkitem = context.checks.SingleOrDefault(x => x.checkNumber == checkNumber.Text);

            checkitem.isUsed = true;

            context.Archives.Add(newITem);
            context.SaveChanges();

            System.IO.File.Move(sourcAddress, finalPath);
            DataTable       dt         = new DataTable();
            PardakhtiReport daryaftirp = new PardakhtiReport(dt);

            daryaftirp.Show();
            this.Hide();
        }