Esempio n. 1
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            try
            {
                Application.DoEvents();
                Cursor = Cursors.WaitCursor;

                ds_ProductLocation.Clear();
                ds_ProductLocation.VW_ProductLocation.Merge(ProductLocationManager.GetVWByBarCode(BranchID, ProductID, BarCode));
                if (ds_ProductLocation.VW_ProductLocation.Count == 0)
                {
                    txtBarCode.Focus();
                    txtBarCode.SelectAll();
                    dxErrorProvider.SetError(txtBarCode, "პროდუქტი ვერ მოიძებნა.");
                }
                else
                {
                    var row = ds_ProductLocation.VW_ProductLocation.NewVW_ProductLocationRow();
                    row.ItemArray = ds_ProductLocation.VW_ProductLocation[0].ItemArray;
                    ds_ProductLocation.VW_ProductLocation.AddVW_ProductLocationRow(row);
                    DialogResult = DialogResult.OK;
                    Close();
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(this, "შეცდომა შტრიხ-კოდით მოძებნისას.\n" + ex.Message, "შეცდომა", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }
Esempio n. 2
0
        private void btnGenerate_Click(object sender, EventArgs e)
        {
            if (ReadOnly)
            {
                return;
            }


            var productLocation = ProductLocationManager.GetVWByBranchAndDate(BranchID, Date);

            DataSetHelper.DeleteAllRows(ds_WarehouseDescription.SP_GetWarehouseDescriptionDetail);

            short i         = 0;
            var   rate      = CurrencyRate;
            var   id        = WarehouseDescriptionID;
            var   t_product = new DS_PurchaseOrderInfo.T_ProductDataTable();

            foreach (var row in productLocation)
            {
                i++;
                var newRow = ds_WarehouseDescription.SP_GetWarehouseDescriptionDetail.NewSP_GetWarehouseDescriptionDetailRow();
                newRow.WarehouseDescriptionID = id;
                newRow.OrdinalNumber          = i;
                newRow.MedicamentID           = row.MedicamentID;
                newRow.MedicamentName         = row.MedicamentName;
                newRow.UnitsInStock           = row.UnitsInStock;
                newRow.ProductID = row.ProductID;
                newRow[ds_WarehouseDescription.SP_GetWarehouseDescriptionDetail.CountryCodeColumn] = row[productLocation.CountryCodeColumn.ColumnName];
                newRow[ds_WarehouseDescription.SP_GetWarehouseDescriptionDetail.BrandIDColumn]     = row[productLocation.BrandIDColumn];
                newRow.UnitPrice = row.StandardCost * rate;
                newRow.Quantity  = row.Quantity;
                newRow.DescrQty  = 0m;
                ds_WarehouseDescription.SP_GetWarehouseDescriptionDetail.AddSP_GetWarehouseDescriptionDetailRow(newRow);
                t_product.AddT_ProductRow(row.ProductID);
            }

            DataTable t_xml        = DataSetHelper.PackAlternationDataTable(t_product);
            var       purchaseInfo = ProductionManager.GetPurchaseOrderInfo(0, CurrencyCode, DataSetHelper.InnerBytesData(t_xml));
            var       view         = new DataView(purchaseInfo);

            view.Sort = purchaseInfo.ProductIDColumn.ColumnName;

            foreach (var row in ds_WarehouseDescription.SP_GetWarehouseDescriptionDetail)
            {
                if (DataSetHelper.IsDataRowDeleted(row))
                {
                    continue;
                }

                var j = view.Find(row.ProductID);
                if (j == -1)
                {
                    continue;
                }

                var purchaseRow = (DS_PurchaseOrderInfo.SP_GetPurchaseOrderInfoRow)view[j].Row;
                row.UnitPrice = ProductionManager.GetPurchaseUnitPrice(purchaseRow.UnitPrice, purchaseRow.AverageRate1, purchaseRow.AverageRate2);
            }
        }
Esempio n. 3
0
        protected override void BindData()
        {
            var table = ProductLocationManager.GetProductLocationPurchaseOrderHeader(null, ProductLocationID);

            if (table.Count == 0)
            {
                throw new ArgumentException("მონაცემი არ მოიძებნა.", "RecordID");
            }
            txtOrderID.EditValue      = table[0][table.PurchaseOrderIDColumn];
            dateOrderDate.EditValue   = table[0][table.OrderDateColumn];
            txtBranch.EditValue       = table[0][table.BranchNameColumn];
            txtVendor.EditValue       = table[0][table.VendorNameColumn];
            txtMedicament.EditValue   = table[0][table.MedicamentNameColumn];
            spinReceivedQty.EditValue = table[0][table.ReceivedQtyColumn];
            spinUnitPrice.EditValue   = table[0][table.UnitPriceColumn];
            txtCurrency.EditValue     = table[0][table.CurrencyCodeColumn];
        }
Esempio n. 4
0
        public void OnChooseProduct(object sender, CancelEventArgs e)
        {
            if (ReadOnly || OptionsBaseForm.IsLoading || OptionsBaseForm.IsClosing)
            {
                return;
            }

            try
            {
                var frm = (sender as frmBrowse);

                if (frm == null)
                {
                    return;
                }

                if (frm.OptionsGrid.SelectedRecordID == null)
                {
                    throw new NullReferenceException("არჩეული ჩანაწერის იდენთიფიკატორი ცარიელია. (frm.SelectedRecordID = null)");
                }

                var table = ProductLocationManager.GetVWByIDAndBranch(ConvertHelper.ToInt32(frm.OptionsGrid.SelectedRecordID), FromBranchID, true);
                if (table.Count == 0)
                {
                    throw new NullReferenceException("ჩანაწერი ვერ ვიპოვე მონაცემთა ბაზაში.");
                }

                var crossRate = table[0].ProductCurrencyRate / CurrencyRate;
                table[0].StandardCost = ProductionManager.GetPurchaseUnitPrice(table[0].ProductID, CurrencyCode) / crossRate;
                e.Cancel = !AddDetail(table[0]);
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show("შეცდომა მონაცემის არჩევისას.\n" + ex.Message, "შეცდომა", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 5
0
        public bool IsValidGrid()
        {
            view.CloseEditor();
            bsDetail.EndEdit();

            var ok = true;

            foreach (var row in ds_Production.SP_GetProductDistributionDetail)
            {
                if (row.RowState == DataRowState.Deleted)
                {
                    continue;
                }
                if (!IsValidRow(row))
                {
                    ok = false;
                }
            }
            if (!ok)
            {
                return(ok);
            }


            DS_ProductDistribution.SP_GetProductDistributionDetailDataTable table = DataSetHelper.PackAlternationTypedDataTable <DS_ProductDistribution.SP_GetProductDistributionDetailDataTable>(ds_Production.SP_GetProductDistributionDetail, DataRowState.Added | DataRowState.Modified);
            table.PrimaryKey = null;
            DataSetHelper.RemoveColumns(table, true, table.ProductLocationIDColumn,
                                        table.ProductDistributionDetailIDColumn,
                                        table.ActionColumn);
            var ds = new DataSet("root");

            ds.Tables.Add(table);
            var productLocationQuantity = ProductLocationManager.GetProductLocationQuantity(0, ObjectNames.ProductDistributionDetail, true, DataSetHelper.InnerBytesData(ds));

            foreach (var row2 in ds_Production.SP_GetProductDistributionDetail)
            {
                if (row2.RowState == DataRowState.Deleted)
                {
                    continue;
                }
                foreach (var tmp in productLocationQuantity)
                {
                    if (tmp.RowState == DataRowState.Deleted)
                    {
                        continue;
                    }
                    if (row2.ProductLocationID == tmp.ProductLocationID)
                    {
                        row2.Quantity = tmp.Quantity;
                        InitResidualQty(row2);
                    }
                }

                if (!IsValidRowQuantity(row2))
                {
                    ok = false;
                }
            }

            return(ok);
        }