public static int GetNextSequenceNo(int documentTypeId, int accountId, int fiscalYearId) { int sequenceNo; System.Collections.Specialized.ListDictionary Parms = new System.Collections.Specialized.ListDictionary(); Parms.Add("@DocumentTypeID", documentTypeId); Parms.Add("@AccountID", accountId); Parms.Add("@FiscalYearID", fiscalYearId); Parms.Add("@SequenceNo", 0); DocumentType documentType = new DocumentType(); documentType.LoadFromSql("[sp_GetNextSequence]", Parms, CommandType.StoredProcedure); sequenceNo = documentType.Getint("SequenceNo"); return sequenceNo; }
public static DataTable GetDocumentTypesByPOType(int poTypeID) { var documentType = new DocumentType(); var query = HCMIS.Repository.Queries.DocumentType.SelectGetDocumentTypesByPOType(poTypeID); documentType.LoadFromRawSql(query); return documentType.DataTable; }
public static DocumentType GetDocumentType(int documentTypeID) { var documentType = new DocumentType(); documentType.Where.DocumentTypeID.Value = documentTypeID; documentType.LoadByDocumentByID(); return documentType; }
public static DocumentType GetDocumentType(string documentTypeCode) { var documentType = new DocumentType(); documentType.Where.DocumentCode.Value = documentTypeCode; documentType.LoadByDocumentCode(); return documentType; }
private void lkReceiptInvoice_EditValueChanged(object sender, EventArgs e) { ResetFields(); if (lkReceiptInvoice.EditValue != null) { if ((standardRecType == StandardReceiptType.iGRVOnline || deliveryNoteType == DeliveryNoteType.Automatic) && lkReceiptInvoice.EditValue.Equals(-1)) { HandleReceiptTypeChange(true); return; } if (standardRecType == StandardReceiptType.iGRV && !lkReceiptInvoice.EditValue.Equals(-1)) { //This means, the hub has chosen an invoice other than "Not Found" from the list of invoices. Therefore, we want to change the receipt type to be iGRV-Online. HandleReceiptTypeChange(); } BLL.ReceiptInvoice rctInvoice = new ReceiptInvoice(); rctInvoice.LoadByPrimaryKey(Convert.ToInt32(lkReceiptInvoice.EditValue)); var po = new PO(); po.LoadByPrimaryKey(rctInvoice.POID); if (po.IsElectronic == true) { rdIsElectronic.Checked = true; lblSyncDate.Text = rctInvoice.DateOfEntry.ToShortDateString(); txtPassCode.Enabled = true; lcPassCode.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; } else { rdIsElectronic.Checked = false; lblSyncDate.Text = "-"; txtPassCode.Enabled = false; lcPassCode.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; } lblOrderNo.Text = po.PONumber; lblOrderNum.Text = po.PONumber; if (!rctInvoice.IsColumnNull("DocumentTypeID")) { var doctype = new BLL.DocumentType(); doctype.LoadByPrimaryKey(rctInvoice.DocumentTypeID); lblDeliveryNote.Text = doctype.Name; lblHeaderDoc.Text = doctype.Name; } else { lblDeliveryNote.Text = "-"; lblHeaderDoc.Text = "-"; } var mode = new Mode(); mode.LoadByPrimaryKey(po.ModeID); lblMode.Text = mode.TypeName; lblAccount.Text = "-"; lblSubAccount.Text = "-"; lblActivity.Text = "-"; lblReferenceNo.Text = po.RefNo; var payment = new PaymentType(); payment.LoadByPrimaryKey(po.PaymentTypeID); lblPaymentType.Text = payment.Name; lblHeaderPayment.Text = payment.Name; //if (po.IsColumnNull("NBE")) //{ // lblNebService.Text = Convert.ToString(po.NBE); //} //else //{ // lblNebService.Text = "-"; //} if (po.Remaining != -1) lblRemainingValue.Text = po.Remaining.ToString(); else lblRemainingValue.Text = "-"; if (po.TotalValue != -1) lblTotalValue.Text = po.Remaining.ToString(); else lblTotalValue.Text = "-"; if (po.Insurance != -1) lblChargeInsurance.Text = po.Insurance.ToString(); else lblChargeInsurance.Text = "-"; if (po.NBE != -1) lblNebService.Text = po.NBE.ToString(); else lblNebService.Text = "-"; lblOrderDate.Text = po.PODate.ToShortDateString(); lblReceiptDate.Text = rctInvoice.DateOfEntry.ToShortDateString(); var user = new User(); user.LoadByPrimaryKey(po.SavedbyUserID); lblOrderBy.Text = user.FullName; var sup = new Supplier(); lkAccounts.EditValue = rctInvoice.ActivityID; var act = new Activity(); act.LoadByPrimaryKey(rctInvoice.ActivityID); _supplierID = rctInvoice.GetSupplier(); sup.LoadByPrimaryKey(_supplierID); lblSupplier.Text = sup.CompanyName; lblOrdSup.Text = sup.CompanyName; lblInvoiceNo.Text = rctInvoice.STVOrInvoiceNo; lblInvAccount.Text = act.AccountName ?? "-"; lblInvActivity.Text = act.Name ?? "-"; lblAct.Text = act.FullActivityName ?? "-"; lblInvSubAccount.Text = act.SubAccountName ?? "-"; lblInvMode.Text = act.ModeName ?? "-"; lblInvTotalValue.Text = rctInvoice.TotalFOBValue.ToString("N"); lblInsurancePolicy.Text = rctInvoice.InsurancePolicyNo == " "? rctInvoice.InsurancePolicyNo : "-"; var poType = new POType(); poType.LoadByPrimaryKey(po.PurchaseType); lblOrderType.Text = poType.Name ?? "-"; lblPOType.Text = poType.Name ?? "-"; var poStatus = new PurchaseOrderStatus(); poStatus.LoadByPrimaryKey(po.PurchaseOrderStatusID); lblOrderStatus.Text = poStatus.Name ?? "-"; var it = new InvoiceType(); it.LoadByPrimaryKey(rctInvoice.InvoiceTypeID); lblInvType.Text = it.Name; lblInvDate.Text = rctInvoice.DateOfEntry.ToShortDateString(); mode.LoadByPrimaryKey(rctInvoice.ActivityID); lblWayBillNo.Text = rctInvoice.WayBillNo; txtTransitTransferVoucherNo.Text = rctInvoice.TransitTransferNo; txtEditTransferNo.Text = rctInvoice.TransitTransferNo; lblInsurancePolicyNo.Text = rctInvoice.InsurancePolicyNo; BLL.PO order = new PO(); order.LoadByPrimaryKey(rctInvoice.POID); lblRefNo.Text = order.RefNo; lblPoNo.Text = order.PONumber; DataTable relatedReceives = rctInvoice.GetRelatedReceives(); hasPreviousReceive = false; if (relatedReceives.Rows.Count > 0) { XtraMessageBox.Show( "The Invoice you have selected has previous associated receives", "Invoice Detail", MessageBoxButtons.OK, MessageBoxIcon.Warning); colSelectedManufactuerer.Visible = true; colSelectedUnit.Visible = true; colSelectionLineNo.Visible = true; colSelectedReceiveQty.Visible = true; colSelectedInvoiceQty.Visible = true; hasPreviousReceive = true; gridItemsChoice.Enabled = false; colRemainingQty.VisibleIndex = 9; lcItemChoiceGrid.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; _dtSelectedTable = relatedReceives.Clone(); gridSelected.DataSource = _dtSelectedTable; foreach (DataRow dr in relatedReceives.Rows) { SelectAnItem(dr); } } else { hasPreviousReceive = false; colSelectedManufactuerer.Visible = false; colSelectedUnit.Visible = false; colSelectionLineNo.Visible = false; colSelectedReceiveQty.Visible = false; colSelectedInvoiceQty.Visible = false; colRemainingQty.Visible = false; gridItemsChoice.Enabled = true; lcItemChoiceGrid.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; } if (lkAccounts.EditValue != null) { // lcInvoiceDetail.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; } if (standardRecType == StandardReceiptType.iGRVOnline || standardRecType == StandardReceiptType.GRV || deliveryNoteType == DeliveryNoteType.Automatic) { if (!hasPreviousReceive) LoadItemsFromTransferredReceiptInvoiceDetail(rctInvoice.ID); txtRefNo.Text = lkReceiptInvoice.Text; colSelectedReceiveQty.Visible = true; lcItemChoiceGrid.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; lkAccounts.Enabled = false; } else { lkAccounts.Enabled = !BLL.Settings.IsCenter; } if(!BLL.Settings.IsCenter) { //Passcode Textbox var dataRowView = lkReceiptInvoice.GetSelectedDataRow() as DataRowView; if (dataRowView != null) _isElectronic = Convert.ToBoolean(dataRowView["IsElectronic"]); lcPassCode.Visibility = (!_isNonElectronicReceiveOnly) && (_isElectronic) && (standardRecType == StandardReceiptType.iGRVOnline || deliveryNoteType == DeliveryNoteType.Automatic) ? LayoutVisibility.Always : LayoutVisibility.Never; txtPassCode.Text = "HHMM"; } } }
/// <summary> /// Handles the FocusedRowChanged event of the gridViewReferences control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs" /> instance containing the event data.</param> private void gridViewReferences_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { if (e != null && e.PrevFocusedRowHandle < -1) return; dtDate.Value = DateTimeHelper.ServerDateTime; _reprintId = null; DataRow dr = gridViewReferences.GetFocusedDataRow(); if (dr == null) { return; } string[] referenceNo = new string[2]; referenceNo[0] = dr["RefNo"].ToString(); if (Convert.ToBoolean(dr["isConvertedDN"])) { _isConvertedDn = true; _stvLogIdChosen = (int?)dr["IsReprintOf"]; } else if (dr != null && dr["ID"] != DBNull.Value) { _isConvertedDn = false; _stvLogIdChosen = (int?)dr["ID"]; } UpdateReprintedNumbers(dr); // Enable and disable STV reprint // STV SHouldn't be reprinted off a reprint. if (dr["IsReprintOf"] != DBNull.Value && !Convert.ToBoolean(dr["isConvertedDN"])) { btnExport.Enabled = btnReprint.Enabled = false; var permission = (BLL.Settings.UseNewUserManagement) ? this.HasPermission("Print") : true; btnPrint.Enabled = permission; _reprintId = _stvLogIdChosen; _stvLogIdChosen = Convert.ToInt32(dr["IsReprintOf"]); } else if (dr["IsDeliveryNote"] != DBNull.Value && Convert.ToBoolean(dr["IsDeliveryNote"])) { btnExport.Enabled = false; btnReprint.Enabled = (BLL.Settings.UseNewUserManagement) ? this.HasPermission("Re-Print") : true; btnPrint.Enabled = false; } else { btnPrint.Enabled = this.HasPermission("Print"); btnReprint.Enabled = this.HasPermission("Re-Print"); btnExport.Enabled = this.HasPermission("Export"); } if (_stvLogIdChosen != null) { Issue log = new Issue(); log.LoadByPrimaryKey(_stvLogIdChosen.Value); Institution rus = new Institution(); IssueDoc iss = new IssueDoc(); if (!log.IsColumnNull("ReceivingUnitID")) { rus.LoadByPrimaryKey(log.ReceivingUnitID); //FacilityName.Text = rus.Name; HeaderSection.Text = rus.Name; var activity = new Activity(); activity.LoadByPrimaryKey(log.StoreID); lblActivity.Text = activity.Name; lblSubAccount.Text = activity.SubAccountName; lblMode.Text = activity.ModeName; lblAccount.Text = activity.AccountName; lblRegion.Text = rus.RegionName; lblWoreda.Text = rus.WoredaName; lblZone.Text = rus.ZoneName; lblInstType.Text = rus.InstitutionTypeName; var ownership = new OwnershipType(); ownership.LoadByPrimaryKey(rus.Ownership); lblOwnership.Text = ownership.Name; lblVoidConDate.Text = (dr["approvalDate"]) != DBNull.Value ? Convert.ToDateTime(dr["approvalDate"]).ToShortDateString(): "-"; lblIssueType.Text = (string)dr["OrderType"]; User user = new User(); if (dr["approvedBy"] != DBNull.Value) { user.LoadByPrimaryKey(Convert.ToInt32(dr["approvedBy"])); lblConfirmedBy.Text = user.FullName; } else { lblConfirmedBy.Text = "-"; } var doc = new DocumentType(); doc.LoadByPrimaryKey(log.DocumentTypeID); lblDocType.Text = doc.Name; lblPrintedDate.Text = log.PrintedDate.ToShortDateString(); var pt = new PaymentType(); if (!rus.IsColumnNull("PaymentTypeID")) { pt.LoadByPrimaryKey(rus.PaymentTypeID); lblPaymentType.Text = pt.Name; } else { lblPaymentType.Text = "-"; } // Show user name user.LoadByPrimaryKey(log.UserID); lblPrintedBy.Text = (user.FullName == "") ? user.UserName : user.FullName; // show contact person PickList pl = new PickList(); pl.LoadByPrimaryKey(log.PickListID); Order order = new Order(); order.LoadByPrimaryKey(pl.OrderID); var os = new OrderStatus(); os.LoadByPrimaryKey(order.OrderStatusID); lblIssueStatus.Text = os.OrderStatus; if (!order.IsColumnNull("ContactPerson")) { lblRecivedBy.Text = order.ContactPerson; } else { lblRecivedBy.Text = @"-"; } lblReceivedDate.Text = order.EurDate.ToShortDateString(); } dtDate.Value = log.PrintedDate; //PrintedDate.Text = dtDate.Text; lblPrintedDate.Text = dtDate.Text; gridTransactions.DataSource = iss.GetIssueBySTV(_stvLogIdChosen.Value); layoutUnconfirmedSTVs.Visibility = LayoutVisibility.Never; if (BLL.Settings.ShowMissingSTVsOnIssueLog) { DataView view = iss.GetPossibleUnconfirmedIssues(_stvLogIdChosen.Value); if (view.Count > 0) { gridUnconfirmed.DataSource = view; layoutUnconfirmedSTVs.Visibility = LayoutVisibility.Always; } else { layoutUnconfirmedSTVs.Visibility = LayoutVisibility.Never; } } } }