本文整理汇总了C#中BLL.ReceiveDoc.IsColumnNull方法的典型用法代码示例。如果您正苦于以下问题:C# ReceiveDoc.IsColumnNull方法的具体用法?C# ReceiveDoc.IsColumnNull怎么用?C# ReceiveDoc.IsColumnNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BLL.ReceiveDoc
的用法示例。
在下文中一共展示了ReceiveDoc.IsColumnNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FillInReceiveDocInformation
//.........这里部分代码省略.........
//TODO: Returned From Supplier: To be removed. This is an unacceptable hack.
rec.RefNo = lkSTVInvoiceNo.Text;
if (string.IsNullOrEmpty(txtRemark.Text))
{
XtraMessageBox.Show(
"Please enter the reason for the SRM.", "Error",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
throw new Exception("Reason not entered for SRM");
}
else
{
rec.Remark = txtRemark.Text;
}
}
rec.ReturnedStock = srm;
if (srm && !chkSRMForOldSystemIssues.Checked)
{
rec.ReturnedFromIssueDocID = int.Parse(dr["IssueDocID"].ToString());
int issueDocID = int.Parse(dr["IssueDocID"].ToString());
BLL.IssueDoc iss = new IssueDoc();
iss.LoadByPrimaryKey(issueDocID);
BLL.ReceiveDoc rd = new ReceiveDoc();
rd.LoadByPrimaryKey(iss.RecievDocID);
//If it was a delivery note, then the return will not have price information associated with it.
// HW-2189
decimal? UnitCost, SellingPrice, Margin;
UnitCost = SellingPrice = Margin = null;
if (!BLL.Settings.HandleGRV)
{
if (!iss.IsColumnNull("UnitCost") && iss.IsColumnNull("SellingPrice"))
{
UnitCost = iss.UnitCost;
SellingPrice = iss.SellingPrice;
Margin = !iss.IsColumnNull("Margin") ? iss.Margin : 0;
}
else if (!iss.IsColumnNull("Cost"))
{
Margin = !rd.IsColumnNull("Margin") ? Convert.ToDecimal(rd.Margin) : 0;
SellingPrice = Convert.ToDecimal(iss.Cost / Convert.ToDouble(iss.NoOfPack));
UnitCost = BLL.Settings.IsCenter ? SellingPrice : SellingPrice / Convert.ToDecimal(Margin + 1);
}
}
else
{
if (!iss.IsColumnNull("UnitCost") && iss.IsColumnNull("SellingPrice") && iss.UnitCost != 0 &&
iss.SellingPrice != 0)
{
UnitCost = iss.UnitCost;
SellingPrice = iss.SellingPrice;
Margin = !iss.IsColumnNull("Margin") ? iss.Margin : 0;
}
else if (!iss.IsColumnNull("Cost") && iss.Cost != 0)
{
Margin = !rd.IsColumnNull("Margin") ? Convert.ToDecimal(rd.Margin) : 0;
SellingPrice = Convert.ToDecimal(iss.Cost / Convert.ToDouble(iss.NoOfPack));
UnitCost = BLL.Settings.IsCenter ? SellingPrice : SellingPrice / Convert.ToDecimal(Margin + 1);
}
}
if (UnitCost.HasValue)
{
rec.PricePerPack = Convert.ToDouble(UnitCost);
示例2: ItemReceived
internal static int ItemReceived(int itemID, int storeId)
{
string query = string.Format("select sum(Quantity) as Quantity from ReceiveDoc rd where ItemID = {0} and StoreID = {1}", itemID, storeId);
ReceiveDoc rd = new ReceiveDoc();
rd.LoadFromRawSql(query);
if (rd.RowCount > 0 && !rd.IsColumnNull("Quantity") && rd.Quantity > 0)
{
return 1;
}
return 0;
}
示例3: SavePalletization
//, string guid)
private void SavePalletization(ReceiveDoc rec, DataRowView drow)
{
if ((rec.Quantity == 0 && !rec.IsColumnNull("ShortageReasonID") && rec.ShortageReasonID == ShortageReasons.Constants.NOT_RECEIVED) || (rec.Quantity == 0 && rec.IsColumnNull("ShortageReasonID")))
{
HandleFullNotReceivedAndMultipleBatchPalletlization(rec,drow);
return;
}
string guid;
BLL.ReceivePallet rp = new ReceivePallet();
Pallet pallet = new Pallet();
PalletLocation pl = new PalletLocation();
ItemUnit itemUnit = new ItemUnit();
BLL.ItemManufacturer im = new BLL.ItemManufacturer();
guid = rec.GetColumn("GUID").ToString();
var isDamaged = Convert.ToBoolean(rec.GetColumn("IsDamaged"));
//DataRow[] r = _dtPalletizedItemList.Select(string.Format("Index = '{0}'", i));
DataRow[] r =
_dtPalletizedItemList.Select(string.Format("GUID = '{0}' AND IsDamaged = {1}", guid, isDamaged));
if (r.Length > 0)
{
foreach (DataRow rw in r)
{
rp.AddNew();
rp.IsOriginalReceive = true;
if (Convert.ToBoolean(rw["Consolidate"]))
{
try
{
DataRow dr =
_dtPutAwayPalletized.Select(string.Format("PalletNumber={0}",
Convert.ToInt32(rw["PalletNumber"])))[0]; //Assuming we only need one.
if (rw["IsStoredInFreeStorageType"] != null)
{
if (Convert.ToBoolean(rw["IsStoredInFreeStorageType"]) == true)
{
pl.LoadByPrimaryKey(Convert.ToInt32(dr["PutAwayLocation"]));
}
}
}
catch
{
pl.LoadByPalletNumber(Convert.ToInt32(rw["PalletNumber"]));
}
try
{
rp.PalletID = pl.PalletID;
rp.PalletLocationID = pl.ID;
}
catch
{
rp.PalletID = GetPalletID(rw["PalletNumber"].ToString());
try
{
rp.PalletLocationID = PalletLocation.GetPalletLocationID(rp.PalletID);
}
catch
{
DataRow dr =
_dtPutAwayPalletized.Select(string.Format("PalletNumber={0}",
Convert.ToInt32(rw["PalletNumber"])))[0];
pl.LoadByPrimaryKey(Convert.ToInt32(dr["PutAwayLocation"]));
pl.PalletID = rp.PalletID;
pl.Save();
rp.PalletLocationID = pl.ID;
}
}
//// if the putaway is on a pick face, increase the amount stored on the pick face
//if (pl.StorageTypeID.ToString() == StorageType.PickFace)
//{
// PickFace pf = new PickFace();
// pf.LoadPickFaceFor(rec.ItemID, Convert.ToInt32(cboStores.EditValue));
// if (pf.RowCount > 0)
// {
// if (pf.IsColumnNull("Balance"))
// {
// pf.Balance = 0;
// }
// pf.Balance += Convert.ToInt32(rp.Balance);
// pf.Save();
// }
//}
}
else
{
var palletNumber = Convert.ToInt32(rw["PalletNumber"]);
DataRow dr = _dtPutAwayPalletized.Select(string.Format("PalletNumber={0}", palletNumber))[0];
//Assuming we only need one.
pl.LoadByPrimaryKey(Convert.ToInt32(dr["PutAwayLocation"]));
rp.PalletID = GetPalletID(rw["PalletNumber"].ToString());
pl.PalletID = rp.PalletID;
rp.PalletLocationID = pl.ID; //PalletLocation.GetPalletLocationID(rp.PalletID);
pl.Save();
}
//.........这里部分代码省略.........
示例4: FixDeliveryNoteCostReceiveDoc
/// <summary>
/// Fix For Delivery Note When Converting Do not use under any other situation
/// </summary>
/// <param name="issueDocID"></param>
/// <param name="picklistID"></param>
/// <returns></returns>
public PickListDetail FixDeliveryNoteCostReceiveDoc(int issueDocID, int picklistID)
{
IssueDoc issueDoc = new IssueDoc();
issueDoc.LoadByPrimaryKey(issueDocID);
PickListDetail pickList = new PickListDetail();
pickList.LoadByPrimaryKey(picklistID);
//safety first
if (issueDoc.RecievDocID != pickList.ReceiveDocID)
{
Item item = new Item();
item.LoadByPrimaryKey(picklistID);
throw new Exception(String.Format("PicklistDetail vs IssueDoc Inconsistancy for Item {0}", item.FullItemName));
}
// now we are sure we have one ReceiveDocID
ReceiveDoc receiveDoc = new ReceiveDoc();
receiveDoc.LoadByPrimaryKey(pickList.ReceiveDocID);
ReceiveDocConfirmation receiveDocConfirmation = new ReceiveDocConfirmation();
receiveDocConfirmation.LoadByReceiveDocID(receiveDoc.ID);
//Check if it has been Printed and that Selling Price and Cost is set
if (receiveDocConfirmation.ReceiptConfirmationStatusID == ReceiptConfirmationStatus.Constants.GRV_PRINTED)
{
double unitPrice, unitCost, margin;
if (Settings.IsCenter == true && !receiveDoc.IsColumnNull("Cost") && receiveDoc.Cost != 0)
{
unitPrice = Math.Round(receiveDoc.Cost, 2);
unitCost = Math.Round(receiveDoc.Cost, 2);
margin = !receiveDoc.IsColumnNull("Margin") ? receiveDoc.Margin : 0;
}
else if (!receiveDoc.IsColumnNull("SellingPrice") && receiveDoc.SellingPrice != 0)
{
unitPrice = Math.Round(receiveDoc.SellingPrice, 2);
unitCost = Math.Round(receiveDoc.SellingPrice, 2);
margin = !receiveDoc.IsColumnNull("Margin") ? receiveDoc.Margin : 0;
}
else
{
var item = new Item();
item.LoadByPrimaryKey(pickList.ItemID);
throw new Exception(String.Format("Price Not set For item: {0}", item.FullItemName));
}
pickList.UnitPrice = unitPrice;
pickList.Cost = Convert.ToDouble(pickList.Packs) * unitPrice;
issueDoc.SellingPrice = Convert.ToDecimal(unitPrice);
issueDoc.Cost = Convert.ToDouble(issueDoc.NoOfPack) * unitPrice;
issueDoc.UnitCost = Convert.ToDecimal(unitCost);
issueDoc.Margin = Convert.ToDecimal(margin);
pickList.Save();
issueDoc.Save();
}
else
{
var item = new Item();
item.LoadByPrimaryKey(pickList.ItemID);
throw new Exception(String.Format("GRV/IGRV Not Printed For Item: {0}", item.FullItemName));
}
return pickList;
}
示例5: 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();
}
示例6: EditReceive_Load
/// <summary>
/// Load the lookups and Prepare the form
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void EditReceive_Load(object sender, EventArgs e)
{
lkItemUnit.Enabled = VisibilitySetting.HandleUnits != 1;
var str = new Stores();
str.LoadAll();
cboStores.DataSource = str.DefaultView;
var sup = new Supplier();
sup.GetActiveSuppliers();
cboSupplier.DataSource = sup.DefaultView;
if(_tranId != 0)
{
var rec = new ReceiveDoc();
var itm = new Items();
rec.LoadByPrimaryKey(_tranId);
var dtItm = itm.GetItemById(rec.ItemID);
var units = new ItemUnit();
var unit = units.LoadFromSQl(rec.ItemID);
lkItemUnit.Properties.DataSource = unit;
lkItemUnit.Properties.DisplayMember = "Text";
lkItemUnit.Properties.ValueMember = "ID";
var programs = new Programs();
var allprograms = programs.GetSubPrograms();
lkPrograms.Properties.DataSource = allprograms;
lkPrograms.Properties.ValueMember = "ID";
lkPrograms.Properties.DisplayMember = "Name";
string itemName = dtItm.Rows[0]["ItemName"].ToString() + " - " + dtItm.Rows[0]["DosageForm"].ToString() + " - " + dtItm.Rows[0]["Strength"].ToString();
txtRefNo.Text = rec.RefNo;
txtBatchNo.Text = rec.BatchNo;
try
{
txtPack.Text = rec.NoOfPack.ToString();
txtQtyPack.Text =rec.QtyPerPack.ToString();
txtPrice.Text = (rec.Cost * rec.QtyPerPack).ToString();
//txtQuantityLeft.Text = rec.QuantityLeft.ToString();
}
catch
{
txtPack.Text = "0";
txtQtyPack.Text = "0";
txtPrice.Text = (rec.Cost * 1).ToString();
}
txtQuantity.Text = rec.Quantity.ToString();
lkPrograms.EditValue = rec.SubProgramID;
DateTime dtDate = Convert.ToDateTime(rec.Date.ToString("MM/dd/yyyy"));
txtDate.Text = dtDate.ToShortDateString();
dtRecDate.Value = DateTime.Now;
dtRecDate.CustomFormat = "MM/dd/yyyy";
if (!rec.IsColumnNull("ExpDate"))
dtExpiryDate.Value = rec.ExpDate;
cboStores.SelectedValue = rec.StoreID;
cboSupplier.SelectedValue = rec.SupplierID;
if (!rec.IsColumnNull("UnitID"))
lkItemUnit.EditValue = rec.UnitID;
txtItemName.Text = itemName;
txtReceivedBy.Text = rec.ReceivedBy;
txtRemark.Text = rec.Remark;
}
}
示例7: GeneratePickListDetail
internal static PickListDetail GeneratePickListDetail(ReceivePallet receivePallet, int pickListId,decimal qtyInBU)
{
ReceiveDoc receiveDoc = new ReceiveDoc();
receiveDoc.LoadByPrimaryKey(receivePallet.ReceiveID);
decimal pack = qtyInBU / Convert.ToDecimal(receiveDoc.QtyPerPack);
PickListDetail pkDetail = new PickListDetail();
pkDetail.AddNew();
pkDetail.PickListID = pickListId;
pkDetail.ItemID = receiveDoc.ItemID;
PalletLocation palletLocation = new PalletLocation();
palletLocation.loadByPalletID(receivePallet.PalletID);
int palletLocationId;
try
{
palletLocationId = palletLocation.ID;
}
catch (Exception exp)
{
palletLocationId = receivePallet.PalletLocationID;
palletLocation.LoadByPrimaryKey(palletLocationId);
}
pkDetail.PalletLocationID = palletLocationId;
if (!receiveDoc.IsColumnNull("BatchNo"))
pkDetail.BatchNumber = receiveDoc.BatchNo;
if (!receiveDoc.IsColumnNull("ExpDate"))
pkDetail.ExpireDate = receiveDoc.ExpDate;
pkDetail.StoreID = receiveDoc.StoreID;
pkDetail.UnitID = receiveDoc.UnitID;
pkDetail.ReceiveDocID = receiveDoc.ID;
if (!receiveDoc.IsColumnNull("Cost"))
{
pkDetail.Cost = Convert.ToDouble(pack) * Math.Round(receiveDoc.Cost, BLL.Settings.NoOfDigitsAfterTheDecimalPoint);
pkDetail.UnitPrice = Math.Round(receiveDoc.Cost, BLL.Settings.NoOfDigitsAfterTheDecimalPoint);
}
pkDetail.Packs = pack;
pkDetail.QtyPerPack = receiveDoc.QtyPerPack;
pkDetail.QuantityInBU = qtyInBU;
pkDetail.StoreID = receiveDoc.StoreID;
pkDetail.ReceivePalletID = receivePallet.ID;
pkDetail.ManufacturerID = receiveDoc.ManufacturerId;
pkDetail.BoxLevel = 0;
pkDetail.DeliveryNote = true;
pkDetail.PhysicalStoreID = palletLocation.PhysicalStoreID;
pkDetail.Save();
return pkDetail;
}
示例8: btnMoveToQuaranteen_Click
private void btnMoveToQuaranteen_Click(object sender, EventArgs e)
{
if (ValidateMoveToQuaranteen())
{
if (DialogResult.Yes == XtraMessageBox.Show("Are you sure you want to move the items to Quarantine", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
{
InternalItemMovements ims = new InternalItemMovements();
PalletLocation pl = new PalletLocation();
int printNubmer = InternalTransfer.GetNewPrintNumber() + 1 ;
for (int i = 0; i < gridView3.RowCount; i++)
{
DataRow dr = gridView3.GetDataRow(i);
if (dr["Loss"] != DBNull.Value)
{
int amount = Convert.ToInt32(dr["Loss"]);
int palletLocationID = Convert.ToInt32(dr["PalletLocationID"]);
ReceivePallet rp = new ReceivePallet();
ReceiveDoc rdoc = new ReceiveDoc();
rp.LoadByPrimaryKey(Convert.ToInt32(dr["ReceivePalletID"]));
rdoc.LoadByPrimaryKey(rp.ReceiveID);
amount *= rdoc.QtyPerPack;
if (rp.Balance - amount < rp.ReservedStock)
{
//Item has been reserved for a facility. This needs to be handled.
DataTable dtble = rp.GetFacilitiesItemsReservedFor();
string facilities = "";
foreach(DataRow dRow in dtble.Rows)
{
if (dr != null)
facilities += dRow["Name"].ToString() + System.Environment.NewLine;
}
XtraMessageBox.Show("You cannot fill in a loss because the item in this location has been reserved to the following facilities:" + System.Environment.NewLine + facilities, "Exisiting reservations must be cancelled", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}
var receiveDocID = Convert.ToInt32(dr["ID"]);
var rec = new ReceiveDoc();
rec.LoadByPrimaryKey(receiveDocID);
int qPalletLocationID = PalletLocation.GetQuaranteenPalletLocation(rec.PhysicalStoreID);
pl.LoadByPrimaryKey(qPalletLocationID);
if (pl.IsColumnNull("PalletID"))
{
Pallet p = new Pallet();
p.AddNew();
p.StorageTypeID = Convert.ToInt32( StorageType.Quaranteen);
p.Save();
pl.PalletID = p.ID;
pl.Save();
}
ReceivePallet rp2 = new ReceivePallet();
ReceiveDoc rd = new ReceiveDoc();
rd.LoadByPrimaryKey(rp.ReceiveID);
rp2.AddNew();
rp2.PalletID = pl.PalletID;
rp2.ReceiveID = rp.ReceiveID;
rp2.PalletLocationID = pl.ID;
// calculate the new balance
BLL.ItemManufacturer im = new BLL.ItemManufacturer();
//im.LoadDefaultReceiving(rd.ItemID, Convert.ToInt32(dr["ManufacturerID"]));
if (dr["BoxLevel"] == DBNull.Value)
{
dr["BoxLevel"] = 0;
}
im.LoadIMbyLevel(rd.ItemID, Convert.ToInt32(dr["ManufacturerID"]), Convert.ToInt32(dr["BoxLevel"]));
int packqty = (amount / im.QuantityInBasicUnit);
rp2.ReservedStock = 0;
BLL.ReceivePallet.MoveBalance(rp, rp2, amount);
//rp2.Balance = amount;
//rp.Balance -= rp2.Balance;
//rp.Save();
//rp2.Save();
pl.Confirmed = false;
pl.Save();
if (rp.Balance == 0 )
{
PalletLocation.GarbageCollection();
}
InternalTransfer it = new InternalTransfer();
it.AddNew();
it.ItemID = rd.ItemID;
it.BoxLevel = im.PackageLevel;
if (!rd.IsColumnNull("ExpDate"))
{
it.ExpireDate = rd.ExpDate;
}
it.BatchNumber = rd.BatchNo;
it.ManufacturerID = im.ManufacturerID;
it.FromPalletLocationID = palletLocationID;
//.........这里部分代码省略.........
示例9: btnAdjustments_Click
private void btnAdjustments_Click(object sender, EventArgs e)
{
if (ValidateMoveToAdjustments())
{
if (DialogResult.Yes == XtraMessageBox.Show("Are you sure you would like to commit this adjustment?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
{
PalletLocation pl = new PalletLocation();
Pallet p = new Pallet();
ReceiveDoc rdoc = new ReceiveDoc();
ReceivePallet rp = new ReceivePallet();
int printNubmer = InternalTransfer.GetNewPrintNumber() + 1 ;
for (int i = 0; i < gridView3.RowCount; i++)
{
DataRow dr = gridView3.GetDataRow(i);
if (dr["Adjust"] != DBNull.Value)
{
int amount = Convert.ToInt32(dr["Adjust"]);
rp.LoadByPrimaryKey(Convert.ToInt32(dr["ReceivePalletID"]));
rdoc.LoadByPrimaryKey(rp.ReceiveID);
rdoc.NoOfPack += amount;
amount *= rdoc.QtyPerPack;
rp.Balance += amount;
if (rp.IsColumnNull("ReceivedQuantity"))
{
rp.ReceivedQuantity = 0;
}
rp.ReceivedQuantity += amount;
rdoc.QuantityLeft += amount;
rdoc.Quantity += amount;
BLL.LossAndAdjustment d = new BLL.LossAndAdjustment();
d.AddNew();
d.GenerateRefNo();
d.ItemID = Convert.ToInt32(dr["ItemID"]);
d.ReasonId = Convert.ToInt32(dr["Reason"]);
d.RecID = rdoc.ID;
d.Quantity = amount;
d.BatchNo = rdoc.BatchNo;
CalendarLib.DateTimePickerEx edate = new CalendarLib.DateTimePickerEx();
edate.Value = DateTime.Today;
edate.CustomFormat = "MM/dd/yyyy";
d.Date = ConvertDate.DateConverter(edate.Text);
d.EurDate = DateTime.Today;
if (!rdoc.IsColumnNull("Cost"))
{
d.Cost = Math.Abs(rdoc.Cost*amount);
}
d.StoreId = rdoc.StoreID;
d.Losses = false;
d.ApprovedBy = CurrentContext.UserId.ToString();
d.Save();
rdoc.Save();
rp.Save();
}
}
PopulateItemDetails();
XtraMessageBox.Show("Items adjusted successfully.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
示例10: PopulateListToGrid
private void PopulateListToGrid()
{
_dtRecGrid = new DataTable();
var itm = new Items();
var rec = new ReceiveDoc();
_tabPage = 1;
tabControl1.SelectedTabPageIndex = 1;
if (_dtRecGrid.Columns.Count == 0)
{
string[] str = { "ID", "Stock Code", "Item Name", "Batch No", "Unit", "BU Qty", "Price", "Qty To Transfer", "RecID", "UnitID"};
foreach (string col in str)
{
_dtRecGrid.Columns.Add(col);
}
}
int count = 1;
foreach (DataRow dr in _dtSelectedTable.Rows)
{
rec.LoadByPrimaryKey(Convert.ToInt32(dr["ReceiveID"]));
int id = Convert.ToInt32(dr["ItemID"]);
double price = 0;
if (!rec.IsColumnNull("Cost"))
{
price = (rec.RowCount > 0) ? Convert.ToDouble(rec.Cost) * rec.QuantityLeft : 0;
}
DataTable dtItm = itm.GetItemById(id);
string itemName = dtItm.Rows[0]["FullItemName"].ToString();
object[] obj;
switch (VisibilitySetting.HandleUnits)
{
case 1:
obj = new object[]
{
id, dtItm.Rows[0]["StockCode"].ToString(),itemName, rec.BatchNo, dtItm.Rows[0]["Unit"].ToString(),rec.QuantityLeft, price, "",Convert.ToInt32(dr["ReceiveID"]),0};
break;
case 2:
obj = new object[]
{
id, dtItm.Rows[0]["StockCode"].ToString(),itemName, rec.BatchNo, dtItm.Rows[0]["Unit"].ToString(),rec.QuantityLeft, price, "",Convert.ToInt32(dr["ReceiveID"]),rec.UnitID
};
break;
default:
obj = new object[]
{
id, dtItm.Rows[0]["StockCode"].ToString(),itemName, rec.BatchNo, dtItm.Rows[0]["Unit"].ToString(),rec.QuantityLeft, price, "",Convert.ToInt32(dr["ReceiveID"]),rec.UnitID
};
break;
}
_dtRecGrid.Rows.Add(obj);
count++;
}
receivingGrid.DataSource =_dtRecGrid;
txtTranferFrom.Text = lkFromStore.Text;
}
示例11: btnCommit_Click
private void btnCommit_Click(object sender, EventArgs e)
{
if (ValidateQuarantine())
{
MyGeneration.dOOdads.TransactionMgr transaction = MyGeneration.dOOdads.TransactionMgr.ThreadTransactionMgr();
transaction.BeginTransaction();
if (DialogResult.Yes == XtraMessageBox.Show("Are you sure you want to commit the Loss and Adjustment on this screen?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
{
// do the actual commit here.
int printNubmer = InternalTransfer.GetNewPrintNumber() + 1;
PalletLocation pl = new PalletLocation();
Pallet p = new Pallet();
ReceiveDoc rdoc = new ReceiveDoc();
ReceivePallet rp = new ReceivePallet();
for (int i = 0; i < gridView1.RowCount; i++)
{
DataRow dr = gridView1.GetDataRow(i);
Double writeoff = 0;
Double reLocate = 0;
try
{
if (dr["WriteOff"] != DBNull.Value)
{
writeoff = Double.Parse(dr["WriteOff"].ToString());
}
if (dr["ReLocate"] != DBNull.Value)
{
reLocate = Double.Parse(dr["ReLocate"].ToString());
}
}
catch (Exception exc)
{
}
if(dr["WriteOff"] != DBNull.Value & writeoff>0)
{
if (Double.Parse(dr["WriteOff"].ToString()) > Double.Parse(dr["Balance"].ToString()))
{
XtraMessageBox.Show("Couldn't commit to the numbers you specified. Please specify number less than the balance.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
int writeoffAmout = Convert.ToInt32(dr["WriteOff"]);
int qtyPerPack = Convert.ToInt32(dr["QtyPerPack"]);
writeoffAmout *= qtyPerPack;
rp.LoadByPrimaryKey(Convert.ToInt32(dr["ReceivePalletID"]));
rdoc.LoadByPrimaryKey(rp.ReceiveID);
string x = dr["NewPalletLocation"].ToString();
rp.Balance -= writeoffAmout;
try
{
// rp.ReceivedQuantity -= writeoffAmout;
}
catch { }
rdoc.QuantityLeft -= writeoffAmout;
ReceivePallet nrp =new ReceivePallet();
nrp.AddNew();
nrp.ReceiveID = rp.ReceiveID;
nrp.PalletID = pl.GetpalletidbyPalletLocationOrgetnew(int.Parse(dr["NewPalletLocation"].ToString()));
//nrp.ReceivedQuantity = rp.ReceivedQuantity;
nrp.Balance = writeoffAmout;
nrp.ReservedStock = 0;
//nrp.ReserveOrderID = rp.ReserveOrderID;
nrp.BoxSize = rp.BoxSize;
nrp.PalletLocationID = int.Parse(dr["NewPalletLocation"].ToString());
nrp.IsOriginalReceive = rp.IsOriginalReceive;
BLL.LossAndAdjustment d = new BLL.LossAndAdjustment();
d.AddNew();
d.GenerateRefNo();
d.ItemID = Convert.ToInt32(dr["ItemID"]);
d.ReasonId = Convert.ToInt32(dr["Reason"]);
d.RecID = rdoc.ID;
d.Quantity = writeoffAmout;
d.BatchNo = rdoc.BatchNo;
CalendarLib.DateTimePickerEx edate = new CalendarLib.DateTimePickerEx();
edate.Value = DateTime.Today;
//TODO: fix to an ethiopian date here
edate.CustomFormat = "MM/dd/yyyy";
d.Date = ConvertDate.DateConverter(edate.Text);
d.EurDate = DateTime.Today;
d.Cost = rdoc.IsColumnNull("Cost")? 0: Math.Abs(rdoc.Cost * writeoffAmout);
d.StoreId = rdoc.StoreID;
d.Losses = true;
//todo:
d.ApprovedBy = CurrentContext.UserId.ToString();
//d.Remarks
InternalTransfer it =new InternalTransfer();
it.AddNew();
it.ItemID = d.ItemID;
it.FromPalletLocationID = pl.GetPalletLocationIDByPalletID(int.Parse(dr["PalletID"].ToString()));
it.ToPalletLocationID = nrp.PalletLocationID;
it.BatchNumber = d.BatchNo;
if (!rdoc.IsColumnNull("ExpDate"))
{
//.........这里部分代码省略.........
示例12: ReceiveDoc
//.........这里部分代码省略.........
foreach (string str in col)
{
dtbin.Columns.Add(str);
}
int i = 0;
Int64 bBalance = 0;
dtDate.Value = DateTime.Now;
dtDate.CustomFormat = "MM/dd/yyyy";
_dtCurrent = ConvertDate.DateConverter(dtDate.Text);
//bBalance = yEnd.GetBBalance(_year, _storeId, _itemId, _dtCurrent.Month);
bBalance = yEnd.GetBBalance(_year, _storeId, _itemId);
Int64 balanceAmount = bBalance;
DateTime dtT = new DateTime();
string balanceAm = "";
string ddDate = "";
string batNo = "";
foreach (DataRow dvRec in dtRec.Rows)
{
i++;
if (Convert.ToInt32(dvRec["Transact"]) == 1)
{
rec.LoadByPrimaryKey(Convert.ToInt32(dvRec["ID"]));
if (dvRec["Quantity"] == DBNull.Value)
{
dvRec["Quantity"] = 0;
}
balanceAmount = balanceAmount + Convert.ToInt64(dvRec["Quantity"]);
balanceAm = (balanceAmount > 0) ? balanceAmount.ToString("#,###") : "0";
itm.LoadByPrimaryKey(rec.ItemID);
if (itm.NeedExpiryBatch)
{
if (!rec.IsColumnNull("ExpDate"))
{
ddDate = rec.ExpDate.ToString("MMM dd,yyyy");
batNo = rec.BatchNo;
}
}
Supplier sup = new Supplier();
sup.LoadByPrimaryKey(rec.SupplierID);
object[] obj = { Convert.ToDateTime(dvRec["Date"]).ToString("MM dd,yyyy"), dvRec["RefNo"], Convert.ToInt64(dvRec["Quantity"]).ToString("#,###"), "", Convert.ToDouble(dvRec["Cost"]).ToString("C"), balanceAm, batNo, ddDate, sup.CompanyName };
dtbin.Rows.Add(obj);
//For stock Out
dtT = Convert.ToDateTime(dvRec["Date"]);
}
else if (Convert.ToInt32(dvRec["Transact"]) == 0)
{
iss.LoadByPrimaryKey(Convert.ToInt32(dvRec["ID"]));
try
{
rec.LoadByPrimaryKey(iss.RecievDocID);
}
catch
{
rec.GetTransactionByBatch(_itemId, dvRec["BatchNo"].ToString(), _storeId);
}
ReceivingUnits recUnit = new ReceivingUnits();
recUnit.LoadByPrimaryKey(iss.ReceivingUnitID);
string issuedTo = recUnit.Name;
balanceAmount = balanceAmount - Convert.ToInt64(dvRec["Quantity"]);
balanceAm = (balanceAmount > 0) ? balanceAmount.ToString("#,###") : "0";
itm.LoadByPrimaryKey(iss.ItemID);
示例13: 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;
}
示例14: gridReceiveView_FocusedRowChanged
private void gridReceiveView_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
{
// Bind the detail grid
PalletLocation pl = new PalletLocation();
if (e != null && e.PrevFocusedRowHandle < -1)
return;
string warehouseName = string.Empty;
try
{
var dr = gridReceiveView.GetFocusedDataRow();
if (dr == null)
return;
ReceiptID = Convert.ToInt32(dr["ReceiptID"]);
var receiptDoc = new BLL.Receipt();
var receipt = new BLL.Receipt();
receipt.LoadByPrimaryKey(ReceiptID);
receiptDoc.LoadByPrimaryKey(ReceiptID);
var GRNFDetail = receiptDoc.GetDetailsForGRNF();
if (GRNFDetail.Rows.Count > 0)
{
txtOrderNo.EditValue = dr["PONumber"] == DBNull.Value ? "-" : dr["PONumber"];
lblPONo.Text = (dr["PONumber"] == DBNull.Value ? "-" : dr["PONumber"].ToString());
lblCluster.Text = dr["ClusterName"] == DBNull.Value ? "-" : dr["ClusterName"].ToString();
txtWarehouse.EditValue = lblWarehouse.Text = warehouseName = dr["WarehouseName"] == DBNull.Value ? "-" : dr["WarehouseName"].ToString();
var receiptInvoice = new ReceiptInvoice(receiptDoc.ReceiptInvoiceID);
txtInvoiceNo.EditValue = lblInvoiceNo.Text = String.IsNullOrEmpty(receiptInvoice.STVOrInvoiceNo) ? "-" : receiptInvoice.STVOrInvoiceNo;
txtInsurance.EditValue = lblInsurancePolicy.Text = String.IsNullOrEmpty(receiptInvoice.InsurancePolicyNo) ? "-" : receiptInvoice.InsurancePolicyNo;
txtTransfer.EditValue = lblTransferVoucherNo.Text = String.IsNullOrEmpty(receipt.TransitTransferNo) ? "-" : receipt.TransitTransferNo;
txtWayBill.EditValue = lblWayBill.Text = String.IsNullOrEmpty(receiptInvoice.WayBillNo) ? "-" : receiptInvoice.WayBillNo;
var activity = new Activity();
activity.LoadByPrimaryKey(Convert.ToInt32(dr["StoreID"]));
txtActivity.EditValue = activity.FullActivityName;
lblActivity.Text = String.IsNullOrEmpty(activity.Name) ? "-" : activity.Name;
lblSubAccount.Text = String.IsNullOrEmpty(activity.SubAccountName) ? "-" : activity.SubAccountName;
lblAccount.Text = String.IsNullOrEmpty(activity.AccountName) ? "-" : activity.AccountName;
lblMode.Text = String.IsNullOrEmpty(activity.ModeName) ? "-" : activity.ModeName;
lblReceiveType.Text = dr["ReceiptType"] == DBNull.Value ? "-" : dr["ReceiptType"].ToString();
lblReceiveStatus.Text = dr["Status"] == DBNull.Value ? "-" : dr["Status"].ToString();
lblDocumentType.Text = dr["DocumentType"] == DBNull.Value ? "-" : dr["DocumentType"].ToString();
lblPOType.Text = dr["POType"] == DBNull.Value ? "-" : dr["POType"].ToString();
lblPaymentType.Text = dr["PaymentType"] == DBNull.Value ? "-" : dr["PaymentType"].ToString();
lblReceiptNo.Text = dr["ReceiptNo"] == DBNull.Value ? "-" : dr["ReceiptNo"].ToString();
lblSupplier.Text = dr["Supplier"] == DBNull.Value ? "-" : dr["Supplier"].ToString();
var user = new User();
user.LoadByPrimaryKey(receiptDoc.SavedByUserID);
lblReceivedBy.Text = String.IsNullOrEmpty(user.FullName) ? "-" : user.FullName;
var receiveDoc = new ReceiveDoc();
receiveDoc.LoadByReceiptID(ReceiptID);
lblReceivedDate.Text = receiptDoc.IsColumnNull("DateOfEntry") ? "-" :receiveDoc.EurDate.ToShortDateString();
lblConfirmedDate.Text = receiveDoc.IsColumnNull("ConfirmedDateTime") ? "-" : receiveDoc.ConfirmedDateTime.ToShortDateString();
if (!receiveDoc.IsColumnNull("ConfirmedByUserID"))
{
user.LoadByPrimaryKey(receiveDoc.ConfirmedByUserID);
lblConfirmedBy.Text = String.IsNullOrEmpty(user.FullName) ? "-" : user.FullName;
}
else
{
lblConfirmedBy.Text = "-";
}
var space = string.Empty;
var length = warehouseName.Length;
HeaderGroup.Text = warehouseName + space.PadRight(180 - length) + "Invoice No: " + receiptInvoice.STVOrInvoiceNo;
}
gridDetails.DataSource = GRNFDetail;
gridShortage.DataSource = receiptDoc.GetDiscrepancyForGRNF();
}
catch
{
gridDetails.DataSource = null;
}
}
示例15: HandleFullNotReceivedAndMultipleBatchPalletlization
/// <summary>
/// This method handles Receive of an Item with full NotReceived Reason
/// </summary>
/// <param name="rec"></param>
/// <param name="dr"></param>
private void HandleFullNotReceivedAndMultipleBatchPalletlization(ReceiveDoc rec,DataRowView dr)
{
DataRow firstEntry = null;
bool noSoundItems = false;
// Here: We Can Use One of the Items on a receipt //
if ((rec.Quantity == 0 && !rec.IsColumnNull("ShortageReasonID") &&
rec.ShortageReasonID == ShortageReasons.Constants.NOT_RECEIVED))
{
firstEntry =
rec.DefaultView.Table.Select(String.Format("[ID] > 0 AND [IsDamaged] = 0")).FirstOrDefault();
}
//~ This is a multiple batch case ~//
if ((rec.Quantity == 0 && rec.IsColumnNull("ShortageReasonID")))
{
var oneAmongMultipleBatchsAndDbSavedGuid =
_dtRecGrid.Select(string.Format("CopyGUID = '{0}' And IsCopied = 1 ", dr["CopyGUID"]));
DataRow[] dbSavedcounts = oneAmongMultipleBatchsAndDbSavedGuid.Any()
? rec.DefaultView.Table.Select(String.Format("GUID = '{0}'",
oneAmongMultipleBatchsAndDbSavedGuid[0]["GUID"]))
: oneAmongMultipleBatchsAndDbSavedGuid;
firstEntry = dbSavedcounts.Any()
? dbSavedcounts.FirstOrDefault()
: rec.DefaultView.Table.Select(String.Format("[ID] > 0 AND [IsDamaged] = 0")).FirstOrDefault();
}
// If we cant find any normal receive in this receipt let's just use one of receiveDocID's randomly: This is just to save a not received Entry with zero quantity! (an awful recent request!)~//
if (firstEntry == null && ((rec.Quantity == 0 && !rec.IsColumnNull("ShortageReasonID") &&
rec.ShortageReasonID == ShortageReasons.Constants.NOT_RECEIVED)))
{
firstEntry =
rec.DefaultView.Table.Select(String.Format("[ID] > 0")).FirstOrDefault();
if (firstEntry != null)
{
noSoundItems = true;
}
}
// This is a Zero Quantity ReceiveDoc //
if (firstEntry != null)
{
rec.PhysicalStoreID = Convert.ToInt16(firstEntry["PhysicalStoreID"]);
rec.InventoryPeriodID = Convert.ToInt16(firstEntry["InventoryPeriodID"]);
rec.Save();
// Lets Create a Zero ReceivePallet in the same palletlocation as one of the Items in the receipt //
var oneOfrecievePallet = new BLL.ReceivePallet();
oneOfrecievePallet.LoadByReceiveDocID(Convert.ToInt16(firstEntry["ID"]));
var newReceivePallet = new BLL.ReceivePallet();
newReceivePallet.AddNew();
newReceivePallet.IsOriginalReceive = true;
newReceivePallet.ReceiveID = rec.ID;
newReceivePallet.Balance = newReceivePallet.ReceivedQuantity = newReceivePallet.ReservedStock = 0;
newReceivePallet.PalletID = oneOfrecievePallet.PalletID;
newReceivePallet.PalletLocationID = oneOfrecievePallet.PalletLocationID;
newReceivePallet.BoxSize = oneOfrecievePallet.BoxSize;
newReceivePallet.Save();
}
if (!rec.IsColumnNull("ShortageReasonID") && rec.ShortageReasonID == BLL.ShortageReasons.Constants.NOT_RECEIVED)
{
var recShortage = new ReceiveDocShortage();
recShortage.AddNew();
recShortage.ShortageReasonID = rec.ShortageReasonID;
recShortage.ReceiveDocID = rec.ID;
recShortage.NoOfPacks = Convert.ToDecimal(dr["InvoicedQty"]);
recShortage.Save();
}
}