public SDK_Configuracion_Salidas(decimal _idDocumento, SDK.Documentos.frmSalidas form) { tbl_Lines = new DataTable(); tbl_Items = new DataTable(); IdDocumento = _idDocumento; Form_Salidas = form; }
public decimal CrearSalidaDeMercancias(SDK.Documentos.frmSalidas form) { SAPbobsCOM.Documents oDocument = (SAPbobsCOM.Documents)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInventoryGenExit); #region Encabezado oDocument.DocDate = form.dtpDocDate.Value; oDocument.DocType = SAPbobsCOM.BoDocumentTypes.dDocument_Items; if (!string.IsNullOrEmpty(form.txtComentarios.Text)) { oDocument.Comments = form.txtComentarios.Text; } #endregion #region Detalle foreach (UltraGridRow row in form.dgvDatos.Rows) { if (!row.IsAddRow) { oDocument.Lines.ItemCode = Convert.ToString(row.Cells["ItemCode"].Value); oDocument.Lines.Quantity = Convert.ToDouble(row.Cells["Quantity"].Value); oDocument.Lines.WarehouseCode = Convert.ToString(row.Cells["WhsCode"].Value); oDocument.Lines.AccountCode = Convert.ToString(row.Cells["AcctCode"].Value); oDocument.Lines.CostingCode3 = Convert.ToString(row.Cells["OcrCode3"].Value); if (Convert.ToString(row.Cells["ManBtchNum"].Value).Equals("Y")) { foreach (DataRow item in this.Lotes(oDocument.Lines.ItemCode, oDocument.Lines.WarehouseCode, oDocument.Lines.Quantity).Rows) { oDocument.Lines.BatchNumbers.BatchNumber = item.Field <string>("BatchNum"); oDocument.Lines.BatchNumbers.Quantity = Convert.ToDouble(item["Quantity"]); oDocument.Lines.BatchNumbers.Add(); } } oDocument.Lines.Add(); } } #endregion if (oDocument.Add() != 0) { throw new Exception("Error [" + oCompany.GetLastErrorDescription() + "]"); } else { #region Datos SAP form.txtNumero.Text = oCompany.GetNewObjectKey(); oDocument.GetByKey(Convert.ToInt32(form.txtNumero.Text)); form.txtNumero.Text = oDocument.DocNum.ToString(); //if (SAPbobsCOM.BoStatus.bost_Close == oDocument.DocumentStatus) // form.txtStatus.Text = "Cerrado"; //else if (SAPbobsCOM.BoStatus.bost_Open == oDocument.DocumentStatus) // form.txtStatus.Text = "Abierto"; form.btnCrear.Enabled = false; #endregion } return(oDocument.DocNum); }