Esempio n. 1
0
        private void ReceiptDetailByRef_Load(object sender, EventArgs e)
        {
            try
            {
                FullDataSet.ProductDataTable _pr = new FullDataSet.ProductDataTable();

                _mainForm.productTableAdapter1.FillByName(_pr, "А");
                _productTable.Merge(_pr);

                this.productBindingSource.ResetBindings(false);
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }
        }
Esempio n. 2
0
        private void Find_Click(object sender, EventArgs e)
        {
            string name = this.productlookUpEdit.Text;

            if (name.Length == 0)
            {
                return;
            }
            try
            {
                FullDataSet.ProductDataTable _pr = new FullDataSet.ProductDataTable();

                _mainForm.productTableAdapter1.FillByName(_pr, name);
                _product.Merge(_pr);

                this.productBindingSource.ResetBindings(false);
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }
        }
Esempio n. 3
0
        private void btFind_Click(object sender, EventArgs e)
        {
            string name = this.gridViewProduct.GetRowCellDisplayText(GridControl.AutoFilterRowHandle, this.colName);

            if (name.Length == 0)
            {
                return;
            }


            try
            {
                FullDataSet.ProductDataTable _pr = new FullDataSet.ProductDataTable();

                _mainForm.productTableAdapter1.FillByName(_pr, name);
                _productTable.Merge(_pr);

                this.productBindingSource.ResetBindings(false);
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }
        }
Esempio n. 4
0
        private void Import()
        {
            DataTable _curTable = (this.bindingSource.DataSource as DataTable);

            string orgName = this.label1.Text.Trim();
            //(this.bindingSource1.Current as DataRowView).Row["firm"].ToString().Trim();

            int _idOrg;


            DataRow[] organization = (this.ParentForm as MainForm).mDataSet.Organization.Select("ShortName='" + @orgName + "'");

            if (organization.Length == 0)
            {
                //MessageBox.Show("Не найден поставщик в справочнике организаций");

                _idOrg = 0;
            }
            else
            {
                _idOrg = Convert.ToInt32(organization[0]["ID"]);
            }


            /*создать приход*/

            MDataSet.ReceiptMasterRow _mast;

            _mast         = (this.receiptMasterBindingSource.AddNew() as DataRowView).Row as MDataSet.ReceiptMasterRow;
            _mast.DocDate = DateTime.Parse((_curTable).Rows[0]["datedoc"].ToString());

            _mast.OrganizationRef = _idOrg;

            _mast.Note = (_curTable).Rows[0]["numdoc"].ToString();

            if ((Convert.ToDecimal((_curTable).Rows[0]["nds"].ToString())) != 0)
            {
                _mast.MainStockRef = 1;

                FullDataSet.ProductDataTable _proTable = new FullDataSet.ProductDataTable();

                this.productTableAdapter.Fill(_proTable, true);
                this.fullDataSet.Product.Merge(_proTable);
            }


            this.receiptMasterBindingSource.EndEdit();

            /**/


            /**/

            foreach (DataRow _row in _curTable.Rows)
            {
                /*Товар */
                string _idstr = _row["SCLCODE"].ToString().Trim().Replace(" ", "");


                int _id;


                if (_idstr.Length == 0)
                {
                    _id = 0;
                }
                else
                {
                    _id = Convert.ToInt32(_idstr);
                }

                //    string nameT = _row["sclname"].ToString().Trim();


                string nameT = _row["sclname"].ToString().Trim();


                FullDataSet.ProductRow _prRow;
                _prRow = null;


                _prRow = this.fullDataSet.Product.FindByID(_id);


                if (_prRow == null)
                {
                    DataRow[] arrPr = this.fullDataSet.Product.Select("OldName='" + nameT + "'");

                    if (arrPr.Length == 0)
                    {
                        _row.RowError = "Не найдена";
                    }
                    else
                    {
                        _prRow = arrPr[0] as FullDataSet.ProductRow;
                    }
                }



                /* изготовитель  */

                int manufRef = 0;



                DataRow[] _arr = this.fullDataSet.Manufacturer.Select("Name like '" + @_row["SCLMKNM"].ToString().Substring(0, 4) + "%'");

                if (_arr.Length != 0)
                {
                    manufRef = (_arr[0] as FullDataSet.ManufacturerRow).ID;
                }



                if (!(_row.HasErrors))
                {
                    MDataSet.ReceiptDetailRow _det;

                    /**добавлять в детаил потом аддинг */

                    _det = (this.receiptDetailBindingSource.AddNew() as DataRowView).Row as MDataSet.ReceiptDetailRow;

                    _det.ProductRef = _prRow.ID;

                    _det.Quantity = _prRow.OldKol * Convert.ToDecimal(_row["kolvo"].ToString());

                    _det.PricePurchase = Convert.ToDecimal(_row["cena"].ToString()) / _prRow.OldKol;

                    _det.ManufacturerRef = manufRef;


                    if (_row["serie"].ToString().Length >= 15)
                    {
                        _det.Series = _row["serie"].ToString().Substring(0, 15);
                    }
                    else
                    {
                        _det.Series = _row["serie"].ToString();
                    }


                    _det.UseByDate = DateTime.Parse(_row["tgodn"].ToString());


                    this.receiptDetailBindingSource.EndEdit();


                    {
                        MDataSet.ReceiptDetailAddingRow _add;

                        _add          = (this.receiptDetailAddingBindingSource.AddNew() as DataRowView).Row as MDataSet.ReceiptDetailAddingRow;
                        _add.NUMSERTF = _row["NUMSERTF"].ToString();

                        _add.NUMREG = _row["NUMREG"].ToString();

                        _add.DATREG = DateTime.Parse(_row["DATREG"].ToString());

                        _add.ENDDATREG = DateTime.Parse(_row["ENDDATREG"].ToString());

                        _add.TAMZAV = Decimal.Parse(_row["TAMZAV"].ToString());
                        //  _add.MAXNACENKA = Decimal.Parse(_row["maxnacenka"].ToString());

                        _add.DATSERTF = DateTime.Parse(_row["DATSERTF"].ToString());


                        this.receiptDetailAddingBindingSource.EndEdit();
                    }
                }
            }
        }
Esempio n. 5
0
 public virtual FullDataSet.ProductDataTable GetDataByName(string name) {
     this.Adapter.SelectCommand = this.CommandCollection[1];
     if ((name == null)) {
         this.Adapter.SelectCommand.Parameters[1].Value = System.DBNull.Value;
     }
     else {
         this.Adapter.SelectCommand.Parameters[1].Value = ((string)(name));
     }
     FullDataSet.ProductDataTable dataTable = new FullDataSet.ProductDataTable();
     this.Adapter.Fill(dataTable);
     return dataTable;
 }
Esempio n. 6
0
 public virtual FullDataSet.ProductDataTable GetData(System.Nullable<bool> isnds) {
     this.Adapter.SelectCommand = this.CommandCollection[0];
     if ((isnds.HasValue == true)) {
         this.Adapter.SelectCommand.Parameters[1].Value = ((bool)(isnds.Value));
     }
     else {
         this.Adapter.SelectCommand.Parameters[1].Value = System.DBNull.Value;
     }
     FullDataSet.ProductDataTable dataTable = new FullDataSet.ProductDataTable();
     this.Adapter.Fill(dataTable);
     return dataTable;
 }
Esempio n. 7
0
        private void Find_Click(object sender, EventArgs e)
        {
            string name = this.productlookUpEdit.Text;

            if (name.Length == 0) return;
            try
            {
                FullDataSet.ProductDataTable _pr = new FullDataSet.ProductDataTable();

                _mainForm.productTableAdapter1.FillByName(_pr, name);
                _product.Merge(_pr);

                this.productBindingSource.ResetBindings(false);
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }
        }
Esempio n. 8
0
        private void Import()
        {

            DataTable _curTable = (this.bindingSource.DataSource as DataTable);
            
                 string orgName = this.label1.Text.Trim();
                 //(this.bindingSource1.Current as DataRowView).Row["firm"].ToString().Trim();

                 int _idOrg;


               DataRow[] organization = (this.ParentForm as MainForm).mDataSet.Organization.Select("ShortName='" +@orgName+"'");

                 if (organization.Length == 0)
                 {
                     //MessageBox.Show("Не найден поставщик в справочнике организаций");

                     _idOrg = 0;

                 }
                 else
                 {
                     _idOrg = Convert.ToInt32(organization[0]["ID"]);

                 }
          

            /*создать приход*/

                 MDataSet.ReceiptMasterRow _mast;

                _mast = (this.receiptMasterBindingSource.AddNew() as DataRowView).Row as MDataSet.ReceiptMasterRow;
                _mast.DocDate =DateTime.Parse((_curTable).Rows[0]["datedoc"].ToString());
               
                _mast.OrganizationRef = _idOrg;
                
                _mast.Note = (_curTable).Rows[0]["numdoc"].ToString();

                if ((Convert.ToDecimal((_curTable).Rows[0]["nds"].ToString())) != 0)
                {
                    _mast.MainStockRef = 1;

                    FullDataSet.ProductDataTable _proTable = new FullDataSet.ProductDataTable();
 
                    this.productTableAdapter.Fill(_proTable, true);
                    this.fullDataSet.Product.Merge(_proTable);

                }

                
               this.receiptMasterBindingSource.EndEdit();

            /**/


            /**/
            
            foreach (DataRow _row in _curTable.Rows)
            { 
                
                /*Товар */
                string _idstr = _row["SCLCODE"].ToString().Trim().Replace(" ", "");
              
                
                int _id;


                if (_idstr.Length == 0)
                {
                    _id = 0;
                }
                else
                {
                    _id = Convert.ToInt32(_idstr);
                }

            //    string nameT = _row["sclname"].ToString().Trim();


                string nameT = _row["sclname"].ToString().Trim();


                FullDataSet.ProductRow _prRow;
                _prRow = null;


                _prRow  = this.fullDataSet.Product.FindByID(_id);


                if (_prRow ==null)
                {

                    DataRow[] arrPr = this.fullDataSet.Product.Select("OldName='" + nameT + "'");

                    if (arrPr.Length == 0)

                        _row.RowError = "Не найдена";
                    else
                    {
                        _prRow = arrPr[0] as FullDataSet.ProductRow;
                    }

                }
              
                


                /* изготовитель  */

                int manufRef = 0;

               

                DataRow[] _arr = this.fullDataSet.Manufacturer.Select("Name like '"+@_row["SCLMKNM"].ToString().Substring(0,4) +"%'");
                
                if (_arr.Length !=0)
                    

                    manufRef = (_arr[0] as FullDataSet.ManufacturerRow).ID;






                if (!(_row.HasErrors))
                {

                    MDataSet.ReceiptDetailRow _det;

                    /**добавлять в детаил потом аддинг */

                    _det = (this.receiptDetailBindingSource.AddNew() as DataRowView).Row as MDataSet.ReceiptDetailRow;

                    _det.ProductRef = _prRow.ID;

                    _det.Quantity = _prRow.OldKol * Convert.ToDecimal(_row["kolvo"].ToString());

                    _det.PricePurchase = Convert.ToDecimal(_row["cena"].ToString()) / _prRow.OldKol;

                    _det.ManufacturerRef = manufRef;


                    if (_row["serie"].ToString().Length>=15)

                    _det.Series = _row["serie"].ToString().Substring(0,15);
                    else
                    _det.Series = _row["serie"].ToString();


                    _det.UseByDate =DateTime.Parse( _row["tgodn"].ToString());
                    

                    this.receiptDetailBindingSource.EndEdit();


                    {
                        MDataSet.ReceiptDetailAddingRow _add;

                        _add = (this.receiptDetailAddingBindingSource.AddNew() as DataRowView).Row as MDataSet.ReceiptDetailAddingRow;
                       _add.NUMSERTF = _row["NUMSERTF"].ToString();

                       _add.NUMREG = _row["NUMREG"].ToString();

                       _add.DATREG =DateTime.Parse(_row["DATREG"].ToString());

                       _add.ENDDATREG = DateTime.Parse(_row["ENDDATREG"].ToString());
                       
                        _add.TAMZAV = Decimal.Parse(_row["TAMZAV"].ToString());
                      //  _add.MAXNACENKA = Decimal.Parse(_row["maxnacenka"].ToString());
                        
                        _add.DATSERTF = DateTime.Parse(_row["DATSERTF"].ToString());


                        this.receiptDetailAddingBindingSource.EndEdit();

                    
 
                   
                    }






                }

            }
            

        }