当前位置: 首页>>代码示例>>C#>>正文


C# ReceiveDoc.Save方法代码示例

本文整理汇总了C#中BLL.ReceiveDoc.Save方法的典型用法代码示例。如果您正苦于以下问题:C# ReceiveDoc.Save方法的具体用法?C# ReceiveDoc.Save怎么用?C# ReceiveDoc.Save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BLL.ReceiveDoc的用法示例。


在下文中一共展示了ReceiveDoc.Save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: btnSave_Click

        private void btnSave_Click(object sender, EventArgs e)
        {
            string valid = ValidateFields();
            if (valid == "true")
            {
                if (XtraMessageBox.Show("Are You Sure, You want to save this Transaction?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    IssueDoc iss = new IssueDoc();
                    ReceiveDoc rec = new ReceiveDoc();

                    iss.LoadByPrimaryKey(_tranId);

                    string batchNo = iss.BatchNo;
                    Int64 qty = iss.Quantity;
                    rec.GetTransactionByBatch(iss.ItemID, iss.BatchNo, iss.StoreId);

                    iss.RefNo = txtRefNo.Text;
                    iss.BatchNo = txtBatchNo.Text;
                    iss.NoOfPack = Convert.ToInt32(txtPack.Text);
                    iss.QtyPerPack = Convert.ToInt32(txtQtyPack.Text);
                    iss.Quantity = Convert.ToInt32(txtPack.Text) * Convert.ToInt32(txtQtyPack.Text);
                    iss.StoreId = Convert.ToInt32(cboStores.SelectedValue);
                    iss.ReceivingUnitID = Convert.ToInt32(cboReceivingUnit.SelectedValue);
                    iss.Remark = txtRemark.Text;
                    iss.IssuedBy = txtReceivedBy.Text;
                    iss.Save();

                    Int64 newQty = 0;
                    if(qty > iss.Quantity)
                        newQty = rec.QuantityLeft + (qty - iss.Quantity);
                    else
                        newQty = rec.QuantityLeft - (iss.Quantity - qty);

                    rec.QuantityLeft = newQty;
                    if(rec.QuantityLeft >0)
                        rec.Out = false;
                    rec.Save();

                    XtraMessageBox.Show("Transaction Succsfully Saved!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }
            }
            else
            {
                XtraMessageBox.Show(valid, "Validation", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
        }
开发者ID:USAID-DELIVER-PROJECT,项目名称:ethiopia-hcmis-facility,代码行数:47,代码来源:EditIssue.cs

示例2: MarkReceivedBatchAsEmpty

 public static bool MarkReceivedBatchAsEmpty(int receiveID)
 {
     try
     {
         BLL.ReceiveDoc rec = new ReceiveDoc();
         rec.LoadByPrimaryKey(receiveID);
         if (rec.RowCount > 0)
         {
             rec.QuantityLeft = 0;
             rec.Out = true;
             rec.Save();
             return true;
         }
         return false;
     }
     catch
     {
         return false;
     }
 }
开发者ID:USAID-DELIVER-PROJECT,项目名称:ethiopia-hcmis-facility,代码行数:20,代码来源:ReceiveDoc.cs

示例3: btnUpdate_Click

        private void btnUpdate_Click(object sender, EventArgs e)
        {
            var rec = new ReceiveDoc();
            DataTable dtbl = rec.GetTransactionByRefNo(_refno);
            if (rec.RowCount > 0)
            {
                foreach (DataRow datarow in dtbl.Rows)
                {
                    datarow["RefNo"] = refnotextEdit.Text;
                    datarow["Date"] = txtDate.Text;
                }
                rec.Save();
                Close();
                XtraMessageBox.Show("Refrence No and Date is successfully updated", "Success");
            }

            else
            {
                XtraMessageBox.Show("There is no refrence to edit");
                return;
            }
            this.Close();
        }
开发者ID:USAID-DELIVER-PROJECT,项目名称:ethiopia-hcmis-facility,代码行数:23,代码来源:EditRecieveRefrenceNo.cs

示例4: deleteToolStripMenuItem_Click

        private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var us = new User();
            var userID = MainWindow.LoggedinId;
            us.LoadByPrimaryKey(userID);
            var dr = (DataRowView) lstTree.GetDataRecordByNode(lstTree.FocusedNode);
            if (dr == null) return;

            if (us.UserName != "admin")
            {
                XtraMessageBox.Show("You don't have the privilege to update reference number!", "Caution");
                return;
            }
            var rec = new ReceiveDoc();
            if (XtraMessageBox.Show("Are You Sure, You want to delete this?", "Confirmation", MessageBoxButtons.YesNo,MessageBoxIcon.Question) == DialogResult.Yes)
            {
                DataTable dtbl = rec.GetTransactionByRefNo((string) dr["RefNo"]);
                foreach (DataRow dataRow in dtbl.Rows)
                {
                   // AddReceiveDocDeleted(dataRow);
                    dataRow.Delete();
                }
                rec.MarkAsDeleted();
                rec.Save();

                XtraMessageBox.Show("Item successfully deleted.", "Success");
            }
            else
            {
                return;
            }
        }
开发者ID:USAID-DELIVER-PROJECT,项目名称:ethiopia-hcmis-facility,代码行数:32,代码来源:LogReceive.cs

示例5: DeleteIssueDoc

        public static void DeleteIssueDoc(int issueID)
        {
            MyGeneration.dOOdads.TransactionMgr tranMgr =
                MyGeneration.dOOdads.TransactionMgr.ThreadTransactionMgr();

            try
            {
                tranMgr.BeginTransaction();

                var pld = new PickListDetail();
                var rdoc = new ReceiveDoc();
                var rp = new ReceivePallet();
                var idoc = new IssueDoc();

                idoc.LoadByPrimaryKey(issueID);
                pld.LoadByPrimaryKey(idoc.PLDetailID);
                rdoc.LoadByPrimaryKey(idoc.RecievDocID);

                rp.LoadByPrimaryKey(pld.ReceivePalletID);
                var pl = new PalletLocation();
                pl.loadByPalletID(rp.PalletID);

                if (pl.RowCount == 0)
                {
                    pl.LoadByPrimaryKey(pld.PalletLocationID);
                    if (pl.IsColumnNull("PalletID"))
                    {
                        pl.PalletID = rp.PalletID;
                        pl.Save();
                    }
                }

                if (rp.RowCount == 0)
                {
                    XtraMessageBox.Show("You cannot delete this item, please contact the administrator", "Error");
                    return;
                }
                if (rp.RowCount > 0)
                {
                    // in error cases this could lead to a number greater than the received quantity
                    // instead of being an error, it should just delete the respective issue and
                    // adjust the remaining quantity to the received quantity.
                    if (rdoc.QuantityLeft + idoc.Quantity > rdoc.Quantity)
                    {
                        rdoc.QuantityLeft = rp.Balance = rdoc.Quantity;
                    }
                    else
                    {
                        rdoc.QuantityLeft += idoc.Quantity;
                        rp.Balance += idoc.Quantity;
                    }

                    //Delete from picklistDetail and add to pickListDetailDeleted
                    PickListDetailDeleted.AddNewLog(pld, BLL.CurrentContext.UserId);
                    pld.MarkAsDeleted();

                    // are we adding it the pick face?
                    // if so add it to the balance of the pick face also
                    pl.loadByPalletID(rp.PalletID);

                    if (pl.RowCount == 0)
                    {
                        var plocation = new PutawayLocation(rdoc.ItemID);

                        // we don't have a location for this yet,
                        // select a new location
                        //PutawayLocataion pl = new PutawayLocataion();
                        if (plocation.ShowDialog() == DialogResult.OK)
                        {
                            pl.LoadByPrimaryKey(plocation.PalletLocationID);
                            if (pl.RowCount > 0)
                            {
                                pl.PalletID = rp.PalletID;
                                pl.Save();
                            }
                        }
                    }

                    if (pl.RowCount > 0)
                    {
                        var pf = new PickFace();
                        pf.LoadByPalletLocation(pl.ID);
                        if (pf.RowCount > 0)
                        {
                            pf.Balance += Convert.ToInt32(idoc.Quantity);
                            pf.Save();
                        }

                        IssueDocDeleted.AddNewLog(idoc, CurrentContext.UserId);
                        idoc.MarkAsDeleted();
                        rdoc.Save();
                        rp.Save();
                        idoc.Save();
                        pld.Save();

                        // now refresh the window
                        XtraMessageBox.Show("Issue Deleted!", "Confirmation", MessageBoxButtons.OK,
                                            MessageBoxIcon.Information);
                        tranMgr.CommitTransaction();

//.........这里部分代码省略.........
开发者ID:USAID-DELIVER-PROJECT,项目名称:ethiopia-hcmis-warehouse,代码行数:101,代码来源:LogIssues.cs

示例6: SetPriceForReceiveDocs

 public void SetPriceForReceiveDocs()
 {
     ReceiveDoc receiveDoc = new ReceiveDoc();
     receiveDoc.LoadbyItemUnitManufacturerMovingAverageID(ReceiptID.Value,ItemID,ItemUnitID,ManufacturerID,MovingAverageID);
     receiveDoc.Rewind();
     while (!receiveDoc.EOF)
     {
         if(receiveDoc.IsColumnNull("PricePerPack") || !(receiveDoc.PricePerPack > 0))
             receiveDoc.PricePerPack = AverageCost;
         if(receiveDoc.IsColumnNull("UnitCost") || !(receiveDoc.PricePerPack > 0))
             receiveDoc.UnitCost = Convert.ToDecimal(AverageCost);
         receiveDoc.Cost = AverageCost;
         receiveDoc.Margin = Margin;
         receiveDoc.SellingPrice = SellingPrice;
         receiveDoc.MoveNext();
     }
     receiveDoc.Save();
 }
开发者ID:USAID-DELIVER-PROJECT,项目名称:ethiopia-hcmis-warehouse,代码行数:18,代码来源:CostElement.cs

示例7: btnSave_Click

        /// <summary>
        /// After doing validation, the receive information is saved to the database.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            string valid = ValidateFields();
            if ( valid == "true")
            {
                if (XtraMessageBox.Show("Are You Sure, You want to save this Transaction?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    ReceiveDoc rec = new ReceiveDoc();
                    IssueDoc iss =new IssueDoc();
                    ProgramProduct pp = new ProgramProduct();
                    rec.LoadByPrimaryKey(_tranId);
                    iss.GetIssueByBatchAndId(rec.ItemID, rec.BatchNo, rec.ID);
                    rec.RefNo = txtRefNo.Text;
                    int previousprogid = rec.SubProgramID;
                    dtRecDate.CustomFormat = "MM/dd/yyyy";
                     string dtValid  = "";
                    try
                     {
                         rec.Date = Convert.ToDateTime(txtDate.Text);
                     }
                     catch
                     {
                         string year = "";
                         if (Convert.ToInt32(txtDate.Text.Substring(0, 2)) == 13)
                         {
                             dtValid = txtDate.Text;
                             year = dtValid.Substring(dtValid.Length - 4, 4);
                             rec.Date = Convert.ToDateTime("12/30/" + year);
                         }
                         else if (Convert.ToInt32(txtDate.Text.Substring(0, 2)) == 2)
                         {
                             dtValid = txtDate.Text;
                             year = dtValid.Substring(dtValid.Length - 4, 4);
                             rec.Date = Convert.ToDateTime("2/28/" + year);
                         }
                     }
                    if ((iss.RowCount != 0) && (iss.RecievDocID != null && iss.RecievDocID == rec.ID))
                        {
                            rec.BatchNo = txtBatchNo.Text;
                            rec.ExpDate = dtExpiryDate.Value;
                            rec.Remark = txtRemark.Text;
                            rec.ReceivedBy = txtReceivedBy.Text;
                            rec.SupplierID = Convert.ToInt32(cboSupplier.SelectedValue);
                            rec.UnitID = VisibilitySetting.HandleUnits==1 ? 0 : Convert.ToInt32(lkItemUnit.EditValue);
                            rec.StoreID = Convert.ToInt32(cboStores.SelectedValue);
                            pp.LoadByNewProgramIdAndItemId(Convert.ToInt32(rec.ItemID), Convert.ToInt32(lkPrograms.EditValue));
                            if (pp.RowCount == 1)
                            {
                                rec.SubProgramID = Convert.ToInt32(lkPrograms.EditValue);
                                pp.ProgramID = Convert.ToInt32(lkPrograms.EditValue);
                                pp.ItemID = Convert.ToInt32(rec.ItemID);
                                pp.Save();

                            }
                            else if (pp.RowCount == 0)
                            {
                                rec.SubProgramID = Convert.ToInt32(lkPrograms.EditValue);
                                pp.AddNew();
                                pp.ProgramID = rec.SubProgramID;
                                pp.ItemID = Convert.ToInt32(rec.ItemID);
                                pp.Save();
                            }
                            rec.Out = false;
                            rec.Save();
                            XtraMessageBox.Show("Transaction Succsfully Saved!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            this.Close();
                        }
                    else if (iss.RowCount == 0)
                    {
                        rec.BatchNo = txtBatchNo.Text;
                        rec.ExpDate = dtExpiryDate.Value;
                        rec.Remark = txtRemark.Text;
                        rec.ReceivedBy = txtReceivedBy.Text;
                        rec.NoOfPack = Convert.ToInt32(txtPack.Text);
                        rec.QtyPerPack = Convert.ToInt32(txtQtyPack.Text);
                        rec.Quantity = Convert.ToInt32(txtPack.Text) * Convert.ToInt32(txtQtyPack.Text);
                        rec.QuantityLeft = Convert.ToInt32(txtPack.Text) * Convert.ToInt32(txtQtyPack.Text);
                        rec.Out = false;
                        rec.StoreID = Convert.ToInt32(cboStores.SelectedValue);
                        rec.SupplierID = Convert.ToInt32(cboSupplier.SelectedValue);
                        rec.UnitID = VisibilitySetting.HandleUnits == 1 ? 0 : Convert.ToInt32(lkItemUnit.EditValue);
                        pp.LoadByNewProgramIdAndItemId(Convert.ToInt32(rec.ItemID), previousprogid);
                        if (pp.RowCount == 1)
                        {
                            rec.SubProgramID = Convert.ToInt32(lkPrograms.EditValue);
                            pp.ProgramID = Convert.ToInt32(lkPrograms.EditValue);
                            pp.ItemID = Convert.ToInt32(rec.ItemID);
                            pp.Save();

                        }
                        else if(pp.RowCount ==0)
                        {
                            rec.SubProgramID = Convert.ToInt32(lkPrograms.EditValue);
                            pp.AddNew();
                            pp.ProgramID = rec.SubProgramID;
//.........这里部分代码省略.........
开发者ID:USAID-DELIVER-PROJECT,项目名称:ethiopia-hcmis-facility,代码行数:101,代码来源:EditReceive.cs

示例8: BtnAddBatchClick

        private void BtnAddBatchClick(object sender, EventArgs e)
        {
            if (!dxValidationProvider1.Validate()) return;
            var rec = new ReceiveDoc();
            var yEnd = new YearEnd();

            switch (VisibilitySetting.HandleUnits)
            {
                case 1:
                    {
                        rec.AddNew();
                        rec.ItemID = _itemid;
                        rec.BatchNo = txtBatchNo.Text;
                        rec.StoreID = _storeid;
                        rec.ExpDate = (DateTime) dateEditExpiryDate.EditValue;
                        rec.Date = _date;
                        rec.UnitID = 0;
                        rec.RefNo = txtRefNo.Text;
                        rec.Out = false;
                        rec.EurDate = DateTime.Now.Subtract(TimeSpan.FromDays(35));
                        rec.NoOfPack = Convert.ToInt32(txtPackQty.Text);
                        rec.QtyPerPack = Convert.ToInt32(txtQtyPerPack.Text);
                        rec.Quantity = (Convert.ToInt32(txtPackQty.Text))*(Convert.ToInt32(txtQtyPerPack.Text));
                        rec.QuantityLeft = (Convert.ToInt32(txtPackQty.Text))*(Convert.ToInt32(txtQtyPerPack.Text));
                        rec.Cost = Convert.ToDouble(txtPrice.Text);
                        rec.Save();

                        yEnd.AddNew();
                        yEnd.ItemID = _itemid;
                        yEnd.StoreID = _storeid;
                        yEnd.Year = _date.Year;
                        yEnd.AutomaticallyEntered = true;
                        yEnd.BBalance = 0;
                        yEnd.EBalance = 0;
                        yEnd.Save();

                    }
                    break;
                default:
                    {
                        rec.AddNew();
                        rec.ItemID = _itemid;
                        rec.BatchNo = txtBatchNo.Text;
                        rec.StoreID = _storeid;
                        rec.UnitID = _unitid;
                        rec.ExpDate = (DateTime) dateEditExpiryDate.EditValue;
                        rec.NoOfPack = Convert.ToInt32(txtPackQty.Text);
                        rec.Quantity = Convert.ToInt32(txtPackQty.Text);
                        rec.QuantityLeft = Convert.ToInt32(txtPackQty.Text);
                        rec.QtyPerPack = Convert.ToInt32(txtQtyPerPack.Text);
                        rec.Date = _date;
                        rec.RefNo = txtRefNo.Text;
                        rec.Out = false;
                        rec.EurDate = DateTime.Now.Subtract(TimeSpan.FromDays(35));
                        rec.Cost = Convert.ToDouble(txtPrice.Text);
                        rec.Save();

                        yEnd.AddNew();
                        yEnd.ItemID = _itemid;
                        yEnd.StoreID = _storeid;
                        yEnd.UnitID = _unitid;
                        yEnd.AutomaticallyEntered = true;
                        yEnd.BBalance = 0;
                        yEnd.EBalance = 0;
                        yEnd.Save();
                    }
                    break;
            }
            XtraMessageBox.Show("New Batch successfully added.", "Success");
            Close();
        }
开发者ID:USAID-DELIVER-PROJECT,项目名称:ethiopia-hcmis-facility,代码行数:71,代码来源:NewBatch.cs

示例9: SaveReceive

        private void SaveReceive()
        {
            // Merge all Receives with Same Item information and Assigned to Same PhysicalStore as One Item , Quantity Sumed UP!
            MergeReceiveDocLines();

            BLL.ReceiveDoc rec = new ReceiveDoc();

            ////int receiptTypeID = srm
            ////    ? ReceiptType.CONSTANTS.STOCK_RETURN
            ////    : (deliveryNoteType != DeliveryNoteType.NotSet)
            ////        ? ReceiptType.CONSTANTS.DELIVERY_NOTE
            ////        : beginningBalance
            ////            ? ReceiptType.CONSTANTS.BEGINNING_BALANCE
            ////            : ReceiptType.CONSTANTS.STANDARD_RECEIPT;
            int receiptID;
            int warehouseID = Convert.ToInt32(lkWarehouse.EditValue);

            receiptID = SaveRelevantReceiptHeaders(_receiptTypeID, warehouseID);

            DataTable zeroQuantitiesDueToMultipleBatch = null;
            DataRow [] zeroQuantityRows =
                _dtRecGrid.Select(string.Format("[Pack Qty] = 0"),"[Ordering] ASC ");

            if (zeroQuantityRows.Any() && zeroQuantityRows.Any(r => r["ShortageReasonID"] == DBNull.Value))
            {
                zeroQuantityRows = CheckAndRemoveIfFullNotReceiveEntry(zeroQuantityRows);
                if (zeroQuantityRows.Any())
                    zeroQuantitiesDueToMultipleBatch =
                        zeroQuantityRows.Where(r => r["ShortageReasonID"] == DBNull.Value).CopyToDataTable();
            }

            var mergeableTables = _dtRecGrid.Select(string.Format("[Pack Qty] > 0 "), "[Ordering] ASC ");
            DataTable mergedDataTable = null;
            if (mergeableTables.Any())
            {
                mergedDataTable =
                    _dtRecGrid.Select(string.Format("[Pack Qty] > 0 "), "[Ordering] ASC ").CopyToDataTable();

                if (zeroQuantitiesDueToMultipleBatch != null)
                    mergedDataTable.Merge(zeroQuantitiesDueToMultipleBatch);

                if (grdShortageOrDamaged.DataSource != null)
                {
                    var shortageOrDamage = (DataTable) grdShortageOrDamaged.DataSource;
                    mergedDataTable.Merge(shortageOrDamage);
                }
            }
            else
            {
                if (grdShortageOrDamaged.DataSource != null)
                {
                    var shortageOrDamage = (DataTable)grdShortageOrDamaged.DataSource;
                    if (zeroQuantitiesDueToMultipleBatch != null)
                        shortageOrDamage.Merge(zeroQuantitiesDueToMultipleBatch);
                    //~ {"[ShortageReasonID] ASC} --> Just to give priority among shortages to Damaged reasons as we will create a receiveDoc entry for this ~//
                    mergedDataTable = mergedDataTable == null ? shortageOrDamage.Select(string.Format("[Pack Qty] >= 0 "), "[ShortageReasonID] ASC ").CopyToDataTable() : shortageOrDamage;

                }
            }

            foreach (DataRowView dr in mergedDataTable.DefaultView)
            {
                var shortageReasonID = dr["ShortageReasonID"];

                var onlyOneEntryFound = _dtRecGrid.Select(String.Format("GUID = '{0}'", dr["GUID"]));

                bool zeroQtyDueTomultipleBatchFound = (Convert.ToDecimal(dr["Pack Qty"]) == 0) && (shortageReasonID == DBNull.Value) && (onlyOneEntryFound.Count() == 1);
                bool fullNotReceivedEntry = (Convert.ToDecimal(dr["BU Qty"]) == 0) && (shortageReasonID != DBNull.Value) && (Convert.ToInt32(shortageReasonID) == ShortageReasons.Constants.NOT_RECEIVED) && (onlyOneEntryFound.Count() == 1);
                if (fullNotReceivedEntry)
                {
                    dr["Pack Qty"] = 0;
                }

                var item = new Item();
                item.LoadByPrimaryKey(Convert.ToInt32(dr["ID"]));

                if (item.NeedExpiryBatch || (shortageReasonID == DBNull.Value && ((dr["Expiry Date"] != DBNull.Value) && (Convert.ToDateTime(dr["Expiry Date"]) <= DateTimeHelper.ServerDateTime))))
                {

                    var expDate = Convert.ToDateTime(dr["Expiry Date"]);

                    if ((shortageReasonID == DBNull.Value && expDate > DateTimeHelper.ServerDateTime) || zeroQtyDueTomultipleBatchFound)
                    {
                        AddNewReceiveDoc(rec, receiptID, dr);
                    }
                    else
                    {
                        //for physically Damaged receives and expired receives
                        if ((shortageReasonID != DBNull.Value && Convert.ToInt32(shortageReasonID) == ShortageReasons.Constants.DAMAGED) || (shortageReasonID == DBNull.Value && expDate <= DateTimeHelper.ServerDateTime) || fullNotReceivedEntry)
                        {
                            AddNewReceiveDoc(rec, receiptID, dr, true);
                            if (shortageReasonID == DBNull.Value)
                            {
                                dr["ShortageReasonID"] = ShortageReasons.Constants.DAMAGED;
                            }
                        }
                        else
                        {

                            HandleReceiveDocShortage(dr, rec);
//.........这里部分代码省略.........
开发者ID:USAID-DELIVER-PROJECT,项目名称:ethiopia-hcmis-warehouse,代码行数:101,代码来源:Receipt.cs

示例10: SaveInventoryWithOutUnit

        private bool SaveInventoryWithOutUnit()
        {
            var yEnd = new YearEnd();
            var rec = new ReceiveDoc();

            if (IsValid())
            {
                dtDate.Value = DateTime.Now;
                DateTime dtCurent = new DateTime();
                dtDate.CustomFormat = "MM/dd/yyyy";
                dtCurent = ConvertDate.DateConverter(dtDate.Text);

                int year = dtCurent.Year;
                if (XtraMessageBox.Show("Are You Sure, You want to save this Transaction?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    DataTable yearEndTable = (DataTable)grdYearEnd.DataSource;

                    for (int i = 0; i < dtBB.Rows.Count; i++)
                    {
                        int id = 0;
                        int storeID = Convert.ToInt32(cboStores.EditValue);
                        if (dtBB.Rows[i]["ItemID"] != DBNull.Value)
                        {
                            var itemID = Convert.ToInt32(dtBB.Rows[i]["ItemID"]);
                            //var unitID = Convert.ToInt32(dtBB.Rows[i]["UnitID"]);
                            id = yEnd.LoadByItemIDStoreAndYear(itemID, storeID, year, false);
                        }
                        if (id != 0 && !ReferenceEquals(yearEndTable.Rows[i]["Physical Inventory"], string.Empty))//There is already a manual entry in the yearend table.
                        {
                            //yEnd.LoadByPrimaryKey(id);
                            yEnd.BBalance = Convert.ToInt64(FilterNumbers(yearEndTable.Rows[i]["Beginning Balance"].ToString()));
                            yEnd.EBalance = Int64.Parse(FilterNumbers(yearEndTable.Rows[i]["Ending Balance(SOH)"].ToString()), NumberStyles.AllowThousands);
                            yEnd.PhysicalInventory = Convert.ToInt64(FilterNumbers(yearEndTable.Rows[i]["Physical Inventory"].ToString()));
                            //yEnd.BatchNo = yearEndTable.Rows[i]["Batch No."].ToString();
                            yEnd.UnitID = 0;
                            yEnd.Remark = yearEndTable.Rows[i]["Remark"].ToString();
                            yEnd.AutomaticallyEntered = false;
                            yEnd.Save();
                        }
                        else//There is no entry in the yearend table under this item name that has been entered manually.
                        {
                            DataRow cRow = dtBB.Rows[i];
                            if (!ReferenceEquals(cRow["Physical Inventory"], string.Empty) && cRow["ItemID"] != DBNull.Value)
                            {
                                var itemID = Convert.ToInt32(cRow["ItemID"]);
                                var unitID = 0;
                                YearEnd.PurgeAutomaticallyEnteredInventoryForUnit(itemID, storeID, year, unitID);
                                //if (areAllBatchesPhyInventoryNullValue == false) //We want to add an inventory record if at least one of the batches has a non empty value.
                                //{
                                yEnd.AddNew();
                                yEnd.ItemID = itemID;
                                yEnd.StoreID = storeID;
                                yEnd.Year = year;
                                yEnd.BBalance = Convert.ToInt64(cRow["Beginning Balance"]);
                                Int64 endBal = Convert.ToInt64(cRow["Ending Balance(SOH)"]);
                                //yEnd.BatchNo = cRow["Batch No."].ToString();
                                yEnd.EBalance = endBal;// Convert.ToInt64(yearEndTable.Rows[i].Cells[5].Value);

                                if (cRow["Physical Inventory"] != DBNull.Value)
                                    yEnd.PhysicalInventory = Convert.ToInt64(cRow["Physical Inventory"]);

                                //yEnd.PhysicalInventory = physicalInventoryTotal;
                                yEnd.UnitID = 0;
                                 yEnd.Remark = cRow["Remark"].ToString();

                                yEnd.AutomaticallyEntered = cRow["Physical Inventory"] == DBNull.Value;
                                yEnd.Save();
                                //}

                                //long physicalInventoryTotal = 0;
                                //bool areAllBatchesPhyInventoryNullValue = true;
                                //if (endBal != yEnd.PhysicalInventory)
                                if (true)
                                {
                                    int k = i + 1;

                                    if (k < dtBB.Rows.Count)
                                    {
                                        while (Convert.ToInt32(dtBB.Rows[k]["RecID"]) != -1)
                                        {
                                            if (dtBB.Rows[k]["Physical Inventory"] != DBNull.Value)
                                            {
                                                //areAllBatchesPhyInventoryNullValue = false;
                                                long batchPhysicalInventory =
                                                    Convert.ToInt64(dtBB.Rows[k]["Physical Inventory"]);
                                                //physicalInventoryTotal += batchPhysicalInventory;
                                                rec.LoadByPrimaryKey(Convert.ToInt32(dtBB.Rows[k]["RecID"]));
                                                rec.QuantityLeft = Convert.ToInt64(batchPhysicalInventory);
                                                rec.Remark = "Physical Inventory";
                                                rec.UnitID = 0;
                                                rec.Out = rec.QuantityLeft == 0;
                                                rec.Save();
                                            }
                                            k++;
                                            if (k >= yearEndTable.Rows.Count)
                                                break;
                                        }
                                    }
                                }
                            }
//.........这里部分代码省略.........
开发者ID:USAID-DELIVER-PROJECT,项目名称:ethiopia-hcmis-facility,代码行数:101,代码来源:YearEndProcess.cs

示例11: btnSave_Click

        private void btnSave_Click(object sender, EventArgs e)
        {
            var rec = new ReceiveDoc();

            var itm = new Items();
            var itemprogram = new ProgramProduct();
            string valid = ValidateFields();
            if (valid == "true")
            {
                if (
                    XtraMessageBox.Show("Are you sure you want to save this transaction?", "Confirmation",
                                        MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    try
                    {
                        for (int i = 0; i < dtRecGrid.Rows.Count; i++)
                        {
                            if (dtRecGrid.Rows[i]["Expiry Date"] != DBNull.Value)
                            {
                                if (Convert.ToDateTime(dtRecGrid.Rows[i]["Expiry Date"]) <= DateTime.Now)
                                {
                                    var dialog =
                                        XtraMessageBox.Show(
                                            "The item " + dtRecGrid.Rows[i]["Item Name"].ToString() +
                                            " has already expired.  Are you sure you want to receive it?", "Warning",
                                            MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                                    if (dialog == DialogResult.No)
                                    {
                                        return;
                                    }

                                }
                            }
                            rec.AddNew();
                            rec.StoreID = Convert.ToInt32(cboStores.EditValue);
                            rec.RefNo = txtRefNo.Text.Trim();
                            rec.Remark = txtRemark.Text;
                            rec.ReceivedBy = txtReceivedBy.Text;

                            DateTime xx = dtRecDate.Value;
                            dtRecDate.CustomFormat = "MM/dd/yyyy";
                            DateTime dtRec = new DateTime();
                            rec.Date = ConvertDate.DateConverter(dtRecDate.Text);

                            dtRec = ConvertDate.DateConverter(dtRecDate.Text);
                            dtRecDate.IsGregorianCurrentCalendar = true;

                            rec.EurDate = dtRecDate.Value;

                            dtRecDate.IsGregorianCurrentCalendar = false;

                            rec.ItemID = Convert.ToInt32(dtRecGrid.Rows[i][0]);

                            switch (VisibilitySetting.HandleUnits)
                            {
                                case 1:
                                    rec.UnitID = 0;
                                    rec.QtyPerPack = Convert.ToInt32(dtRecGrid.Rows[i]["Qty/Pack"]);
                                    break;
                                case 2:
                                    rec.UnitID = Convert.ToInt32(dtRecGrid.Rows[i]["UnitID"]);
                                    rec.QtyPerPack = 1;
                                    break;
                                case 3:
                                    rec.UnitID = Convert.ToInt32(dtRecGrid.Rows[i]["UnitID"]);
                                    rec.QtyPerPack = 1;
                                    break;
                            }
                            rec.NoOfPack = Convert.ToInt32(dtRecGrid.Rows[i]["Pack Qty"]);

                            rec.Quantity = rec.NoOfPack * rec.QtyPerPack;
                            rec.QuantityLeft = rec.Quantity;
                            if (dtRecGrid.Rows[i]["Price/Pack"] != null &&
                                dtRecGrid.Rows[i]["Price/Pack"].ToString() != "")
                            {
                                double pre = Convert.ToDouble(dtRecGrid.Rows[i]["Price/Pack"]) / rec.QtyPerPack;
                                rec.Cost = Convert.ToDouble(pre);
                            }
                            else
                            {
                                rec.Cost = 0;
                            }
                            itm.LoadByPrimaryKey(Convert.ToInt32(dtRecGrid.Rows[i]["ID"]));
                            rec.BatchNo = dtRecGrid.Rows[i][8].ToString();
                            if (dtRecGrid.Rows[i]["Expiry Date"] != DBNull.Value)
                            {
                                rec.ExpDate = Convert.ToDateTime(dtRecGrid.Rows[i]["Expiry Date"]);
                            }

                            rec.SupplierID = Convert.ToInt32(cboSupplier.EditValue);
                            rec.SubProgramID = Convert.ToInt32(cboProgram.EditValue);
                            string batch = DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() +
                                           DateTime.Now.Minute.ToString() + rec.ItemID.ToString();
                            rec.LocalBatchNo = batch;

                            rec.Out = false;
                            rec.IsApproved = false;
                            dtRecDate.Value = xx;
                            rec.Save();
//.........这里部分代码省略.........
开发者ID:USAID-DELIVER-PROJECT,项目名称:ethiopia-hcmis-facility,代码行数:101,代码来源:ReceiveingForm.cs

示例12: HandleReceiveDocShortage

        /// <summary>
        /// This needs to be called after FillInReceiveDocInformation has been called.
        /// </summary>
        /// <param name="rec">ReceiveDoc should be passed to this function having been saved and with the id field different from null</param>
        /// <param name="dr">ReceiveDoc should be passed to this function having been saved and with the id field different from null</param>
        private void HandleReceiveDocShortage(DataRowView dr, ReceiveDoc rec, int receiveDocID = 0)
        {
            var recShortage = new ReceiveDocShortage();
            bool shortagetoBeAdded = false;

            if (receiveDocID == 0)
            {
                receiveDocID = Convert.ToInt32(rec.DefaultView.Table.Select(String.Format("GUID = '{0}'", dr["GUID"]))[0]["ID"]);
                shortagetoBeAdded = true;
            }

            //if (rec.GetColumn("ShortageReasonID") == System.DBNull.Value || Convert.ToInt32(rec.GetColumn("ShortageReasonID")) == 1) return;

            if ((srm && Convert.ToBoolean(dr["IsDamaged"])) || (Convert.ToDecimal(dr["InvoicedQty"]) >= Convert.ToDecimal(dr["Pack Qty"])))
            {
                var item = new Item();
                item.LoadByPrimaryKey(Convert.ToInt32(dr["id"]));

                if (dr["ShortageReasonID"] == DBNull.Value &&  rec.ExpDate <= DateTimeHelper.ServerDateTime)
                {
                    dr["ShortageReasonID"] = ShortageReasons.Constants.DAMAGED;
                }

                if (dr["ShortageReasonID"] != DBNull.Value && (!(Convert.ToDecimal(dr["Pack Qty"]) == 0 && Convert.ToInt32(dr["ShortageReasonID"]) == ShortageReasons.Constants.NOT_RECEIVED)))
                {
                    int shortageReasonID = Convert.ToInt32(dr["ShortageReasonID"]);

                    recShortage.AddNew();
                    recShortage.ShortageReasonID = shortageReasonID;
                    recShortage.ReceiveDocID = receiveDocID;
                    recShortage.NoOfPacks = Convert.ToDecimal(dr["Pack Qty"]);

                    if (shortagetoBeAdded)
                    {
                        var receiveDoc = new ReceiveDoc();
                        receiveDoc.LoadByPrimaryKey(receiveDocID);
                        if (receiveDoc.InvoicedNoOfPack!=0 && receiveDoc.Quantity >= receiveDoc.InvoicedNoOfPack)
                        {
                            receiveDoc.InvoicedNoOfPack = receiveDoc.Quantity + recShortage.NoOfPacks;
                            receiveDoc.Save();
                        }

                    }
                }
                else
                {
                    XtraMessageBox.Show(
                        "Please enter the reason for the discrepancy in invoiced vs. received qty.", "Error",
                        MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            recShortage.Save();
        }
开发者ID:USAID-DELIVER-PROJECT,项目名称:ethiopia-hcmis-warehouse,代码行数:58,代码来源:Receipt.cs

示例13: DeleteAnIssue

        public void DeleteAnIssue(int issueDociD)
        {
            ReceiveDoc rdoc = new ReceiveDoc();
            ReceivePallet rp = new ReceivePallet();
            IssueDoc idoc = new IssueDoc();
            idoc.LoadByPrimaryKey(issueDociD);

            if (idoc.IsThereSRM)
            {
                throw new Exception("There is an SRM for this issue.  You can't void it.");
            }

            PickListDetail pld = new PickListDetail();
            //pld.LoadByOrderAndItem(idoc.OrderID, idoc.ItemID, idoc.NoOfPack);
            pld.LoadByPrimaryKey(idoc.PLDetailID);

            string RefNo = idoc.RefNo;

            rdoc.LoadByPrimaryKey(idoc.RecievDocID);

            //if (pld.RowCount == 0)
            //{
            //    pld.LoadByOrderAndItem(idoc.OrderID, idoc.ItemID);
            //}

            rp.LoadByReceiveDocID(idoc.RecievDocID);
            PalletLocation pl = new PalletLocation();
            pl.loadByPalletID(rp.PalletID);

            if (pl.RowCount == 0)
            {
                pl.LoadByPrimaryKey(pld.PalletLocationID);
                if (pl.IsColumnNull("PalletID"))
                {
                    pl.PalletID = rp.PalletID;
                    pl.Save();
                }

            }

            if (rp.RowCount == 0)
            {
                XtraMessageBox.Show("You cannot delete this item, please contact the administrator", "Error");
                return;
            }
            if (rp.RowCount > 0)
            {
                rdoc.QuantityLeft += idoc.Quantity;
                rp.Balance += idoc.Quantity;

                //Delete from picklistDetail and add to pickListDetailDeleted
                PickListDetailDeleted.AddNewLog(pld, BLL.CurrentContext.UserId);
                pld.MarkAsDeleted();

                // are we adding it the pick face?
                // if so add it to the balance of the pick face also
                pl.loadByPalletID(rp.PalletID);

                if (pl.RowCount == 0)
                {
                    PutawayLocation plocation = new PutawayLocation(rdoc.ItemID);

                    // we don't have a location for this yet,
                    // select a new location
                    //PutawayLocataion pl = new PutawayLocataion();
                    if (plocation.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        pl.LoadByPrimaryKey(plocation.PalletLocationID);
                        if (pl.RowCount > 0)
                        {
                            pl.PalletID = rp.PalletID;
                            pl.Save();
                        }
                    }
                }

                if (pl.RowCount > 0)
                {

                    PickFace pf = new PickFace();
                    pf.LoadByPalletLocation(pl.ID);
                    if (pf.RowCount > 0)
                    {
                        pf.Balance += Convert.ToInt32(idoc.Quantity);
                        pf.Save();
                    }

                    IssueDocDeleted.AddNewLog(idoc, CurrentContext.UserId);
                    idoc.MarkAsDeleted();
                    rdoc.Save();
                    rp.Save();
                    idoc.Save();
                    pld.Save();
                }
                else
                {
                    XtraMessageBox.Show(
                        "This delete is not successful because a free pick face location was not selected. please select a free location and try again.", "Error Deleteing issue transaction", MessageBoxButtons.OK, MessageBoxIcon.Error);

                }
//.........这里部分代码省略.........
开发者ID:USAID-DELIVER-PROJECT,项目名称:ethiopia-hcmis-warehouse,代码行数:101,代码来源:DispatchConfirmation.cs

示例14: DeleteToolStripMenuItem_Click

        /// <summary>
        /// Delete a row of adjustmen
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DeleteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var us = new User();
            var userID = MainWindow.LoggedinId;
            us.LoadByPrimaryKey(userID);

            var dataRow = gridView1.GetFocusedDataRow();
            if (dataRow == null) return;

            if (us.UserName != "admin")
            {
                XtraMessageBox.Show("You don't have the privilege to update reference number!", "Caution");
                return;
            }
            //get the primary key of the row
            var ID = Convert.ToInt32(dataRow["ID"]);

            var disposal = new Disposal();
            var receiveDoc = new ReceiveDoc();

            //Retrieve the adjustment with the value of the primary key(id)
            disposal.LoadByPrimaryKey(ID);

             int recieveID = disposal.RecID;

            receiveDoc.LoadByPrimaryKey(recieveID);
            if (XtraMessageBox.Show("Are You Sure, You want to delete this?", "Confirmation", MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Question) == DialogResult.Yes)
            {
                //check for losss

                if (disposal.Losses) //it was loss
                {
                    receiveDoc.LoadByPrimaryKey(recieveID);
                    var s = receiveDoc.Quantity;
                    receiveDoc.Quantity = receiveDoc.Quantity + disposal.Quantity;
                    receiveDoc.QuantityLeft = receiveDoc.QuantityLeft + disposal.Quantity;
                    if (receiveDoc.Out)
                        receiveDoc.Out = false;
                    disposal.Quantity = 0;
                }
                else // it was adjustment
                {
                    receiveDoc.LoadByPrimaryKey(recieveID);
                    var s = receiveDoc.Quantity;
                    receiveDoc.Quantity = receiveDoc.Quantity - disposal.Quantity;
                    receiveDoc.QuantityLeft = receiveDoc.QuantityLeft - disposal.Quantity;
                    if (receiveDoc.Quantity == 0)
                        receiveDoc.Out = true;
                    disposal.Quantity = 0;
                }

                // proceed deletion and make the necessary changes on the database tables.
                DisposalDelete ddel;
                AddDeletedDisposal(disposal, out ddel);

                receiveDoc.Save();
                disposal.MarkAsDeleted();
                disposal.Save();

                //Repopulate the grid
                DataTable dtRec;
                dtFrom.CustomFormat = "MM/dd/yyyy";
                dtTo.CustomFormat = "MM/dd/yyyy";
                DateTime from = ConvertDate.DateConverter(dtFrom.Text);
                DateTime to = ConvertDate.DateConverter(dtTo.Text);
                dtRec = disposal.GetTransactionByDateRange(Convert.ToInt32(cboStores.EditValue), from, to);
                gridAdjustments.DataSource = dtRec;
            }
        }
开发者ID:USAID-DELIVER-PROJECT,项目名称:ethiopia-hcmis-facility,代码行数:75,代码来源:LogAdjustment.cs

示例15: ReceiveFromAccountTransfer

 /// <summary>
 /// Receives from account transfer.
 /// </summary>
 /// <param name="PicklistID">The picklist ID.</param>
 /// <param name="StoreID">The store ID.</param>
 /// <param name="User">The user.</param>
 /// <param name="UserID">The user ID.</param>
 /// <returns></returns>
 public static String ReceiveFromAccountTransfer(int PicklistID, int StoreID, string User, int UserID)
 {
     PickListDetail pickListDetail = new PickListDetail();
     pickListDetail.LoadByPickListID(PicklistID);
     DataView dv = pickListDetail.DefaultView;
     ReceiveDoc NewReceiveDoc = new ReceiveDoc();
     String ReferenceID = ReceiveDoc.GetNextRefForTransfer();
     foreach (DataRowView dvr in dv)
     {
         //Get ReceiveDoc information.
         int receiveDocID = Convert.ToInt32(dvr["ReceiveDocID"]);
         ReceiveDoc receiveDocFromPicklist = new ReceiveDoc();
         receiveDocFromPicklist.LoadByPrimaryKey(receiveDocID);
         //We have all the Receivedoc information that we want
         NewReceiveDoc.AddNew();
         if (receiveDocFromPicklist.s_BatchNo == null)
             NewReceiveDoc.BatchNo = receiveDocFromPicklist.BatchNo;
         NewReceiveDoc.ItemID = receiveDocFromPicklist.ItemID;
         NewReceiveDoc.SupplierID = receiveDocFromPicklist.SupplierID;
         if (receiveDocFromPicklist.s_ExpDate == null)
             NewReceiveDoc.ExpDate = receiveDocFromPicklist.ExpDate;
         NewReceiveDoc.StoreID = StoreID;
         NewReceiveDoc.ReceivedBy = User;
         NewReceiveDoc.Remark = receiveDocFromPicklist.Remark;
         NewReceiveDoc.RefNo = "TA" + receiveDocFromPicklist.RefNo;
         if (!receiveDocFromPicklist.IsColumnNull("Cost"))
             NewReceiveDoc.Cost = receiveDocFromPicklist.Cost;
         NewReceiveDoc.ManufacturerId = receiveDocFromPicklist.ManufacturerId;
         NewReceiveDoc.Quantity = Convert.ToInt32(dvr["Packs"]) * Convert.ToInt32(dvr["QtyPerPack"]);
         NewReceiveDoc.NoOfPack = Convert.ToInt32(dvr["Packs"]);
         NewReceiveDoc.QtyPerPack = Convert.ToInt32(dvr["QtyPerPack"]);
         if (!receiveDocFromPicklist.IsColumnNull("PricePerPack"))
             NewReceiveDoc.PricePerPack = receiveDocFromPicklist.PricePerPack;
         if (!receiveDocFromPicklist.IsColumnNull("SellingPrice"))
             NewReceiveDoc.SellingPrice = receiveDocFromPicklist.SellingPrice;
         NewReceiveDoc.UnitID = receiveDocFromPicklist.UnitID;
         NewReceiveDoc.DeliveryNote = receiveDocFromPicklist.DeliveryNote;
         //NewReceiveDoc.PricePerPack = receiveDocFromPicklist.PricePerPack;
         NewReceiveDoc.QuantityLeft = Convert.ToInt32(dvr["Packs"]) * Convert.ToInt32(dvr["QtyPerPack"]);
         NewReceiveDoc.EurDate = DateTimeHelper.ServerDateTime;
         NewReceiveDoc.Date = EthiopianDate.EthiopianDate.Now.ToGregorianDate();
         NewReceiveDoc.IsDamaged = receiveDocFromPicklist.IsDamaged;
         NewReceiveDoc.Save();
         NewReceiveDoc.SetStatusAsReceived(UserID);
         PalletizeTransfer(NewReceiveDoc);
     }
     return ReferenceID;
 }
开发者ID:USAID-DELIVER-PROJECT,项目名称:ethiopia-hcmis-warehouse,代码行数:56,代码来源:ReceiveDoc.cs


注:本文中的BLL.ReceiveDoc.Save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。