3.0.1.2 Requirements & tidy
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Microsoft.AspNetCore.Html;
|
||||
using DocumentFormat.OpenXml.Drawing;
|
||||
using Microsoft.AspNetCore.Html;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
using Sacs.Web.Components;
|
||||
using Sarand.BusinessMgr.Net.Core.Web.App;
|
||||
@@ -71,6 +72,16 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Components
|
||||
// Page configuration.
|
||||
public string InstanceVersion { get { return !App.AppConfig.Instance.IsEmpty() ? App.AppConfig.Instance + " v" + Sbm.Version.GetFullVersion() : "v" + Sbm.Version.GetAppVersion(); } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Text & localisation.
|
||||
public override String GetText(String textKey, String defaultText)
|
||||
{
|
||||
String text = Localiser[textKey];
|
||||
if (StringUtil.IsBlank(text) || text.EqualsCI(textKey))
|
||||
return defaultText;
|
||||
return text;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Business components.
|
||||
// NB Keep these accessors protected to avoid them being called by the model binding logic before the session data is ready.
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
public static class Version
|
||||
{
|
||||
private static String version { get; } = "3.0.1.1";
|
||||
private static String version { get; } = "3.0.1.2";
|
||||
// Retrieve version.
|
||||
public static String GetFullVersion() { return version; }
|
||||
public static String GetAppVersion()
|
||||
@@ -39,6 +39,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
// 3.0.1 19-Feb-25 Portal Transactions.
|
||||
// 3.0.1.1 19-Feb-25 Portal tidy.
|
||||
// 3.0.1.2 26-Feb-25 Requirements & tidy.
|
||||
//-------------------------------------------------------------------
|
||||
// 3.0.0 Jul-2021 Initial demo test version.
|
||||
// 02-Feb-25 Initial live deployment.
|
||||
|
||||
@@ -1783,6 +1783,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
public enum RequirementType
|
||||
{
|
||||
Any = 0,
|
||||
Unknown = Any,
|
||||
Detail = 1,
|
||||
Job = 2,
|
||||
}
|
||||
|
||||
@@ -21,10 +21,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
Unknown,
|
||||
Pos,
|
||||
Id,
|
||||
//Requirement.
|
||||
TransId,
|
||||
Owner_Name,
|
||||
// Requirement code
|
||||
// Association.
|
||||
Assoc_Code,
|
||||
Assoc_AccountManagerCode, Assoc_AccountManagerDesc,
|
||||
Assoc_AccountHandlerCode, Assoc_AccountHandlerDesc,
|
||||
@@ -32,7 +30,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
Assoc_Target_PhoneMain,
|
||||
Assoc_Target_PhoneAlt,
|
||||
// Transaction details
|
||||
Trans_TypeDesc, Trans_Ref, Trans_RefExt, Trans_DescBrief,
|
||||
TransId,
|
||||
Trans_Type, Trans_TypeDesc, Trans_Ref, Trans_RefExt, Trans_DescBrief,
|
||||
Trans_ContactName,
|
||||
Trans_Likelihood,
|
||||
Trans_Raised,
|
||||
@@ -89,9 +88,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
Trans_DeliveryAddress_Line1, Trans_DeliveryAddress_Line2, Trans_DeliveryAddress_Line3,
|
||||
Trans_DeliveryAddress_City, Trans_DeliveryAddress_Province, Trans_DeliveryAddress_Postcode,
|
||||
Trans_DeliveryAddress_Phone, Trans_DeliveryAddress_Email,
|
||||
Trans_SourceTrans_Ref, // Source transaction reference.
|
||||
//Relation to items
|
||||
Seq,
|
||||
Trans_SourceTrans_Ref, /* Source transaction reference. */
|
||||
// Requirement.
|
||||
Type,
|
||||
Sequence,
|
||||
Started, StartedTime, Started_Day,
|
||||
Required, RequiredTime, Required_Fmt, // Formatted 'Required' date (eg. square brackets around defaulted date).
|
||||
Completed, CompletedTime,
|
||||
@@ -1147,7 +1147,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
{
|
||||
case Column.Id:
|
||||
return new DataValue((long)SysId.ToInt(data.Id));
|
||||
case Column.Seq:
|
||||
case Column.Sequence:
|
||||
return new DataValue(data.Seq);
|
||||
case Column.Required:
|
||||
return new DataValue(data.Required);
|
||||
@@ -1235,22 +1235,22 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public SysId CommodityId { get; set; }
|
||||
public SysId AssetId { get; set; }
|
||||
// Requirement.
|
||||
public HashSet<SysId> RequirementIdsIncluded { get; } = new HashSet<SysId>();
|
||||
public HashSet<SysId> RequirementIdsExcluded { get; } = new HashSet<SysId>();
|
||||
public HashSet<SysId> IdsIncluded { get; } = new HashSet<SysId>();
|
||||
public HashSet<SysId> IdsExcluded { get; } = new HashSet<SysId>();
|
||||
public HashSet<SysId> RequirementIdsSource { get; } = new HashSet<SysId>();
|
||||
public String RequirementProductCodeFull { get; set; }
|
||||
public String RequirementProductCodePartial { get; set; }
|
||||
public String Search { get; set; }
|
||||
public String ProductCodeFull { get; set; }
|
||||
public String ProductCodePartial { get; set; }
|
||||
// Stored as product code for 'Project' transactions (populating this value will force the transaction type).
|
||||
public String RequirementProjectTaskCodeFull { get; set; }
|
||||
public String RequirementProjectTaskCodePartial { get; set; }
|
||||
public String RequirementJobNumberFull { get; set; }
|
||||
public String RequirementJobNumberPartial { get; set; }
|
||||
public String RequirementAssetSerialFull { get; set; }
|
||||
public String RequirementAssetSerialPartial { get; set; }
|
||||
public String RequirementDescBrief { get; set; }
|
||||
public String RequirementPromotionCode { get; set; }
|
||||
public String ProjectTaskCodeFull { get; set; }
|
||||
public String ProjectTaskCodePartial { get; set; }
|
||||
public String JobNumberFull { get; set; }
|
||||
public String JobNumberPartial { get; set; }
|
||||
public String AssetSerialFull { get; set; }
|
||||
public String AssetSerialPartial { get; set; }
|
||||
public String DescBrief { get; set; }
|
||||
public String PromotionCode { get; set; }
|
||||
// Transaction.
|
||||
public String AliasTransaction { get; set; }
|
||||
public HashSet<SysId> TransactionIdsIncluded { get; } = new HashSet<SysId>();
|
||||
public HashSet<SysId> TransactionIdsExcluded { get; } = new HashSet<SysId>();
|
||||
public SysId TransactionRequirementSourceId { get; set; } // Identifies the transaction to which the source requirement belongs.
|
||||
@@ -1283,7 +1283,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
// Stock by Sales Locations.
|
||||
public SysId SalesLocationIdStock01 { get; set; }
|
||||
public SysId SalesLocationIdStock02 { get; set; }
|
||||
public SysId SalesLocationIdStock03;
|
||||
public SysId SalesLocationIdStock03 { get; set; }
|
||||
// Required date.
|
||||
public DateTime RequirementRequiredFrom { get; set; }
|
||||
public DateTime RequirementRequiredTo { get; set; }
|
||||
@@ -1293,6 +1293,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public String NotesPartial { get; set; }
|
||||
/// <summary>Requirement status.</summary>
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.Default;
|
||||
// Table aliases joined in query.
|
||||
public String AliasTransaction { get; set; }
|
||||
public String AliasCommodity { get; set; }
|
||||
public String AliasAsset { get; set; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -1001,54 +1001,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
return false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
public bool RefreshTotals(List<SbmRequirement> requirements)
|
||||
{
|
||||
return RefreshTotals(requirements.ToDataList());
|
||||
}
|
||||
public bool RefreshTotals(List<SbmRequirement.Data> requirements)
|
||||
{
|
||||
// Recalculate the amounts stored against the transaction in line with the list of requirements.
|
||||
ClearErrorState();
|
||||
if (this == null) return SetErrorState("transaction not specified");
|
||||
if (!HasErrorState())
|
||||
{
|
||||
// Total weight.
|
||||
decimal totalWeight = requirements.GetTotalWeight(UomIdWeight);
|
||||
Weight = totalWeight;
|
||||
|
||||
// Set the allocation status.
|
||||
ClearAllocationStatus();
|
||||
if (requirements.Count > 0)
|
||||
{
|
||||
if (requirements.IsFullAllocation()) FullAllocation = true;
|
||||
else if (requirements.IsPartialAllocation()) PartialAllocation = true;
|
||||
}
|
||||
|
||||
// Calculate the totals from the list of requirements.;
|
||||
decimal newAmountNet = 0.0m;
|
||||
decimal newAmountTax = 0.0m;
|
||||
decimal newAmountTot = 0.0m;
|
||||
decimal newTimeEst = 0.0m;
|
||||
decimal newTimeAct = 0.0m;
|
||||
if (requirements.Count > 0)
|
||||
requirements.CalculateTotals(ref newAmountNet, ref newAmountTax, ref newAmountTot, ref newTimeEst, ref newTimeAct);
|
||||
|
||||
// Include delivery amounts.
|
||||
newAmountNet += DeliveryAmountNet;
|
||||
newAmountTax += DeliveryAmountTax;
|
||||
newAmountTot += DeliveryAmountTot;
|
||||
|
||||
// Store amounts:
|
||||
AmountNet = newAmountNet;
|
||||
AmountTax = newAmountTax;
|
||||
AmountTot = newAmountTot;
|
||||
TimeEst = newTimeEst;
|
||||
TimeAct = newTimeAct;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
public bool RefreshRequiredDate(List<SbmRequirement> requirements, ISacsMessageConsole messageConsole)
|
||||
{
|
||||
|
||||
@@ -610,7 +610,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// POpulate reference data.
|
||||
/// Populate reference data.
|
||||
/// <br/>- Code Types.
|
||||
/// </summary>
|
||||
public bool PopulateReferenceData()
|
||||
@@ -618,15 +618,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
|
||||
ClearErrorState();
|
||||
|
||||
// Code types.
|
||||
List<SaCodeTypeDfn> codeTypeDfns = Internals.CodeTypeConsole.CodeTypeDefinitions;
|
||||
foreach (SaCodeTypeDfn codeTypeDfn in codeTypeDfns)
|
||||
{
|
||||
if (Internals.CodeTypeConsole.PopulateCodeType(codeTypeDfn.Code, DbUpdateInfo))
|
||||
{
|
||||
//foreach (var code in codeTypeDfn.Codes)
|
||||
// Internals.CodeTypeConsole.PopulateCode(codeTypeDfn.sCode, code.Code, code.Desc);
|
||||
}
|
||||
}
|
||||
String codeTypePopulationErrorMessage = "";
|
||||
if (!Internals.CodeTypeConsole.Populate(DbUpdateInfo))
|
||||
codeTypePopulationErrorMessage = Internals.CodeTypeConsole.ErrorStateMessage;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(id)) return false;
|
||||
SbmRequirement.Params prmRequirement = new SbmRequirement.Params();
|
||||
prmRequirement.RequirementIdsIncluded.Add(id);
|
||||
prmRequirement.IdsIncluded.Add(id);
|
||||
prmRequirement.StatusCat = SbmRequirement.StatusCat.Any;
|
||||
return GetRequirementCount(prmRequirement) == 1;
|
||||
}
|
||||
@@ -102,7 +102,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(id)) return null;
|
||||
SbmRequirement.Params prmRequirement = new SbmRequirement.Params();
|
||||
prmRequirement.RequirementIdsIncluded.Add(id);
|
||||
prmRequirement.IdsIncluded.Add(id);
|
||||
prmRequirement.StatusCat = SbmRequirement.StatusCat.Any;
|
||||
return GetRequirement(prmRequirement);
|
||||
}
|
||||
|
||||
@@ -25,25 +25,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
|
||||
public abstract bool TransactionIsReadOnly(SbmTransaction transaction);
|
||||
public abstract bool TransactionDetailsAreReadOnly(SbmTransaction transaction);
|
||||
|
||||
public abstract bool RefreshTransactionTotals(SbmTransaction transaction, IEnumerable<SbmRequirement> requirements);
|
||||
|
||||
// Labour cost.
|
||||
public abstract decimal GetTransCostLabourRateHourDefault();
|
||||
public abstract decimal GetTransCostLabourRateHour(SysId transactionId);
|
||||
public abstract bool DeliveryFinancialsAreAvailable();
|
||||
|
||||
/// <summary>Change Transaction Association.</summary>
|
||||
public abstract bool ChangeTransactionsAssociation(SbmTransaction transaction, SysId associationId);
|
||||
|
||||
/// <summary>
|
||||
/// Refresh associated data:
|
||||
/// <para>- Refresh Stock Allocations.</para>
|
||||
/// <para>- </para>
|
||||
/// <para>- </para>
|
||||
/// <para>- </para>
|
||||
/// </summary>
|
||||
public abstract bool RefreshAssociatedData(SbmTransaction transaction, List<SbmRequirement> requirements, DbUpdateInfo dbUpdateInfo);
|
||||
public abstract bool RefreshAssociatedTransactions(SbmTransaction transaction, List<SbmRequirement> requirements, DbUpdateInfo dbUpdateInfo);
|
||||
// Transaction properties.
|
||||
public abstract Sbm.TransactionType GetTransactionType(SysId transactionId);
|
||||
|
||||
public DateTime GetTransactionTaxEffectiveDate(SbmTransaction transaction)
|
||||
{
|
||||
@@ -62,6 +45,24 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
|
||||
return DateTime.Today;
|
||||
}
|
||||
|
||||
// Labour cost.
|
||||
public abstract decimal GetTransCostLabourRateHourDefault();
|
||||
public abstract decimal GetTransCostLabourRateHour(SysId transactionId);
|
||||
public abstract bool DeliveryFinancialsAreAvailable();
|
||||
|
||||
/// <summary>Change Transaction Association.</summary>
|
||||
public abstract bool ChangeTransactionsAssociation(SbmTransaction transaction, SysId associationId);
|
||||
|
||||
public abstract bool RefreshTransactionTotals(SbmTransaction transaction, IEnumerable<SbmRequirement> requirements);
|
||||
|
||||
/// <summary>
|
||||
/// Refresh associated data:
|
||||
/// <para>- Refresh Stock Allocations.</para>
|
||||
/// <para>- Refresh totals.</para>
|
||||
/// </summary>
|
||||
public abstract bool RefreshAssociatedData(SbmTransaction transaction, List<SbmRequirement> requirements, DbUpdateInfo dbUpdateInfo);
|
||||
public abstract bool RefreshAssociatedTransactions(SbmTransaction transaction, List<SbmRequirement> requirements, DbUpdateInfo dbUpdateInfo);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Associated data.
|
||||
public abstract bool TransactionIsReferencedByOtherTransactions(SysId transactionId/*, Sbm.TransactionStatusCat transactionStatusCat*/);
|
||||
|
||||
@@ -739,14 +739,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
String searchValue = DbQuery.FormatForLike(StringUtil.TrimAll(rawSearchValue));
|
||||
if (StringUtil.IsEmpty(searchValue)) continue;
|
||||
List<String> searchValueFilter = new List<string>();
|
||||
searchValueFilter.Add(colAffiliate_Name + " LIKE '%" + searchValue + "%'");
|
||||
searchValueFilter.Add(colAffiliate_FirstName + " LIKE '%" + searchValue + "%'");
|
||||
searchValueFilter.Add(colAffiliate_LastName + " LIKE '%" + searchValue + "%'");
|
||||
searchValueFilter.Add(colAffiliate_PhoneMain + " LIKE '%" + searchValue + "%'");
|
||||
searchValueFilter.Add(colAffiliate_PhoneAlt + " LIKE '%" + searchValue + "%'");
|
||||
searchValueFilter.Add(colAffiliate_Website + " LIKE '%" + searchValue + "%'");
|
||||
searchValueFilter.Add(colAffiliate_Email + " LIKE '%" + searchValue + "%'");
|
||||
searchValueFilter.Add(colAffiliate_Notes + " LIKE '%" + searchValue + "%'");
|
||||
searchValueFilter.Add($"{colAffiliate_Name} LIKE '%{searchValue}%'");
|
||||
searchValueFilter.Add($"{colAffiliate_FirstName} LIKE '%{searchValue}%'");
|
||||
searchValueFilter.Add($"{colAffiliate_LastName} LIKE '%{searchValue}%'");
|
||||
searchValueFilter.Add($"{colAffiliate_PhoneMain} LIKE '%{searchValue}%'");
|
||||
searchValueFilter.Add($"{colAffiliate_PhoneAlt} LIKE '%{searchValue}%'");
|
||||
searchValueFilter.Add($"{colAffiliate_Website} LIKE '%{searchValue}%'");
|
||||
searchValueFilter.Add($"{colAffiliate_Email} LIKE '%{searchValue}%'");
|
||||
searchValueFilter.Add($"{colAffiliate_Notes} LIKE '%{searchValue}%'");
|
||||
searchFilter.Add(searchValueFilter.Concat(" OR ", "(", ")"));
|
||||
}
|
||||
if (searchFilter.Any()) filter.AddRange(searchFilter);
|
||||
@@ -755,7 +755,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
//---------------------------------------------------------------
|
||||
// Name.
|
||||
if (!StringUtil.IsEmpty(prm.Name))
|
||||
filter.Add(colAffiliate_Name + "='" + DbQuery.FormatForCondition(prm.Name) + "'");
|
||||
filter.Add(colAffiliate_Name + " ='" + DbQuery.FormatForCondition(prm.Name) + "'");
|
||||
// Partial Name with FirstName & LastName.
|
||||
if (!StringUtil.IsEmpty(prm.NamePartial))
|
||||
filter.Add(colAffiliate_Name + " LIKE '%" + DbQuery.FormatForLike(prm.NamePartial) + "%' OR " + colAffiliate_FirstName + " LIKE '%" + DbQuery.FormatForLike(prm.NamePartial) + "%' OR " + colAffiliate_LastName + " LIKE '%" + DbQuery.FormatForLike(prm.NamePartial) + "%'");
|
||||
@@ -853,42 +853,37 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (SysId.IsValid(prm.AffiliateIdAssocOwner))
|
||||
{
|
||||
// Restrict to affiliates that are the target of an association with the specified owner.
|
||||
subFilter = colAffiliate_Id + "=" + colAssociation_AffTarget + " AND " + colAssociation_AffOwner + "=" + prm.AffiliateIdAssocOwner.ToString();
|
||||
subFilter = $"{colAffiliate_Id}={colAssociation_AffTarget} AND {colAssociation_AffOwner}={SysId.ToInt(prm.AffiliateIdAssocOwner)}";
|
||||
}
|
||||
else if (SysId.IsValid(prm.AffiliateIdAssocTarget))
|
||||
{
|
||||
// Restrict to affiliates that are the owner of an association with the specified target.
|
||||
subFilter = colAffiliate_Id + "=" + colAssociation_AffOwner + " AND " + colAssociation_AffTarget + "=" + prm.AffiliateIdAssocTarget.ToString();
|
||||
subFilter = $"{colAffiliate_Id}={colAssociation_AffOwner} AND {colAssociation_AffTarget}={SysId.ToInt(prm.AffiliateIdAssocTarget)}";
|
||||
}
|
||||
else if (prm.AssociationType > 0)
|
||||
{
|
||||
// Restrict to affiliates that have an association of the specified type.
|
||||
subFilter = colAffiliate_Id + "=" + colAssociation_AffOwner + " OR " + colAffiliate_Id + "=" + colAssociation_AffTarget;
|
||||
}
|
||||
else if (prm.AssociationTypeExclude > 0)
|
||||
else if (prm.AssociationType > 0 || prm.AssociationTypeExclude > 0)
|
||||
{
|
||||
// Restrict to affiliates that don't have an association of the specified type.
|
||||
subFilter = colAffiliate_Id + "=" + colAssociation_AffOwner + " OR " + colAffiliate_Id + "=" + colAssociation_AffTarget;
|
||||
subFilter = $"({colAffiliate_Id}={colAssociation_AffOwner} OR {colAffiliate_Id}={colAssociation_AffTarget})";
|
||||
}
|
||||
|
||||
// Restrict to associations of the specified type.
|
||||
if (prm.AssociationType > 0)
|
||||
subFilter += " AND " + SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_Type, aliasAffAssocRef) + "=" + ((int)prm.AssociationType).ToString();
|
||||
subFilter += $" AND {SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_Type, aliasAffAssocRef)}={(int)prm.AssociationType}";
|
||||
// Exclude associations of the specified type:
|
||||
if (prm.AssociationTypeExclude > 0)
|
||||
subFilter += " AND " + SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_Type, aliasAffAssocRef) + "<>" + prm.AssociationTypeExclude.ToString();
|
||||
subFilter += $" AND {SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_Type, aliasAffAssocRef)}<>{(int)prm.AssociationTypeExclude}";
|
||||
// Should these associations also be retricted to those that are 'supervisory':
|
||||
if (prm.TargetSupervised != SbmAffiliate.Params.Supervised.Any)
|
||||
{
|
||||
bool superMatch = prm.TargetSupervised == SbmAffiliate.Params.Supervised.Yes;
|
||||
subFilter += " AND " + GetFlagFilter(SbmAssociation.Flag_Supervised, superMatch, aliasAffAssocRef);
|
||||
subFilter += $" AND {GetFlagFilter(SbmAssociation.Flag_Supervised, superMatch, aliasAffAssocRef)}";
|
||||
}
|
||||
|
||||
DbQuery qryAssociationTarget = new DbQuery(Database.DbmsType);
|
||||
qryAssociationTarget.Tables.Add(SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Association), aliasAffAssocRef);
|
||||
qryAssociationTarget.Columns.Add(colAssociation_Id);
|
||||
qryAssociationTarget.Filters.Add(subFilter);
|
||||
if (!DateUtil.IsValid(prm.AssociationEffectiveOn))
|
||||
if (DateUtil.IsValid(prm.AssociationEffectiveOn))
|
||||
{
|
||||
// NB 'Association.Terminated' column is a long value (not a date).
|
||||
String colAssociation_Terminated = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_Terminated, aliasAffAssocRef);
|
||||
|
||||
@@ -16,6 +16,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Transactions;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
@@ -775,6 +776,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
requirement.QuantityProd = (decimal)dbRequirement._QuantityProd;
|
||||
requirement.UomId = new SysId(dbRequirement._UomId ?? 0);
|
||||
requirement.MaterialSourceCode = dbRequirement._MaterialSourceCode;
|
||||
requirement.AmountUnit = (decimal)dbRequirement._AmountUnit;
|
||||
requirement.AmountAct = (decimal)dbRequirement._AmountAct;
|
||||
requirement.AmountDisc = (decimal)dbRequirement._AmountDisc;
|
||||
requirement.AmountNet = (decimal)dbRequirement._AmountNet;
|
||||
requirement.TaxCodeId = new SysId(dbRequirement._TaxCodeId ?? 0);
|
||||
requirement.TaxRate = (decimal)dbRequirement._TaxRate;
|
||||
@@ -910,7 +914,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
case SbmRequirement.Column.TransId:
|
||||
SetRequirementColDfn(columnDfn, "Trans Id", 80, SbmDbDfn.ColumnIdx.Requirement_TransId, ColumnAlignment.Right, DataValue.DataType.Long);
|
||||
break;
|
||||
case SbmRequirement.Column.Seq:
|
||||
case SbmRequirement.Column.Type:
|
||||
SetRequirementColDfn(columnDfn, "Type", 50, SbmDbDfn.ColumnIdx.Requirement_Type, ColumnAlignment.Center, DataValue.DataType.Long);
|
||||
break;
|
||||
case SbmRequirement.Column.Sequence:
|
||||
SetRequirementColDfn(columnDfn, "Seq", 50, SbmDbDfn.ColumnIdx.Requirement_Seq, ColumnAlignment.Right, DataValue.DataType.String);
|
||||
break;
|
||||
case SbmRequirement.Column.Started:
|
||||
@@ -1215,6 +1222,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
break;
|
||||
//-----------------------------------------------------------------
|
||||
// Transaction details.
|
||||
case SbmRequirement.Column.Trans_Type:
|
||||
SetRequirementColDfn(columnDfn, "Trans type", 70, SbmDbDfn.ColumnIdx.Transaction_Type, ColumnAlignment.Center, DataValue.DataType.Long, aliasRequirement_Transaction, prefixRequirement_Transaction);
|
||||
break;
|
||||
case SbmRequirement.Column.Trans_TypeDesc:
|
||||
SetRequirementColDfn(columnDfn, "Trans type", 70, SbmDbDfn.ColumnIdx.Transaction_Type, ColumnAlignment.Left, DataValue.DataType.String, aliasRequirement_Transaction, prefixRequirement_Transaction);
|
||||
break;
|
||||
@@ -1934,15 +1944,33 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
//---------------------------------------------------------------
|
||||
// Validate the parameters.
|
||||
#if DEBUG
|
||||
if (!SysId.IsValid(AffiliateId_Owner) && !SysId.IsValid(prm.AssociationId) && !SysId.IsValid(prm.CommodityId) && !SysId.IsValid(prm.TransactionRequirementSourceId) && !prm.TransactionIdsIncluded.HasValidIds() && !prm.RequirementIdsIncluded.HasValidIds() && !prm.RequirementIdsSource.HasValidIds())
|
||||
SaLogger.Trace("\t### " + GetType().Name + ".GetRequirementQueryFilter - Owner/association/transaction not specified.");
|
||||
if (!SysId.IsValid(AffiliateId_Owner) && !SysId.IsValid(prm.AssociationId) && !SysId.IsValid(prm.CommodityId) && !SysId.IsValid(prm.TransactionRequirementSourceId) && !prm.TransactionIdsIncluded.HasValidIds() && !prm.IdsIncluded.HasValidIds() && !prm.RequirementIdsSource.HasValidIds())
|
||||
SaLogger.Debug($"{SysUtil.Fn} ### Owner/association/transaction not specified.");
|
||||
#endif
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Affiliate Owner - only need to be filtered if no significant Ids specified.
|
||||
bool filterByOwner = !SysId.IsValid(prm.AssociationId) && !SysId.IsValid(prm.CommodityId) && !SysId.IsValid(prm.TransactionRequirementSourceId) && !prm.TransactionIdsIncluded.HasValidIds() && !prm.RequirementIdsIncluded.HasValidIds() && !prm.RequirementIdsSource.HasValidIds();
|
||||
bool filterByOwner =
|
||||
!SysId.IsValid(prm.AssociationId) && !SysId.IsValid(prm.CommodityId) &&
|
||||
!SysId.IsValid(prm.TransactionRequirementSourceId) && !prm.TransactionIdsIncluded.HasValidIds() &&
|
||||
!prm.IdsIncluded.HasValidIds() && !prm.RequirementIdsSource.HasValidIds();
|
||||
if (filterByOwner)
|
||||
filter.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Requirement_AffIdOwner, tableAlias, false) + "=" + SysId.ToString(AffiliateId_Owner));
|
||||
filter.Add($"{SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Requirement_AffIdOwner, tableAlias, false)}={SysId.ToLong(AffiliateId_Owner)}");
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Requirement.
|
||||
|
||||
// Requirement Id.
|
||||
String colRequirement_Id = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Requirement_Id, tableAlias);
|
||||
if (prm.IdsIncluded.HasValidIds())
|
||||
filter.Add($"{colRequirement_Id} IN ({prm.IdsIncluded.Concat(",")})");
|
||||
if (prm.IdsExcluded.HasValidIds())
|
||||
filter.Add($"{colRequirement_Id} NOT IN ({prm.IdsExcluded.Concat(",")})");
|
||||
|
||||
// Source Requirement.
|
||||
String colRequirement_ReqntIdSource = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Requirement_ReqntIdSource, tableAlias, false);
|
||||
if (prm.RequirementIdsSource.HasValidIds())
|
||||
filter.Add($"{colRequirement_ReqntIdSource} IN ({prm.RequirementIdsSource.Concat(",")})");
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Association Details.
|
||||
@@ -2048,20 +2076,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Requirement Details:
|
||||
// IncludeIds & ExcludeIds.
|
||||
String includedIds = prm.RequirementIdsIncluded.Concat(",");
|
||||
String colRequirement_Id = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Requirement_Id, tableAlias);
|
||||
if (!StringUtil.IsEmpty(includedIds))
|
||||
filter.Add(colRequirement_Id + " IN (" + includedIds + ")");
|
||||
String excludedIds = prm.RequirementIdsExcluded.Concat(",");
|
||||
if (!StringUtil.IsEmpty(excludedIds))
|
||||
filter.Add(colRequirement_Id + " NOT IN (" + excludedIds + ")");
|
||||
|
||||
// Source Requirement.
|
||||
String colRequirement_ReqntIdSource = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Requirement_ReqntIdSource, tableAlias, false);
|
||||
if (prm.RequirementIdsSource.HasValidIds())
|
||||
filter.Add(colRequirement_ReqntIdSource + " IN (" + prm.RequirementIdsSource.Concat(",") + ")");
|
||||
|
||||
// Source Requirment Transaction.
|
||||
if (SysId.IsValid(prm.TransactionRequirementSourceId))
|
||||
@@ -2078,15 +2092,45 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
filter.Add("EXISTS(" + qryTrans.BuildQuery() + ")");
|
||||
}
|
||||
|
||||
String colRequirement_JobNumber = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Requirement_JobNumber, tableAlias, false);
|
||||
String colRequirement_DescBrief = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Requirement_DescBrief, tableAlias, false);
|
||||
String colRequirement_ProductCode = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Requirement_ProductCode, tableAlias, false);
|
||||
String colRequirement_Notes = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Requirement_Notes, tableAlias, false);
|
||||
|
||||
// Generic Search.
|
||||
if (!StringUtil.IsBlank(prm.Search))
|
||||
{
|
||||
foreach (String search in Regex.Split(prm.Search, "[\\s,;\\-+]+"))
|
||||
{
|
||||
if (StringUtil.IsBlank(search)) continue;
|
||||
String searchForLike = DbQuery.FormatForLike(search, true);
|
||||
List<String> searchFilter = new List<string>();
|
||||
searchFilter.Add($"{colRequirement_JobNumber} LIKE '%{searchForLike}%'");
|
||||
searchFilter.Add($"{colRequirement_DescBrief} LIKE '%{searchForLike}%'");
|
||||
searchFilter.Add($"{colRequirement_ProductCode} LIKE '%{searchForLike}%'");
|
||||
searchFilter.Add($"{colRequirement_Notes} LIKE '%{searchForLike}%'");
|
||||
if (!StringUtil.IsBlank(prm.AliasTransaction))
|
||||
{
|
||||
searchFilter.Add($"{SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Transaction_Ref, prm.AliasTransaction)} LIKE '%{searchForLike}%'");
|
||||
}
|
||||
if (!StringUtil.IsBlank(prm.AliasCommodity))
|
||||
{
|
||||
searchFilter.Add($"{SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Commodity_Code, prm.AliasCommodity)} LIKE '%{searchForLike}%'");
|
||||
searchFilter.Add($"{SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Commodity_DescBrief, prm.AliasCommodity)} LIKE '%{searchForLike}%'");
|
||||
}
|
||||
if (searchFilter.Any())
|
||||
filter.Add(searchFilter.Concat(" OR ", "(", ")"));
|
||||
}
|
||||
}
|
||||
|
||||
// Requirement DescBrief.
|
||||
String reqntDescBrief = DbQuery.FormatForCondition(prm.RequirementDescBrief);
|
||||
String Requirement_DescBrief = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Requirement_DescBrief, tableAlias, false);
|
||||
String reqntDescBrief = DbQuery.FormatForCondition(prm.DescBrief);
|
||||
if (!reqntDescBrief.IsEmpty())
|
||||
filter.Add(DbQuery.FormatFn_Left(Requirement_DescBrief, reqntDescBrief.Length) + "='" + reqntDescBrief + "'");
|
||||
filter.Add(DbQuery.FormatFn_Left(colRequirement_DescBrief, reqntDescBrief.Length) + "='" + reqntDescBrief + "'");
|
||||
|
||||
// Promotion Code.
|
||||
if (!StringUtil.IsEmpty(prm.RequirementPromotionCode))
|
||||
filter.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Requirement_PromotionCode, tableAlias, false) + "='" + DbQuery.FormatForCondition(prm.RequirementPromotionCode) + "'");
|
||||
if (!StringUtil.IsEmpty(prm.PromotionCode))
|
||||
filter.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Requirement_PromotionCode, tableAlias, false) + "='" + DbQuery.FormatForCondition(prm.PromotionCode) + "'");
|
||||
|
||||
|
||||
//---------------------------------------------------------------
|
||||
@@ -2096,11 +2140,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
filter.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Requirement_CommodityId, tableAlias, false) + "=" + prm.CommodityId.ToString());
|
||||
|
||||
// Product Code.
|
||||
if (!prm.RequirementProductCodeFull.IsEmpty() || !prm.RequirementProductCodePartial.IsEmpty())
|
||||
if (!prm.ProductCodeFull.IsEmpty() || !prm.ProductCodePartial.IsEmpty())
|
||||
{
|
||||
String reqntProductCodeFull = DbQuery.FormatForCondition(prm.RequirementProductCodeFull);
|
||||
String reqntProductCodePartial = DbQuery.FormatForCondition(prm.RequirementProductCodePartial);
|
||||
String colRequirement_ProductCode = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Requirement_ProductCode, tableAlias);
|
||||
String reqntProductCodeFull = DbQuery.FormatForCondition(prm.ProductCodeFull);
|
||||
String reqntProductCodePartial = DbQuery.FormatForCondition(prm.ProductCodePartial);
|
||||
if (!reqntProductCodeFull.IsEmpty())
|
||||
{
|
||||
filter.Add(colRequirement_ProductCode + "='" + reqntProductCodeFull + "'");
|
||||
@@ -2109,7 +2152,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
{
|
||||
if (SessionConsole != null && AllowConfigOption(Sbm.ConfigOption.CommodityPartialCodeFilter))
|
||||
filter.Add(colRequirement_ProductCode + " LIKE '%" + DbQuery.FormatForLike(reqntProductCodePartial) + "%'");
|
||||
else filter.Add(DbQuery.FormatFn_Left(colRequirement_ProductCode, prm.RequirementProductCodePartial.Length) + "='" + reqntProductCodePartial + "'");
|
||||
else filter.Add(DbQuery.FormatFn_Left(colRequirement_ProductCode, prm.ProductCodePartial.Length) + "='" + reqntProductCodePartial + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2143,15 +2186,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Project Task Code.
|
||||
if (!StringUtil.IsEmpty(prm.RequirementProjectTaskCodeFull) || !StringUtil.IsEmpty(prm.RequirementProjectTaskCodePartial))
|
||||
if (!StringUtil.IsEmpty(prm.ProjectTaskCodeFull) || !StringUtil.IsEmpty(prm.ProjectTaskCodePartial))
|
||||
{
|
||||
String colRequirement_ProductCode = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Requirement_ProductCode, tableAlias, false);
|
||||
if (!StringUtil.IsEmpty(prm.RequirementProjectTaskCodeFull))
|
||||
filter.Add(colRequirement_ProductCode + "='" + DbQuery.FormatForCondition(prm.RequirementProjectTaskCodeFull) + "'");
|
||||
else if (!StringUtil.IsEmpty(prm.RequirementProjectTaskCodePartial))
|
||||
if (!StringUtil.IsEmpty(prm.ProjectTaskCodeFull))
|
||||
filter.Add(colRequirement_ProductCode + "='" + DbQuery.FormatForCondition(prm.ProjectTaskCodeFull) + "'");
|
||||
else if (!StringUtil.IsEmpty(prm.ProjectTaskCodePartial))
|
||||
{
|
||||
String reqntProjectTaskCodePartial = DbQuery.FormatForCondition(prm.RequirementProjectTaskCodePartial);
|
||||
filter.Add(DbQuery.FormatFn_Left(colRequirement_ProductCode, prm.RequirementProjectTaskCodePartial.Length) + "='" + reqntProjectTaskCodePartial + "'");
|
||||
String reqntProjectTaskCodePartial = DbQuery.FormatForCondition(prm.ProjectTaskCodePartial);
|
||||
filter.Add(DbQuery.FormatFn_Left(colRequirement_ProductCode, prm.ProjectTaskCodePartial.Length) + "='" + reqntProjectTaskCodePartial + "'");
|
||||
}
|
||||
// Force the transaction type of 'Project'.
|
||||
if (prm.TransactionType != Sbm.TransactionType.Project)
|
||||
@@ -2170,13 +2212,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Job Number.
|
||||
if (!StringUtil.IsEmpty(prm.RequirementJobNumberFull) || !StringUtil.IsEmpty(prm.RequirementJobNumberPartial))
|
||||
if (!StringUtil.IsEmpty(prm.JobNumberFull) || !StringUtil.IsEmpty(prm.JobNumberPartial))
|
||||
{
|
||||
String colRequirement_JobNumber = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Requirement_JobNumber, tableAlias, false);
|
||||
if (!StringUtil.IsEmpty(prm.RequirementJobNumberFull))
|
||||
filter.Add(colRequirement_JobNumber + "='" + DbQuery.FormatForCondition(prm.RequirementJobNumberFull) + "'");
|
||||
else if (!StringUtil.IsEmpty(prm.RequirementJobNumberPartial))
|
||||
filter.Add(DbQuery.FormatFn_Left(colRequirement_JobNumber, prm.RequirementJobNumberPartial.Length) + "='" + DbQuery.FormatForCondition(prm.RequirementJobNumberPartial) + "'");
|
||||
if (!StringUtil.IsEmpty(prm.JobNumberFull))
|
||||
filter.Add($"{colRequirement_JobNumber}='{DbQuery.FormatForCondition(prm.JobNumberFull)}'");
|
||||
else if (!StringUtil.IsEmpty(prm.JobNumberPartial))
|
||||
filter.Add($"{colRequirement_JobNumber} Like '{DbQuery.FormatForLike(prm.JobNumberPartial)}'");
|
||||
}
|
||||
|
||||
|
||||
@@ -2358,7 +2399,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
query.Tables.Add(SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Requirement), aliasRequirement);
|
||||
query.Columns.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Requirement_Id, aliasRequirement));
|
||||
query.Columns.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Requirement_TransId, aliasRequirement));
|
||||
if (columns.HasId(SbmRequirement.Column.Seq)) query.Columns.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Requirement_Seq, aliasRequirement));
|
||||
if (columns.HasId(SbmRequirement.Column.Type))
|
||||
query.Columns.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Requirement_Type, aliasRequirement));
|
||||
if (columns.HasId(SbmRequirement.Column.Sequence))
|
||||
query.Columns.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Requirement_Seq, aliasRequirement));
|
||||
if (columns.HasId(SbmRequirement.Column.Required) || columns.HasId(SbmRequirement.Column.RequiredTime) || columns.HasId(SbmRequirement.Column.Required_Fmt))
|
||||
query.Columns.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Requirement_Required, aliasRequirement));
|
||||
if (columns.HasId(SbmRequirement.Column.Started) || columns.HasId(SbmRequirement.Column.StartedTime) || columns.HasId(SbmRequirement.Column.Started_Day))
|
||||
@@ -2385,7 +2429,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
query.Columns.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Requirement_AmountNet, aliasRequirement));
|
||||
if (columns.HasId(SbmRequirement.Column.TaxCodeId)) query.Columns.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Requirement_TaxCodeId, aliasRequirement));
|
||||
if (columns.HasId(SbmRequirement.Column.TaxRate)) query.Columns.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Requirement_TaxRate, aliasRequirement));
|
||||
if (columns.HasId(SbmRequirement.Column.AmountTax) || columns.HasId(SbmRequirement.Column.AmountTax_Fmt)) query.Columns.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Requirement_AmountTax));
|
||||
if (columns.HasId(SbmRequirement.Column.AmountTax) || columns.HasId(SbmRequirement.Column.AmountTax_Fmt)) query.Columns.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Requirement_AmountTax, aliasRequirement));
|
||||
query.Columns.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Requirement_AmountTot, aliasRequirement));
|
||||
}
|
||||
// Common Properties
|
||||
@@ -2529,6 +2573,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Transaction Details.
|
||||
prm.AliasTransaction = "";
|
||||
bool hasTransCols = columns.HasId(SbmRequirement.Column.Trans_TypeDesc);
|
||||
if (!hasTransCols) hasTransCols = columns.HasId(SbmRequirement.Column.Trans_Type);
|
||||
if (!hasTransCols) hasTransCols = columns.HasId(SbmRequirement.Column.Trans_Ref);
|
||||
if (!hasTransCols) hasTransCols = columns.HasId(SbmRequirement.Column.Trans_RefExt);
|
||||
if (!hasTransCols) hasTransCols = columns.HasId(SbmRequirement.Column.Trans_DescBrief);
|
||||
@@ -2591,7 +2636,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Add the transaction columns.
|
||||
List<SbmDbDfn.ColumnIdx> transactionCols = new List<SbmDbDfn.ColumnIdx>();
|
||||
if (columns.HasId(SbmRequirement.Column.TransId)) transactionCols.Add(SbmDbDfn.ColumnIdx.Transaction_Id);
|
||||
if (columns.HasId(SbmRequirement.Column.Trans_TypeDesc)) transactionCols.Add(SbmDbDfn.ColumnIdx.Transaction_Type);
|
||||
if (columns.HasId(SbmRequirement.Column.Trans_Type) || columns.HasId(SbmRequirement.Column.Trans_TypeDesc)) transactionCols.Add(SbmDbDfn.ColumnIdx.Transaction_Type);
|
||||
if (columns.HasId(SbmRequirement.Column.Trans_Ref)) transactionCols.Add(SbmDbDfn.ColumnIdx.Transaction_Ref);
|
||||
if (columns.HasId(SbmRequirement.Column.Trans_RefExt)) transactionCols.Add(SbmDbDfn.ColumnIdx.Transaction_RefExt);
|
||||
if (columns.HasId(SbmRequirement.Column.Trans_DescBrief)) transactionCols.Add(SbmDbDfn.ColumnIdx.Transaction_DescBrief);
|
||||
@@ -3335,7 +3380,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Populate filter.
|
||||
query.Filters.AddRange(GetRequirementQueryFilter(prm));
|
||||
|
||||
if (prm.RequirementIdsIncluded.Count != 1)
|
||||
if (prm.IdsIncluded.Count != 1)
|
||||
{
|
||||
// Configure sort sequence.
|
||||
foreach (String sortColumn in GetRequirementSortColumns(prm))
|
||||
|
||||
@@ -69,16 +69,43 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
return detailsAreReadOnly;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Transaction properties.
|
||||
public override Sbm.TransactionType GetTransactionType(SysId transactionId)
|
||||
{
|
||||
if (SysId.IsValid(transactionId))
|
||||
{
|
||||
// Construct the query.
|
||||
String colType = "TransType";
|
||||
DbQuery qry = new DbQuery(Database.DbmsType);
|
||||
qry.Tables.Add(SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Transaction));
|
||||
qry.Columns.Add(SbmDbDfn.GetColumnName(SbmDbDfn.ColumnIdx.Transaction_Type), colType);
|
||||
qry.Filters.Add($"{SbmDbDfn.GetColumnName(SbmDbDfn.ColumnIdx.Transaction_Id)}={SysId.ToLong(transactionId)}");
|
||||
using (DbResultSet dbResultSet = DbResultSet_DataReader.ExecuteQuery(Database, qry.BuildQuery()))
|
||||
{
|
||||
if (dbResultSet != null && dbResultSet.NextRecord())
|
||||
{
|
||||
NamedValue.Map values = dbResultSet.GetRecordValues();
|
||||
return (Sbm.TransactionType)values.GetLong(colType);
|
||||
}
|
||||
}
|
||||
}
|
||||
return Sbm.TransactionType.Unknown;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
public override bool RefreshTransactionTotals(SbmTransaction transaction, IEnumerable<SbmRequirement> requirements)
|
||||
{
|
||||
// Recalculate the amounts stored against the transaction in line with the list of requirements.
|
||||
ClearErrorState();
|
||||
if (transaction == null) return SetErrorState(ErrorMessage.InvalidStatus);
|
||||
if (transaction == null) return SetErrorState(ErrorMessage.ItemNotSpecified);
|
||||
if (requirements == null) requirements = new List<SbmRequirement>();
|
||||
|
||||
// Total weight.
|
||||
decimal totalWeight = requirements.GetTotalWeight(Internals.GetDefaultUnitOfMeasureByCategory(SaUomCategory.Weight)?.Id);
|
||||
transaction.Weight = totalWeight;
|
||||
SysId uomIdWeight = transaction.UomIdWeight;
|
||||
if (!SysId.IsValid(uomIdWeight))
|
||||
uomIdWeight = Internals.GetDefaultUnitOfMeasureByCategory(SaUomCategory.Weight)?.Id;
|
||||
transaction.Weight = requirements.GetTotalWeight(uomIdWeight);
|
||||
|
||||
// Set the allocation status:
|
||||
transaction.ClearAllocationStatus();
|
||||
|
||||
@@ -136,17 +136,17 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
// Any requirements left in the 'Not Updated' list must be new.
|
||||
foreach (SbmRequirement requirementNotUpdate in requirementsNotUpdated)
|
||||
foreach (SbmRequirement requirementNotUpdated in requirementsNotUpdated)
|
||||
{
|
||||
if (requirementNotUpdate != null)
|
||||
if (requirementNotUpdated != null)
|
||||
{
|
||||
if (!SysId.IsValid(requirementNotUpdate.Id))
|
||||
if (!SysId.IsValid(requirementNotUpdated.Id))
|
||||
{
|
||||
// Requirement does not yet exist - create it:
|
||||
if (InsertRequirement(requirementNotUpdate, dbUpdateInfo))
|
||||
if (InsertRequirement(requirementNotUpdated, dbUpdateInfo))
|
||||
{
|
||||
if (!CommitRequirementData(requirementNotUpdate, dbUpdateInfo))
|
||||
SetErrorState("Failed to update requirement's data: " + requirementNotUpdate.ErrorStateMessage);
|
||||
if (!CommitRequirementData(requirementNotUpdated, dbUpdateInfo))
|
||||
SetErrorState("Failed to update requirement's data: " + requirementNotUpdated.ErrorStateMessage);
|
||||
}
|
||||
else SetErrorState("Failed to create requirement: " + ErrorStateMessage);
|
||||
}
|
||||
@@ -178,7 +178,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
requirements = GetRequirementsForTransaction(transaction.Id);
|
||||
}
|
||||
// Refresh totals.
|
||||
if (transaction.RefreshTotals(requirements))
|
||||
if (RefreshTransactionTotals(transaction, requirements))
|
||||
UpdateTransaction(transaction, dbUpdateInfo);
|
||||
else SetErrorState(transaction.ErrorStateMessage);
|
||||
}
|
||||
@@ -217,7 +217,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (requirementsAssociation.Count > 0)
|
||||
{
|
||||
RefreshAssociatedData(transactionAssociation, null, dbUpdateInfo);
|
||||
transactionAssociation.RefreshTotals(requirementsAssociation);
|
||||
TransactionMgr.RefreshTransactionTotals(transactionAssociation, requirementsAssociation);
|
||||
UpdateTransaction(transactionAssociation, dbUpdateInfo);
|
||||
requirementsAssociation.Clear();
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
@inject SbmLocaliser Localiser
|
||||
@{
|
||||
// Ensure view is only included once in page.
|
||||
if (!Model.RegisterView("Views/Common/SelectItem")) return;
|
||||
if (!Model.RegisterView(Html.ViewContext)) return;
|
||||
// Scripts.
|
||||
Model.AdditionalFiles_JS.Add("js/sbc-sel-itm.js");
|
||||
}
|
||||
|
||||
@@ -275,7 +275,7 @@ a:focus
|
||||
{
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: 7px;
|
||||
top: 5px;
|
||||
right: 48px;
|
||||
min-width: 180px;
|
||||
z-index: 1000;
|
||||
|
||||
@@ -96,8 +96,8 @@
|
||||
let env = cd.env.init = { mode: { search: 1 }, data: {}, ajax: {}, $pnl: {}, $frm: {}, $ctrl: {}, $dlg: {} };
|
||||
|
||||
env.$pnl.items = $('.sbc-panel.Tables');
|
||||
env.$pnl.header = env.$pnl.items.find('.sbc-panel-header');
|
||||
env.$pnl.bgr = env.$pnl.header.find('.sbc-burger').invisible();
|
||||
env.$pnl.hdr = env.$pnl.items.find('.sbc-panel-header');
|
||||
env.$pnl.bgr = env.$pnl.hdr.find('.sbc-burger').invisible();
|
||||
env.$pnl.mnu = env.$pnl.bgr.find('ul.sbc-dropdown-menu');
|
||||
env.$pnl.table = env.$pnl.items.find('.sbc-panel-item-table');
|
||||
env.$pnl.msgs = env.$pnl.table.find('.sbc-panel-messages');
|
||||
|
||||
@@ -106,8 +106,8 @@
|
||||
let env = { mode: { search: 1 }, data: {}, ajax: {}, $pnl: {}, $frm: {}, $ctrl: {}, $dlg: {} };
|
||||
|
||||
env.$pnl.items = $('.sbc-panel.Schema');
|
||||
env.$pnl.header = env.$pnl.items.find('.sbc-panel-header');
|
||||
env.$pnl.bgr = env.$pnl.header.find('.sbc-burger').invisible();
|
||||
env.$pnl.hdr = env.$pnl.items.find('.sbc-panel-header');
|
||||
env.$pnl.bgr = env.$pnl.hdr.find('.sbc-burger').invisible();
|
||||
env.$pnl.mnu = env.$pnl.bgr.find('ul.sbc-dropdown-menu');
|
||||
env.$frm.filter = env.$pnl.items.find('#frmSchemaFilter');
|
||||
env.$frm.filter.on('change', '.FilterContext', function () { rs.refreshDbSchema(env); });
|
||||
|
||||
@@ -129,7 +129,7 @@
|
||||
<data name="label.associations" xml:space="preserve">
|
||||
<value>Associations</value>
|
||||
</data>
|
||||
<data name="caption.commodity" xml:space="preserve">
|
||||
<data name="label.commodity" xml:space="preserve">
|
||||
<value>Commodity</value>
|
||||
</data>
|
||||
<data name="caption.commodity.create" xml:space="preserve">
|
||||
@@ -837,4 +837,58 @@
|
||||
<data name="caption.item.requirements" xml:space="preserve">
|
||||
<value>{0} Items</value>
|
||||
</data>
|
||||
<data name="label.amount,unit" xml:space="preserve">
|
||||
<value>Amount unit</value>
|
||||
</data>
|
||||
<data name="label.reference.ext" xml:space="preserve">
|
||||
<value>Ext ref.</value>
|
||||
</data>
|
||||
<data name="label.amount.total" xml:space="preserve">
|
||||
<value>Total amount</value>
|
||||
</data>
|
||||
<data name="label.quantity" xml:space="preserve">
|
||||
<value>Quantity</value>
|
||||
</data>
|
||||
<data name="label.total" xml:space="preserve">
|
||||
<value>Total</value>
|
||||
</data>
|
||||
<data name="label.amount.unit" xml:space="preserve">
|
||||
<value>Unit amount</value>
|
||||
</data>
|
||||
<data name="label.seq" xml:space="preserve">
|
||||
<value>Seq</value>
|
||||
</data>
|
||||
<data name="label.populate" xml:space="preserve">
|
||||
<value>Populate</value>
|
||||
</data>
|
||||
<data name="msg.items.populated" xml:space="preserve">
|
||||
<value>Items populated.</value>
|
||||
</data>
|
||||
<data name="label.notification" xml:space="preserve">
|
||||
<value>Notification</value>
|
||||
</data>
|
||||
<data name="label.error" xml:space="preserve">
|
||||
<value>Error</value>
|
||||
</data>
|
||||
<data name="label.warning" xml:space="preserve">
|
||||
<value>Warning</value>
|
||||
</data>
|
||||
<data name="label.code.len" xml:space="preserve">
|
||||
<value>Code len</value>
|
||||
</data>
|
||||
<data name="label.code.length" xml:space="preserve">
|
||||
<value>Code length</value>
|
||||
</data>
|
||||
<data name="label.item" xml:space="preserve">
|
||||
<value>Item</value>
|
||||
</data>
|
||||
<data name="label.discount" xml:space="preserve">
|
||||
<value>Discount</value>
|
||||
</data>
|
||||
<data name="label.amount.actual" xml:space="preserve">
|
||||
<value>Actual amount</value>
|
||||
</data>
|
||||
<data name="label.desc.detail" xml:space="preserve">
|
||||
<value>Detail desc</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -280,6 +280,19 @@ namespace Sarand.BusinessMgr.Web.Portal.App
|
||||
}
|
||||
/// <summary>Transaction filter properties.</summary>
|
||||
public TransactionData Transaction { get; } = new TransactionData();
|
||||
|
||||
// ProductionControl filter.
|
||||
public class ProductionControlData
|
||||
{
|
||||
public class FilterData
|
||||
{
|
||||
public uint PageNo { get; set; } = 1;
|
||||
public ushort PageLength { get; set; } = 200;
|
||||
}
|
||||
public FilterData Filter { get; } = new FilterData();
|
||||
}
|
||||
/// <summary>ProductionControl filter properties.</summary>
|
||||
public ProductionControlData ProductionControl { get; } = new ProductionControlData();
|
||||
}
|
||||
public UserProfileData Profile { get; protected set; } = new UserProfileData();
|
||||
|
||||
|
||||
@@ -410,6 +410,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Consoles
|
||||
SysId affilliateIdOwner = data.AffiliateIdOrganisation;
|
||||
Dictionary<String, SaTaxCode> taxCodes = Internals.GetTaxCodesEffectiveOn(DateTime.Today).ToDictionary(item => item.Code, item => item);
|
||||
SaTaxCode taxCodeDefault = taxCodes.Values.FirstOrDefault(item => item.Code.EqualsCI(Internals.GetDefaultTaxCode()));
|
||||
Dictionary<SaUomType, SaUnitMeasure> uomTypes = Internals.GetUnitsOfMeasure().ToDictionary(item => item.UnitType, item => item);
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Sales Orders.
|
||||
@@ -488,6 +489,8 @@ namespace Sarand.BusinessMgr.Web.Portal.Consoles
|
||||
|
||||
SbmRequirement requirement = Internals.TransactionMgr.CreateRequirement(transactionData.Transaction.AssociationId, transactionData.Transaction.Id, Sbm.RequirementType.Detail);
|
||||
requirement.CommodityId = commodityData.Id;
|
||||
requirement.ProductCode = commodityData.Code;
|
||||
requirement.UomId = uomTypes.GetValueOrDefault(commodityData.SaleUnitType)?.Id;
|
||||
requirement.DescBrief = commodityData.Caption;
|
||||
requirement.Quantity = (decimal)(commodityData.Type == Sbm.CommodityType.Service ? 0.25 * SacsRandomHelper.GetInt32(2, 12) : SacsRandomHelper.GetInt32(1, 6));
|
||||
requirement.AmountUnit = commodityData.SalePrice;
|
||||
@@ -530,7 +533,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Consoles
|
||||
// Update transaction totals.
|
||||
Internals.TransactionMgr.RefreshTransactionTotals(transactionData.Transaction, requirements.Where(item => SysId.IsValid(item.Id)));
|
||||
if (!Internals.TransactionMgr.UpdateTransaction(transactionData.Transaction, DbUpdateInfo))
|
||||
SaLogger.Warn($"{SysUtil.Fn} Faield to update transaction. {Internals.TransactionMgr.ErrorStateMessage.TrimEnd('.')}.");
|
||||
SaLogger.Warn($"{SysUtil.Fn} Failed to update transaction. {Internals.TransactionMgr.ErrorStateMessage.TrimEnd('.')}.");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
+4
-4
@@ -133,8 +133,8 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Assets
|
||||
// View mode.
|
||||
public class ModeData
|
||||
{
|
||||
public bool? Search { get; set; }
|
||||
public bool? Maintain { get; set; }
|
||||
public ushort? Search { get; set; }
|
||||
public ushort? Maintain { get; set; }
|
||||
}
|
||||
public ModeData Mode { get; set; }
|
||||
// AssetCategory list.
|
||||
@@ -162,9 +162,9 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Assets
|
||||
responseData.Mode = new AjaxResponse_AssetCategoryList.ModeData();
|
||||
Model_AssetCategory.ViewMode viewMode = model.GetFilterMode();
|
||||
if (viewMode == Model_AssetCategory.ViewMode.Maintain)
|
||||
responseData.Mode.Maintain = true;
|
||||
responseData.Mode.Maintain = 1;
|
||||
else
|
||||
responseData.Mode.Search = true;
|
||||
responseData.Mode.Search = 1;
|
||||
|
||||
// Item filter.
|
||||
SbmAssetCategory.Params prmAssetCategory = new SbmAssetCategory.Params();
|
||||
|
||||
@@ -131,9 +131,9 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Assets
|
||||
// View mode.
|
||||
public class ModeData
|
||||
{
|
||||
public bool? Search { get; set; }
|
||||
public bool? Maintain { get; set; }
|
||||
public bool? AssetsForItem { get; set; }
|
||||
public ushort? Search { get; set; }
|
||||
public ushort? Maintain { get; set; }
|
||||
public ushort? AssetsForItem { get; set; }
|
||||
}
|
||||
public ModeData Mode { get; set; }
|
||||
// Asset list.
|
||||
@@ -161,11 +161,11 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Assets
|
||||
responseData.Mode = new AjaxResponse_AssetList.ModeData();
|
||||
Model_Asset.ViewMode viewMode = model.GetFilterMode();
|
||||
if (viewMode == Model_Asset.ViewMode.Maintain)
|
||||
responseData.Mode.Maintain = true;
|
||||
responseData.Mode.Maintain = 1;
|
||||
else if (viewMode == Model_Asset.ViewMode.AssetsForItem)
|
||||
responseData.Mode.AssetsForItem = true;
|
||||
responseData.Mode.AssetsForItem = 1;
|
||||
else
|
||||
responseData.Mode.Search = true;
|
||||
responseData.Mode.Search = 1;
|
||||
|
||||
// Item filter.
|
||||
SbmAsset.Params prmAsset = new SbmAsset.Params();
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Codes
|
||||
private class AjaxResponse_CodeList : AjaxResponse_Data
|
||||
{
|
||||
// Construction.
|
||||
public AjaxResponse_CodeList(SbmModel_Portal model) : base(model) { }
|
||||
public AjaxResponse_CodeList(SbmModel_Portal model, String messageTitle) : base(model, messageTitle) { }
|
||||
// Reference data.
|
||||
public List<ItemCodeDesc> CodeTypes { get; } = new List<ItemCodeDesc>();
|
||||
public List<ItemCodeDesc> Statuses { get; } = new List<ItemCodeDesc>();
|
||||
@@ -81,7 +81,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Codes
|
||||
public IActionResult Ajax_GetCodeList(Model_Code model)
|
||||
{
|
||||
String messageTitle = Localiser["label.codes"];
|
||||
AjaxResponse_CodeList responseData = new AjaxResponse_CodeList(model);
|
||||
AjaxResponse_CodeList responseData = new AjaxResponse_CodeList(model, messageTitle);
|
||||
|
||||
// Validate session and referrer.
|
||||
if (!ValidReferer) return Forbid();
|
||||
@@ -161,7 +161,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Codes
|
||||
private class AjaxResponse_Code : AjaxResponse_Data
|
||||
{
|
||||
// Construction.
|
||||
public AjaxResponse_Code(SbmModel_Portal model) : base(model) { }
|
||||
public AjaxResponse_Code(SbmModel_Portal model, String messageTitle) : base(model, messageTitle) { }
|
||||
// Code details.
|
||||
public CodeItemData code { get; } = new CodeItemData();
|
||||
}
|
||||
@@ -172,7 +172,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Codes
|
||||
public IActionResult Ajax_GetCode(Model_Code model)
|
||||
{
|
||||
String messageTitle = Localiser["label.code"];
|
||||
AjaxResponse_Code responseData = new AjaxResponse_Code(model);
|
||||
AjaxResponse_Code responseData = new AjaxResponse_Code(model, messageTitle);
|
||||
|
||||
// Validate session and referrer.
|
||||
if (!ValidReferer) return Forbid();
|
||||
@@ -222,7 +222,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Codes
|
||||
public IActionResult Ajax_StoreCode(Model_Code model)
|
||||
{
|
||||
String messageTitle = Localiser["label.code"];
|
||||
AjaxResponse_Code responseData = new AjaxResponse_Code(model);
|
||||
AjaxResponse_Code responseData = new AjaxResponse_Code(model, messageTitle);
|
||||
|
||||
// Validate session and referrer.
|
||||
if (!ValidReferer) return Forbid();
|
||||
|
||||
@@ -23,12 +23,13 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Codes
|
||||
//-------------------------------------------------------------------
|
||||
// Definitions.
|
||||
|
||||
// CodeType data.
|
||||
// Code Type response data.
|
||||
private class CodeTypeListData : AjaxResponse_Data.ItemData_Base
|
||||
{
|
||||
public String Code { get; set; }
|
||||
public String Name { get; set; }
|
||||
public long? CodeCount { get; set; }
|
||||
public byte? CodeLength { get; set; }
|
||||
}
|
||||
private class CodeTypeItemData : CodeTypeListData
|
||||
{
|
||||
@@ -39,6 +40,10 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Codes
|
||||
data.Id = SysId.ToString(codeType.Id);
|
||||
data.Code = codeType.Code;
|
||||
data.Name = codeType.Name;
|
||||
if (codeType.MaxCodeLen > 0) data.CodeLength = codeType.MaxCodeLen;
|
||||
long codeCount = model.GetInternals().CodeTypeConsole.GetCodeTypeCountById(codeType.Id);
|
||||
if (codeCount > 0)
|
||||
data.CodeCount = codeCount;
|
||||
data.StatusCode = codeType.StatusCode;
|
||||
data.StatusDesc = codeType.StatusDesc;
|
||||
}
|
||||
@@ -50,14 +55,46 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Codes
|
||||
data.Notes = codeType.Notes;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Populate Code Types ajax request.
|
||||
//-------------------------------------------------------------------
|
||||
// Populate response only used on error. Successful population returns Code Type list response.
|
||||
private class AjaxResponse_PopulateCodeType : AjaxResponse_CodeTypeList
|
||||
{
|
||||
// Construction.
|
||||
public AjaxResponse_PopulateCodeType(SbmModel_Portal model, String messageTitle) : base(model, messageTitle) { }
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
[Route("Codes/CodeType/Ajax/Populate")]
|
||||
public IActionResult Ajax_PopulateCodeTypes(Model_CodeType model)
|
||||
{
|
||||
String messageTitle = Localiser["caption.code.types"];
|
||||
AjaxResponse_CodeTypeList responseData = new AjaxResponse_CodeTypeList(model, messageTitle);
|
||||
|
||||
// Validate session and referrer.
|
||||
if (!ValidReferer) return Forbid();
|
||||
if (!ValidUserSession) return GetAjaxResult_InvalidSession(responseData);
|
||||
RefreshModel(model);
|
||||
|
||||
// Populate Code Types.
|
||||
if (CodeTypeConsole.Populate(DbUpdateInfo))
|
||||
model.AddInfoMessage(Localiser["msg.items.populated"]);
|
||||
else
|
||||
model.AddWarningMessage(Localiser["msg.error.system"]);
|
||||
|
||||
// Return Code Type list.
|
||||
return Ajax_GetCodeTypeList(model);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Get CodeType List ajax request.
|
||||
//-------------------------------------------------------------------
|
||||
private class AjaxResponse_CodeTypeList : AjaxResponse_Data
|
||||
{
|
||||
// Construction.
|
||||
public AjaxResponse_CodeTypeList(SbmModel_Portal model) : base(model) { }
|
||||
// CodeTYpe list.
|
||||
public AjaxResponse_CodeTypeList(SbmModel_Portal model, String messageTitle) : base(model, messageTitle) { }
|
||||
// Code Type list.
|
||||
public List<CodeTypeListData> CodeTypes { get; } = new List<CodeTypeListData>();
|
||||
// Reference data.
|
||||
public List<ItemCodeDesc> Statuses { get; } = new List<ItemCodeDesc>();
|
||||
@@ -72,7 +109,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Codes
|
||||
public IActionResult Ajax_GetCodeTypeList(Model_CodeType model)
|
||||
{
|
||||
String messageTitle = Localiser["caption.code.types"];
|
||||
AjaxResponse_CodeTypeList responseData = new AjaxResponse_CodeTypeList(model);
|
||||
AjaxResponse_CodeTypeList responseData = new AjaxResponse_CodeTypeList(model, messageTitle);
|
||||
|
||||
// Validate session and referrer.
|
||||
if (!ValidReferer) return Forbid();
|
||||
@@ -99,11 +136,12 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Codes
|
||||
ColumnDfn colId = CodeTypeConsole.GetCodeTypeColumnDfn(SaCodeType.Column.Id);
|
||||
ColumnDfn colCode = CodeTypeConsole.GetCodeTypeColumnDfn(SaCodeType.Column.Code);
|
||||
ColumnDfn colName = CodeTypeConsole.GetCodeTypeColumnDfn(SaCodeType.Column.Name);
|
||||
ColumnDfn colMaxCodeLen = CodeTypeConsole.GetCodeTypeColumnDfn(SaCodeType.Column.MaxCodeLen);
|
||||
ColumnDfn colCodeCount = CodeTypeConsole.GetCodeTypeColumnDfn(SaCodeType.Column.Codes_Count);
|
||||
ColumnDfn colStatus = CodeTypeConsole.GetCodeTypeColumnDfn(SaCodeType.Column.Status);
|
||||
List<ColumnDfn> columns = new List<ColumnDfn>()
|
||||
{
|
||||
colId, colCode, colName,
|
||||
colId, colCode, colName, colMaxCodeLen,
|
||||
colCodeCount, colStatus
|
||||
};
|
||||
prmCodeType.SortColumns.Add(colName);
|
||||
@@ -123,6 +161,9 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Codes
|
||||
StatusCode = values.GetString(colStatus.DataName),
|
||||
StatusDesc = SacsSystem.GetStatusDescForCode(values.GetString(colStatus.DataName))
|
||||
};
|
||||
byte maxCodeLen = (byte)values.GetLong(colMaxCodeLen.DataName);
|
||||
if (maxCodeLen > 0)
|
||||
codeTypeData.CodeLength = maxCodeLen;
|
||||
long codeCount = values.GetLong(colCodeCount.DataName);
|
||||
if (codeCount > 0)
|
||||
codeTypeData.CodeCount = codeCount;
|
||||
@@ -144,7 +185,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Codes
|
||||
private class AjaxResponse_CodeType : AjaxResponse_Data
|
||||
{
|
||||
// Construction.
|
||||
public AjaxResponse_CodeType(SbmModel_Portal model) : base(model) { }
|
||||
public AjaxResponse_CodeType(SbmModel_Portal model, String messageTitle) : base(model, messageTitle) { }
|
||||
// CodeType details.
|
||||
public CodeTypeItemData codeType { get; } = new CodeTypeItemData();
|
||||
}
|
||||
@@ -155,7 +196,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Codes
|
||||
public IActionResult Ajax_GetCodeType(Model_CodeType model)
|
||||
{
|
||||
String messageTitle = Localiser["caption.code.type"];
|
||||
AjaxResponse_CodeType responseData = new AjaxResponse_CodeType(model);
|
||||
AjaxResponse_CodeType responseData = new AjaxResponse_CodeType(model, messageTitle);
|
||||
|
||||
// Validate session and referrer.
|
||||
if (!ValidReferer) return Forbid();
|
||||
@@ -196,7 +237,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Codes
|
||||
public IActionResult Ajax_StoreCodeType(Model_CodeType model)
|
||||
{
|
||||
String messageTitle = Localiser["caption.code.type"];
|
||||
AjaxResponse_CodeType responseData = new AjaxResponse_CodeType(model);
|
||||
AjaxResponse_CodeType responseData = new AjaxResponse_CodeType(model, messageTitle);
|
||||
|
||||
// Validate session and referrer.
|
||||
if (!ValidReferer) return Forbid();
|
||||
|
||||
+8
-8
@@ -205,10 +205,10 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Commodities
|
||||
// View mode.
|
||||
public class ModeData
|
||||
{
|
||||
public bool? Search { get; set; }
|
||||
public bool? Maintain { get; set; }
|
||||
public bool? StockControl { get; set; }
|
||||
public bool? StockTake { get; set; }
|
||||
public ushort? Search { get; set; }
|
||||
public ushort? Maintain { get; set; }
|
||||
public ushort? StockControl { get; set; }
|
||||
public ushort? StockTake { get; set; }
|
||||
}
|
||||
public ModeData Mode { get; set; }
|
||||
// Commodity list.
|
||||
@@ -235,13 +235,13 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Commodities
|
||||
responseData.Mode = new AjaxResponse_CommodityList.ModeData();
|
||||
Model_Commodity.ViewMode viewMode = model.GetFilterMode();
|
||||
if (viewMode == Model_Commodity.ViewMode.Maintain)
|
||||
responseData.Mode.Maintain = true;
|
||||
responseData.Mode.Maintain = 1;
|
||||
else if (viewMode == Model_Commodity.ViewMode.StockControl)
|
||||
responseData.Mode.StockControl = true;
|
||||
responseData.Mode.StockControl = 1;
|
||||
else if (viewMode == Model_Commodity.ViewMode.StockTake)
|
||||
responseData.Mode.StockTake = true;
|
||||
responseData.Mode.StockTake = 1;
|
||||
else
|
||||
responseData.Mode.Search = true;
|
||||
responseData.Mode.Search = 1;
|
||||
|
||||
// Item filter.
|
||||
SbmCommodity.Params prmCommodity = new SbmCommodity.Params();
|
||||
|
||||
+8
-8
@@ -161,10 +161,10 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Contacts
|
||||
// View mode.
|
||||
public class ModeData
|
||||
{
|
||||
public bool? Search { get; set; }
|
||||
public bool? Maintain { get; set; }
|
||||
public bool? Relationships { get; set; }
|
||||
public bool? PriceSet { get; set; }
|
||||
public ushort? Search { get; set; }
|
||||
public ushort? Maintain { get; set; }
|
||||
public ushort? Relationships { get; set; }
|
||||
public ushort? PriceSet { get; set; }
|
||||
}
|
||||
public ModeData Mode { get; set; }
|
||||
// Association list.
|
||||
@@ -191,13 +191,13 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Contacts
|
||||
responseData.Mode = new AjaxResponse_AssociationList.ModeData();
|
||||
Model_Association.ViewMode viewMode = model.GetFilterMode();
|
||||
if (viewMode == Model_Association.ViewMode.Maintain)
|
||||
responseData.Mode.Maintain = true;
|
||||
responseData.Mode.Maintain = 1;
|
||||
else if (viewMode == Model_Association.ViewMode.Relationships)
|
||||
responseData.Mode.Relationships = true;
|
||||
responseData.Mode.Relationships = 1;
|
||||
else if (viewMode == Model_Association.ViewMode.PriceSet)
|
||||
responseData.Mode.PriceSet = true;
|
||||
responseData.Mode.PriceSet = 1;
|
||||
else
|
||||
responseData.Mode.Search = true;
|
||||
responseData.Mode.Search = 1;
|
||||
|
||||
// Item filter.
|
||||
SbmAssociation.Params prmAssociation = new SbmAssociation.Params();
|
||||
|
||||
@@ -54,9 +54,9 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Contacts
|
||||
// Association page.
|
||||
Model_Association model = new Model_Association(Localiser);
|
||||
RefreshModel(model);
|
||||
if (Request.Path.Value.MatchCI("/Customers/?$"))
|
||||
if (Request.Path.Value.IsMatchCI("/Customers/?$"))
|
||||
model.Filter.AssociationType = Internals.AssociationTypeCodes.GetCodeForType(Sbm.AssociationType.Customer);
|
||||
else if (Request.Path.Value.MatchCI("/Suppliers/?$"))
|
||||
else if (Request.Path.Value.IsMatchCI("/Suppliers/?$"))
|
||||
model.Filter.AssociationType = Internals.AssociationTypeCodes.GetCodeForType(Sbm.AssociationType.Supplier);
|
||||
model.PopulateListConfig();
|
||||
model.Paging.PageNo = SessionData_Portal.Profile.Association.Filter.PageNo;
|
||||
|
||||
@@ -190,8 +190,8 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Contacts
|
||||
// View mode.
|
||||
public class ModeData
|
||||
{
|
||||
public bool? Maintain { get; set; }
|
||||
public bool? Search { get; set; }
|
||||
public ushort? Maintain { get; set; }
|
||||
public ushort? Search { get; set; }
|
||||
}
|
||||
public ModeData Mode { get; set; }
|
||||
// Affiliate list.
|
||||
@@ -218,13 +218,14 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Contacts
|
||||
responseData.Mode = new AjaxResponse_ContactList.ModeData();
|
||||
Model_Contact.ViewMode viewMode = model.GetFilterMode();
|
||||
if (viewMode == Model_Contact.ViewMode.Maintain)
|
||||
responseData.Mode.Maintain = true;
|
||||
responseData.Mode.Maintain = 1;
|
||||
else
|
||||
responseData.Mode.Search = true;
|
||||
responseData.Mode.Search = 1;
|
||||
|
||||
// Item filter.
|
||||
SbmAffiliate.Params prmAffiliate = new SbmAffiliate.Params();
|
||||
prmAffiliate.Search = model.Filter.Search;
|
||||
prmAffiliate.AssociationTypeExclude = model.GetFilterAssociationTypeExclude();
|
||||
prmAffiliate.AffiliateType = model.GetFilterContactType();
|
||||
if (prmAffiliate.AffiliateType == Sbm.AffiliateType.Any && viewMode == Model_Contact.ViewMode.Search)
|
||||
prmAffiliate.AffiliateType = Sbm.AffiliateType.AnyContact;
|
||||
|
||||
+602
@@ -0,0 +1,602 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
||||
using Sarand.BusinessMgr.Web.Portal.Components;
|
||||
using Sarand.BusinessMgr.Web.Portal.Models.Contacts;
|
||||
using Sarand.BusinessMgr.Web.Portal.Models.Requirements;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.ReferenceData;
|
||||
using Sarand.Net.Standard.Base.Security;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Transactions;
|
||||
|
||||
namespace Sarand.BusinessMgr.Web.Portal.Controllers.Requirements
|
||||
{
|
||||
//=======================================================================
|
||||
// Portal Requirement Controller - Ajax actions.
|
||||
//=======================================================================
|
||||
partial class RequirementController
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Item data.
|
||||
private class RequirementListData : AjaxResponse_Data.ItemData_Base
|
||||
{
|
||||
// Field values.
|
||||
public AjaxResponse_Data.FieldValuesData Field { get; } = new AjaxResponse_Data.FieldValuesData();
|
||||
}
|
||||
private enum RequirementDataGroup
|
||||
{
|
||||
Core, Costing
|
||||
}
|
||||
private class RequirementItemData : RequirementListData
|
||||
{
|
||||
// Affiliate properties with specific handling.
|
||||
}
|
||||
private void PopulateRequirementResponseListData(SbmModel_Portal model, SbmTransaction transaction, SbmRequirement requirement, RequirementListData data)
|
||||
{
|
||||
data.Id = SysId.ToString(requirement.Id);
|
||||
data.Field.Value.Add($"{Model_Requirement.ItemField.Id}", $"{SysId.ToLong(requirement.Id)}");
|
||||
// Status dates for list refresh.
|
||||
data.Field.Value.Add($"{Model_Requirement.ItemField.RequiredFmt}", model.FormatDateForDisplay(requirement.Required));
|
||||
}
|
||||
private void PopulateRequirementResponseItemData(SbmModel_Portal model, SbmTransaction transaction, SbmRequirement requirement, RequirementItemData data, HashSet<RequirementDataGroup> dataGroups = null)
|
||||
{
|
||||
PopulateRequirementResponseListData(model, transaction, requirement, data as RequirementListData);
|
||||
// Requirement properties.
|
||||
data.Field.Value.Add($"{Model_Requirement.ItemField.TransactionId}", $"{SysId.ToLong(requirement.TransactionId)}");
|
||||
data.Field.Value.Add($"{Model_Requirement.ItemField.Type}", Internals.RequirementTypeCodes.GetDescForType(requirement.RequirementType));
|
||||
data.Field.Value.Add($"{Model_Requirement.ItemField.Sequence}", $"{requirement.Seq}");
|
||||
data.Field.Value.Add($"{Model_Requirement.ItemField.JobNumber}", requirement.JobNumber);
|
||||
data.Field.Value.Add($"{Model_Requirement.ItemField.Required}", model.FormatDateForForm(requirement.Required));
|
||||
data.Field.Value.Add($"{Model_Requirement.ItemField.DescBrief}", requirement.DescBrief);
|
||||
data.Field.Value.Add($"{Model_Requirement.ItemField.CommodityId}", $"{SysId.ToLong(requirement.CommodityId)}");
|
||||
data.Field.Value.Add($"{Model_Requirement.ItemField.ProductCode}", requirement.ProductCode);
|
||||
data.Field.Value.Add($"{Model_Requirement.ItemField.Quantity}", $"{requirement.Quantity}");
|
||||
data.Field.Value.Add($"{Model_Requirement.ItemField.QuantityProd}", $"{requirement.QuantityProd}");
|
||||
data.Field.Value.Add($"{Model_Requirement.ItemField.UomId}", $"{SysId.ToLong(requirement.UomId)}");
|
||||
data.Field.Value.Add($"{Model_Requirement.ItemField.MaterialSourceCode}", requirement.MaterialSourceCode);
|
||||
data.Field.Value.Add($"{Model_Requirement.ItemField.PromotionCode}", requirement.PromotionCode);
|
||||
data.Field.Value.Add($"{Model_Requirement.ItemField.LocationIdStock}", $"{SysId.ToLong(requirement.LocationIdStock)}");
|
||||
// Amounts.
|
||||
data.Field.Value.Add($"{Model_Requirement.ItemField.AmountUnit}", $"{requirement.AmountUnit}");
|
||||
data.Field.Value.Add($"{Model_Requirement.ItemField.AmountAct}", $"{requirement.AmountAct}");
|
||||
data.Field.Value.Add($"{Model_Requirement.ItemField.AmountDisc}", $"{requirement.AmountDisc}");
|
||||
data.Field.Value.Add($"{Model_Requirement.ItemField.AmountNet}", $"{requirement.AmountNet}");
|
||||
data.Field.Value.Add($"{Model_Requirement.ItemField.TaxCode}", Internals.GetTaxCodeById(requirement.TaxCodeId)?.Code);
|
||||
data.Field.Value.Add($"{Model_Requirement.ItemField.TaxCodeId}", $"{SysId.ToLong(requirement.TaxCodeId)}");
|
||||
data.Field.Value.Add($"{Model_Requirement.ItemField.TaxRate}", $"{Internals.GetTaxCodeById(requirement.TaxCodeId)?.TaxRate}");
|
||||
data.Field.Value.Add($"{Model_Requirement.ItemField.AmountTax}", $"{requirement.AmountTax}");
|
||||
data.Field.Value.Add($"{Model_Requirement.ItemField.AmountTot}", $"{requirement.AmountTot}");
|
||||
// Times.
|
||||
data.Field.Value.Add($"{Model_Requirement.ItemField.TimeEst}", $"{requirement.TimeEst}");
|
||||
data.Field.Value.Add($"{Model_Requirement.ItemField.TimeAct}", $"{requirement.TimeAct}");
|
||||
data.Field.Value.Add($"{Model_Requirement.ItemField.TimeTot}", $"{requirement.TimeTot}");
|
||||
if (dataGroups != null && dataGroups.Contains(RequirementDataGroup.Core))
|
||||
{
|
||||
// Core.
|
||||
}
|
||||
if (dataGroups != null && dataGroups.Contains(RequirementDataGroup.Costing))
|
||||
{
|
||||
// Costing.
|
||||
// CostLabourHours
|
||||
// CostLabourRateHour
|
||||
// CostLabour
|
||||
// CostCommodity
|
||||
// CostPurchase
|
||||
// CostProcess
|
||||
// CostAdditional
|
||||
// CostTotal
|
||||
// CostCalculated
|
||||
// CostPercentMargin
|
||||
}
|
||||
// Common properties.
|
||||
data.StatusCode = requirement.StatusCode;
|
||||
data.StatusDesc = requirement.StatusDesc;
|
||||
data.Field.Value.Add($"{Model_Contact.ItemField.Status}", requirement.StatusDesc);
|
||||
// Cleanse field values.
|
||||
data.Field.Value.RemoveAll(item => StringUtil.IsBlank(item.Value));
|
||||
// Populate item list values that might be cleared during update after removing blank values to ensure that blank values are published.
|
||||
data.Field.Value.Add($"{Model_Requirement.ItemField.Notes}", requirement.Notes);
|
||||
data.Field.Value.Add($"{Model_Requirement.ItemField.UpdatedOn}", model.FormatDateForForm(requirement.UpdateStamp.On));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Requirement configuration.
|
||||
//-------------------------------------------------------------------
|
||||
private class AjaxResponse_RequirementConfig : AjaxResponse_Data
|
||||
{
|
||||
// Construction.
|
||||
public AjaxResponse_RequirementConfig(SbmModel_Portal model) : base(model) { }
|
||||
// Configuration data - object copied directly to env.datain script.
|
||||
public class ConfigData
|
||||
{
|
||||
// Configurations.
|
||||
public Model_Requirement.ListConfigData CfgList { get; } = new Model_Requirement.ListConfigData();
|
||||
public Model_Requirement.ItemConfigData CfgItemNew { get; } = new Model_Requirement.ItemConfigData();
|
||||
// Reference data.
|
||||
public List<ItemCodeDesc> RequirementTypes { get; } = new List<ItemCodeDesc>();
|
||||
public List<TaxCode> TaxCodes { get; } = new List<TaxCode>();
|
||||
public String taxCodeDefault { get; set; }
|
||||
public List<ItemCodeDesc> UomCats { get; } = new List<ItemCodeDesc>();
|
||||
public List<ItemCodeDesc> UomTypes { get; } = new List<ItemCodeDesc>();
|
||||
public String uomTypeDefault { get; set; }
|
||||
public List<UomData> Uoms { get; set; } = new List<UomData>();
|
||||
public List<ItemCodeDesc> Statuses { get; } = new List<ItemCodeDesc>();
|
||||
public String DefaultStatusCode { get; set; }
|
||||
}
|
||||
public ConfigData Data { get; set; } = new ConfigData();
|
||||
}
|
||||
// Ajax request.
|
||||
[HttpPost]
|
||||
[Route("Requirement/Ajax/Config")]
|
||||
[Route("Requirement/Ajax/GetConfig")]
|
||||
public IActionResult Ajax_RequirementConfig(Model_Requirement model)
|
||||
{
|
||||
AjaxResponse_RequirementConfig responseData = new AjaxResponse_RequirementConfig(model);
|
||||
String messageTitle = Localiser["label.requirements"];
|
||||
|
||||
// Validate session and referrer.
|
||||
if (!ValidUserSession) return GetAjaxResult_InvalidSession(responseData);
|
||||
if (!ValidReferer) return Forbid();
|
||||
RefreshModel(model);
|
||||
|
||||
// Populate configuration data.
|
||||
PopulateRequirementConfig(model, responseData);
|
||||
|
||||
// Complete response.
|
||||
responseData.Success = true;
|
||||
return Json(responseData);
|
||||
}
|
||||
private void PopulateRequirementConfig(Model_Requirement model, AjaxResponse_RequirementConfig responseData)
|
||||
{
|
||||
// Configuration.
|
||||
model.PopulateListConfig(responseData.Data.CfgList);
|
||||
model.PopulateItemConfig(responseData.Data.CfgItemNew, null, model.GetFilterTransactionType(), SbmTransaction.StatusCat.Pending, Sbm.RequirementType.Unknown);
|
||||
|
||||
// Reference data - requirement types.
|
||||
foreach (TypeCodeDesc requirementType in GetSystemCodes(Sbm.SystemCode.RequirementType))
|
||||
responseData.Data.RequirementTypes.Add(new AjaxResponse_Data.ItemCodeDesc(requirementType.Code, requirementType.Desc));
|
||||
|
||||
// Tax codes.
|
||||
DateTime taxEffectiveOn = DateTime.Today;
|
||||
responseData.Data.TaxCodes.AddRange(Internals.GetTaxCodesEffectiveOn(taxEffectiveOn).Select(tax => new AjaxResponse_Data.TaxCode() { Id = $"{SysId.ToLong(tax.Id)}", Code = tax.Code, Caption = tax.GetCaption(), Rate = tax.TaxRate }));
|
||||
responseData.Data.taxCodeDefault = Internals.GetDefaultTaxCode();
|
||||
|
||||
// Units of measure.
|
||||
List<TypeCodeDesc> uomCategories = SbmSystem.GetSystemCodes(Sbm.SystemCode.UnitMeasureCategory);
|
||||
List<TypeCodeDesc> uomTypes = SbmSystem.GetSystemCodes(Sbm.SystemCode.UnitMeasureType);
|
||||
responseData.Data.UomCats.AddRange(uomCategories.Select(item => new AjaxResponse_Data.ItemCodeDesc(item.Code, item.Desc)));
|
||||
responseData.Data.UomTypes.AddRange(uomTypes.Select(item => new AjaxResponse_Data.ItemCodeDesc(item.Code, item.Desc)));
|
||||
foreach (SaUnitMeasure uom in Internals.GetUnitsOfMeasure())
|
||||
{
|
||||
responseData.Data.Uoms.Add(new AjaxResponse_Data.UomData()
|
||||
{
|
||||
Id = $"{SysId.ToLong(uom.Id)}",
|
||||
Category = uomCategories.GetCodeForType(uom.Category),
|
||||
Type = uomTypes.GetCodeForType(uom.UnitType),
|
||||
Caption = uom.GetCaption()
|
||||
});
|
||||
}
|
||||
responseData.Data.uomTypeDefault = uomTypes.GetCodeForType(Internals.GetDefaultUomType());
|
||||
|
||||
// Reference data - statuses.
|
||||
foreach (SaStatus status in SbmRequirement.ValidStatuses.Where(item => item != SaStatus.Deleted))
|
||||
responseData.Data.Statuses.Add(new AjaxResponse_Data.ItemCodeDesc(SacsSystem.GetStatusCode(status), Localiser.GetStatusCaption(status)));
|
||||
responseData.Data.DefaultStatusCode = SacsSystem.GetStatusCode(SbmRequirement.DefaultStatus);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Requirement list.
|
||||
//-------------------------------------------------------------------
|
||||
private class AjaxResponse_RequirementList : AjaxResponse_RequirementConfig
|
||||
{
|
||||
// Construction.
|
||||
public AjaxResponse_RequirementList(SbmModel_Portal model) : base(model) { }
|
||||
// View mode.
|
||||
public class ModeData
|
||||
{
|
||||
public ushort? Search { get; set; }
|
||||
public ushort? Maintain { get; set; }
|
||||
public ushort? ProductionControl { get; set; }
|
||||
public ushort? CommodityHistory_Maintain { get; set; }
|
||||
public ushort? AssetOrders_Maintain { get; set; }
|
||||
public ushort? CommodityHistory_ReadOnly { get; set; }
|
||||
public ushort? AssetOrders_ReadOnly { get; set; }
|
||||
}
|
||||
public ModeData Mode { get; set; }
|
||||
// Requirement list.
|
||||
public List<RequirementListData> Requirements { get; } = new List<RequirementListData>();
|
||||
}
|
||||
// Ajax request.
|
||||
[HttpPost]
|
||||
[Route("Requirement/Ajax/List")]
|
||||
[Route("Requirement/Ajax/GetList")]
|
||||
public IActionResult Ajax_RequirementList(Model_Requirement model)
|
||||
{
|
||||
AjaxResponse_RequirementList responseData = new AjaxResponse_RequirementList(model);
|
||||
String messageTitle = Localiser["label.requirements"];
|
||||
|
||||
// Validate session and referrer.
|
||||
if (!ValidUserSession) return GetAjaxResult_InvalidSession(responseData);
|
||||
if (!ValidReferer) return Forbid();
|
||||
RefreshModel(model);
|
||||
|
||||
// Populate configuration data.
|
||||
PopulateRequirementConfig(model, responseData);
|
||||
|
||||
// View mode.
|
||||
responseData.Mode = new AjaxResponse_RequirementList.ModeData();
|
||||
Model_Requirement.ViewMode viewMode = model.GetFilterMode();
|
||||
if (viewMode == Model_Requirement.ViewMode.Maintain)
|
||||
responseData.Mode.Maintain = 1;
|
||||
else if (viewMode == Model_Requirement.ViewMode.ProductionControl)
|
||||
responseData.Mode.ProductionControl = 1;
|
||||
else if (viewMode == Model_Requirement.ViewMode.CommodityHistory_Maintain)
|
||||
responseData.Mode.CommodityHistory_Maintain = 1;
|
||||
else if (viewMode == Model_Requirement.ViewMode.AssetOrders_Maintain)
|
||||
responseData.Mode.AssetOrders_Maintain = 1;
|
||||
else if (viewMode == Model_Requirement.ViewMode.CommodityHistory_ReadOnly)
|
||||
responseData.Mode.CommodityHistory_ReadOnly = 1;
|
||||
else if (viewMode == Model_Requirement.ViewMode.AssetOrders_ReadOnly)
|
||||
responseData.Mode.AssetOrders_ReadOnly = 1;
|
||||
else
|
||||
responseData.Mode.Search = 1;
|
||||
|
||||
// Item filter.
|
||||
SbmRequirement.Params prmRequirement = new SbmRequirement.Params();
|
||||
prmRequirement.TransactionIdsIncluded.AddId(model.GetFilterTransactionId());
|
||||
prmRequirement.Search = model.Filter.Search;
|
||||
if (model.GetFilterRequirementStatusCat() > 0)
|
||||
prmRequirement.StatusCat = model.GetFilterRequirementStatusCat();
|
||||
else prmRequirement.StatusCat = SbmRequirement.StatusCat.NotDeleted;
|
||||
if (viewMode == Model_Requirement.ViewMode.ProductionControl)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
prmRequirement.SortColumns.Add(TransactionMgr.GetRequirementColumnDfn(SbmRequirement.Column.TransId));
|
||||
prmRequirement.SortColumns.Add(TransactionMgr.GetRequirementColumnDfn(SbmRequirement.Column.Sequence));
|
||||
}
|
||||
model.Paging.ItemTotal = (ulong)TransactionMgr.GetRequirementCount(prmRequirement);
|
||||
model.PopulatePagingTo(prmRequirement.ResultsPaging);
|
||||
|
||||
// Item columns.
|
||||
ColumnDfn colId = TransactionMgr.GetRequirementColumnDfn(SbmRequirement.Column.Id);
|
||||
ColumnDfn colTransType = TransactionMgr.GetRequirementColumnDfn(SbmRequirement.Column.Trans_Type);
|
||||
ColumnDfn colTransRef = TransactionMgr.GetRequirementColumnDfn(SbmRequirement.Column.Trans_Ref);
|
||||
ColumnDfn colType = TransactionMgr.GetRequirementColumnDfn(SbmRequirement.Column.Type);
|
||||
ColumnDfn colSequence = TransactionMgr.GetRequirementColumnDfn(SbmRequirement.Column.Sequence);
|
||||
ColumnDfn colJobNumber = TransactionMgr.GetRequirementColumnDfn(SbmRequirement.Column.JobNumber);
|
||||
ColumnDfn colProductCode = TransactionMgr.GetRequirementColumnDfn(SbmRequirement.Column.ProductCode);
|
||||
ColumnDfn colDescBrief = TransactionMgr.GetRequirementColumnDfn(SbmRequirement.Column.DescBrief);
|
||||
ColumnDfn colRequiredOn = TransactionMgr.GetRequirementColumnDfn(SbmRequirement.Column.Required);
|
||||
ColumnDfn colQuantity = TransactionMgr.GetRequirementColumnDfn(SbmRequirement.Column.Quantity);
|
||||
ColumnDfn colAmountUnit = TransactionMgr.GetRequirementColumnDfn(SbmRequirement.Column.AmountUnit);
|
||||
ColumnDfn colAmountNet = TransactionMgr.GetRequirementColumnDfn(SbmRequirement.Column.AmountNet);
|
||||
ColumnDfn colAmountTax = TransactionMgr.GetRequirementColumnDfn(SbmRequirement.Column.AmountTax);
|
||||
ColumnDfn colAmountTot = TransactionMgr.GetRequirementColumnDfn(SbmRequirement.Column.AmountTot);
|
||||
ColumnDfn colNotes = TransactionMgr.GetRequirementColumnDfn(SbmRequirement.Column.Notes);
|
||||
ColumnDfn colStatus = TransactionMgr.GetRequirementColumnDfn(SbmRequirement.Column.Status);
|
||||
ColumnDfn colCreatedOn = TransactionMgr.GetRequirementColumnDfn(SbmRequirement.Column.CreateOn_Date);
|
||||
ColumnDfn colUpdatedOn = TransactionMgr.GetRequirementColumnDfn(SbmRequirement.Column.UpdateOn_Date);
|
||||
List<ColumnDfn> columns = new List<ColumnDfn>()
|
||||
{
|
||||
colId, colTransType, colTransRef, colType, colSequence, colJobNumber,
|
||||
colProductCode, colDescBrief, colQuantity, colRequiredOn,
|
||||
colNotes, colStatus, colCreatedOn, colUpdatedOn
|
||||
};
|
||||
if (model.UserCanViewFinancials())
|
||||
columns.AddRange(new[] { colAmountUnit, colAmountNet, colAmountTax, colAmountTot });
|
||||
|
||||
// Query items.
|
||||
using (DbResultSet resultSet = TransactionMgr.ExecuteRequirementQuery(columns, prmRequirement))
|
||||
{
|
||||
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
|
||||
{
|
||||
NamedValue.Map values = resultSet.GetRecordValues();
|
||||
Sbm.TransactionType transactionType = (Sbm.TransactionType)values.GetLong(colTransType.DataName);
|
||||
Sbm.RequirementType requirementType = (Sbm.RequirementType)values.GetLong(colType.DataName);
|
||||
RequirementListData requirementData = new RequirementListData()
|
||||
{
|
||||
Id = values.GetString(colId.DataName),
|
||||
StatusCode = values.GetString(colStatus.DataName),
|
||||
};
|
||||
requirementData.Field.Value.Add($"{Model_Requirement.ItemField.Sequence}", values.GetString(colSequence.DataName));
|
||||
requirementData.Field.Value.Add($"{Model_Requirement.ItemField.TransactionType}", Internals.TransactionTypeCodes.GetDescForType(transactionType));
|
||||
requirementData.Field.Value.Add($"{Model_Requirement.ItemField.TransactionRef}", values.GetString(colTransRef.DataName));
|
||||
requirementData.Field.Value.Add($"{Model_Requirement.ItemField.Type}", Internals.RequirementTypeCodes.GetDescForType(transactionType));
|
||||
requirementData.Field.Value.Add($"{Model_Requirement.ItemField.ProductCode}", values.GetString(colProductCode.DataName));
|
||||
requirementData.Field.Value.Add($"{Model_Requirement.ItemField.DescBrief}", values.GetString(colDescBrief.DataName));
|
||||
requirementData.Field.Value.Add($"{Model_Requirement.ItemField.RequiredFmt}", model.FormatDateForDisplay(values.GetDate(colRequiredOn.DataName)));
|
||||
requirementData.Field.Value.Add($"{Model_Requirement.ItemField.Quantity}", colQuantity.FormatValue(values));
|
||||
// Status dates.
|
||||
if (model.UserCanViewFinancials())
|
||||
{
|
||||
requirementData.Field.Value.Add($"{Model_Requirement.ItemField.AmountUnit}", colAmountUnit.FormatValue(values));
|
||||
requirementData.Field.Value.Add($"{Model_Requirement.ItemField.AmountNet}", colAmountNet.FormatValue(values));
|
||||
requirementData.Field.Value.Add($"{Model_Requirement.ItemField.AmountTax}", colAmountTax.FormatValue(values));
|
||||
requirementData.Field.Value.Add($"{Model_Requirement.ItemField.AmountTot}", colAmountTot.FormatValue(values));
|
||||
}
|
||||
requirementData.Field.Value.Add($"{Model_Requirement.ItemField.Notes}", TransactionMgr.GetRequirementDataValue(colNotes, values).ToString());
|
||||
requirementData.Field.Value.Add($"{Model_Requirement.ItemField.Status}", SacsSystem.GetStatusDescForCode(values.GetString(colStatus.DataName)));
|
||||
requirementData.Field.Value.Add($"{Model_Requirement.ItemField.CreatedOn}", Localiser.FormatDate(values.GetDate(colCreatedOn.DataName)));
|
||||
requirementData.Field.Value.Add($"{Model_Requirement.ItemField.UpdatedOn}", Localiser.FormatDate(values.GetDate(colUpdatedOn.DataName)));
|
||||
// Cleanse item values.
|
||||
requirementData.Field.Value.RemoveAll(item => StringUtil.IsBlank(item.Value));
|
||||
responseData.Requirements.Add(requirementData);
|
||||
}
|
||||
}
|
||||
|
||||
// Refresh paging info.
|
||||
if (model.Paging.IsPaged)
|
||||
model.Paging.ItemCount = (ushort)responseData.Requirements.Count;
|
||||
if (viewMode == Model_Requirement.ViewMode.ProductionControl)
|
||||
{
|
||||
SessionData_Portal.Profile.ProductionControl.Filter.PageNo = model.Paging.PageNo;
|
||||
SessionData_Portal.Profile.ProductionControl.Filter.PageLength = model.Paging.PageLength;
|
||||
}
|
||||
responseData.SetPaging(model);
|
||||
|
||||
// Complete response.
|
||||
responseData.Success = true;
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Get Requirement ajax request.
|
||||
//-------------------------------------------------------------------
|
||||
private class AjaxResponse_Requirement : AjaxResponse_Data
|
||||
{
|
||||
// Construction.
|
||||
public AjaxResponse_Requirement(SbmModel_Portal model) : base(model) { }
|
||||
// Configuration.
|
||||
public Model_Requirement.ItemConfigData Config { get; } = new Model_Requirement.ItemConfigData();
|
||||
// Requirement details.
|
||||
public RequirementItemData requirement { get; } = new RequirementItemData();
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
[Route("Requirement/Ajax/Item")]
|
||||
[Route("Requirement/Ajax/GetItem")]
|
||||
public IActionResult Ajax_GetItem(Model_Requirement model)
|
||||
{
|
||||
String messageTitle = Localiser["label.requirement"];
|
||||
AjaxResponse_Requirement responseData = new AjaxResponse_Requirement(model);
|
||||
|
||||
// Validate session and referrer.
|
||||
if (!ValidUserSession) return GetAjaxResult_InvalidSession(responseData);
|
||||
if (!ValidReferer) return Forbid();
|
||||
RefreshModel(model);
|
||||
|
||||
// Identify item.
|
||||
SysId requirementId = SysId.ToSysId(model.Requirement.Id);
|
||||
if (!SysId.IsValid(requirementId))
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
|
||||
|
||||
// Retrieve item.
|
||||
SbmRequirement requirement = TransactionMgr.GetRequirementById(requirementId);
|
||||
if (requirement == null)
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve requirement for Id: '{model.Requirement.Id}'");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
|
||||
}
|
||||
|
||||
// Transaction.
|
||||
SbmTransaction transaction = TransactionMgr.GetTransactionById(requirement.TransactionId);
|
||||
if (transaction == null)
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve transaction for Id: '{requirement.TransactionId}'");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
|
||||
// Construct response.
|
||||
model.PopulateItemConfig(responseData.Config, transaction, requirement);
|
||||
PopulateRequirementResponseItemData(model, transaction, requirement, responseData.requirement);
|
||||
|
||||
// Complete response.
|
||||
responseData.Success = true;
|
||||
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Store Requirement ajax request.
|
||||
//-------------------------------------------------------------------
|
||||
private class AjaxResponse_StoreRequirement : AjaxResponse_Requirement
|
||||
{
|
||||
// Construction.
|
||||
public AjaxResponse_StoreRequirement(SbmModel_Portal model) : base(model) { }
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
[Route("Requirement/Ajax/Store")]
|
||||
[Route("Requirement/Ajax/StoreItem")]
|
||||
public IActionResult Ajax_StoreItem(Model_Requirement model)
|
||||
{
|
||||
String messageTitle = Localiser["label.requirement"];
|
||||
AjaxResponse_StoreRequirement responseData = new AjaxResponse_StoreRequirement(model);
|
||||
|
||||
// Validate session and referrer.
|
||||
if (!ValidUserSession) return GetAjaxResult_InvalidSession(responseData);
|
||||
if (!ValidReferer) return Forbid();
|
||||
RefreshModel(model);
|
||||
|
||||
// Validate item properties.
|
||||
model.ValidateRequirementData(responseData);
|
||||
if (responseData.HasControlErrors())
|
||||
return Json(responseData);
|
||||
|
||||
// Validate item Id against 'Exists' flag.
|
||||
SysId requirementId = SysId.ToSysId(model.Requirement.Id);
|
||||
bool requirementExists = StringUtil.ToBool(model.Requirement.Exists);
|
||||
if (requirementExists && !SysId.IsValid(requirementId))
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} Id not specified for existing Requirement.");
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
if (!requirementExists && SysId.IsValid(requirementId))
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} Id specified for new Requirement: '{model.Requirement.Id}'");
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
|
||||
// Retrieve existing item.
|
||||
SbmRequirement requirement = TransactionMgr.GetRequirementById(requirementId);
|
||||
if (requirement == null && SysId.IsValid(requirementId))
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve transaction for Id: '{model.Requirement.Id}'");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
|
||||
}
|
||||
|
||||
// Transaction.
|
||||
SbmTransaction transaction = null;
|
||||
if (requirement != null)
|
||||
{
|
||||
transaction = TransactionMgr.GetTransactionById(requirement.TransactionId);
|
||||
if (transaction == null)
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve transaction for Id: '{requirement.TransactionId}'");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
}
|
||||
|
||||
// Create new item if required.
|
||||
if (requirement == null)
|
||||
{
|
||||
// Transaction.
|
||||
SysId transactionId = SysId.ToSysId(model.Requirement.TransactionId);
|
||||
if (!SysId.IsValid(transactionId))
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} Transaction not specified for new Requirement.");
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
transaction = TransactionMgr.GetTransactionById(requirement.TransactionId);
|
||||
if (transaction == null)
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve transaction for Id: '{transactionId}'");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
|
||||
// Create Requirement.
|
||||
requirement = TransactionMgr.CreateRequirement(transaction.AssociationId, transaction.Id, model.GetRequirementType());
|
||||
if (requirement == null)
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} Failed to create Requirement. {TransactionMgr.ErrorStateMessage.TrimEnd('.')}.");
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
}
|
||||
|
||||
// Populate item properties.
|
||||
if (model.Requirement.RequirementIdSource != null)
|
||||
requirement.RequirementIdSource = SysId.ToSysId(model.Requirement.RequirementIdSource);
|
||||
if (model.Requirement.Sequence != null)
|
||||
requirement.Seq = StringUtil.ToShort(model.Requirement.Sequence);
|
||||
if (model.Requirement.JobNumber != null)
|
||||
requirement.JobNumber = model.Requirement.JobNumber;
|
||||
// Dates.
|
||||
if (model.Requirement.Required != null)
|
||||
requirement.Required = model.ParseDateFromForm(model.Requirement.Required);
|
||||
if (model.Requirement.Started != null)
|
||||
requirement.Started = model.ParseDateFromForm(model.Requirement.Started);
|
||||
if (model.Requirement.Completed != null)
|
||||
requirement.Completed = model.ParseDateFromForm(model.Requirement.Completed);
|
||||
// Commodity.
|
||||
if (model.Requirement.CommodityId != null)
|
||||
requirement.CommodityId = model.GetRequirementCommodityId();
|
||||
if (model.Requirement.ProductCode != null)
|
||||
requirement.ProductCode = model.Requirement.ProductCode;
|
||||
if (model.Requirement.DescBrief != null)
|
||||
requirement.DescBrief = model.Requirement.DescBrief;
|
||||
if (model.Requirement.Quantity != null)
|
||||
requirement.Quantity = StringUtil.ToDecimal(model.Requirement.Quantity);
|
||||
if (model.Requirement.QuantityProd != null)
|
||||
requirement.QuantityProd = StringUtil.ToDecimal(model.Requirement.QuantityProd);
|
||||
if (model.Requirement.UomId != null)
|
||||
requirement.UomId = SysId.ToSysId(model.Requirement.UomId);
|
||||
if (model.Requirement.UomIdWeight != null)
|
||||
requirement.UomIdWeight = SysId.ToSysId(model.Requirement.UomIdWeight);
|
||||
if (model.Requirement.MaterialSourceCode != null)
|
||||
requirement.MaterialSourceCode = model.Requirement.MaterialSourceCode;
|
||||
if (model.Requirement.LocationIdStock != null)
|
||||
requirement.LocationIdStock = SysId.ToSysId(model.Requirement.LocationIdStock);
|
||||
// Amounts.
|
||||
if (model.Requirement.AmountUnit != null)
|
||||
requirement.AmountUnit = StringUtil.ToDecimal(model.Requirement.AmountUnit);
|
||||
if (model.Requirement.AmountAct != null)
|
||||
requirement.AmountAct = StringUtil.ToDecimal(model.Requirement.AmountAct);
|
||||
if (model.Requirement.AmountDisc != null)
|
||||
requirement.AmountDisc = StringUtil.ToDecimal(model.Requirement.AmountDisc);
|
||||
if (model.Requirement.AmountNet != null)
|
||||
requirement.AmountNet = StringUtil.ToDecimal(model.Requirement.AmountNet);
|
||||
if (model.Requirement.TaxCodeId != null)
|
||||
requirement.TaxCodeId = SysId.ToSysId(model.Requirement.TaxCodeId);
|
||||
if (model.Requirement.AmountTax != null)
|
||||
requirement.AmountTax = StringUtil.ToDecimal(model.Requirement.AmountTax);
|
||||
if (model.Requirement.AmountTot != null)
|
||||
requirement.AmountTot = StringUtil.ToDecimal(model.Requirement.AmountTot);
|
||||
// Common properties.
|
||||
if (model.Requirement.StatusCode != null)
|
||||
requirement.Status = model.GetRequirementStatus();
|
||||
if (model.Requirement.Notes != null)
|
||||
requirement.Notes = model.Requirement.Notes;
|
||||
|
||||
// Refresh requirement properties.
|
||||
TransactionMgr.CalculateTotal(requirement);
|
||||
|
||||
// Store item.
|
||||
if (!SysId.IsValid(requirement.Id))
|
||||
{
|
||||
if (!TransactionMgr.InsertRequirement(requirement, DbUpdateInfo))
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} Failed to insert transaction: {TransactionMgr.ErrorStateMessage}");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.insert.failed"]));
|
||||
}
|
||||
responseData.SetNotification(messageTitle, Localiser["msg.item.created"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!TransactionMgr.UpdateRequirement(requirement, DbUpdateInfo))
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} Failed to update transaction [Id:{SysId.ToLong(requirement.Id)}]: {TransactionMgr.ErrorStateMessage}");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.update.failed"]));
|
||||
}
|
||||
responseData.SetNotification(messageTitle, Localiser["msg.item.updated"]);
|
||||
}
|
||||
UpdateAssociatedData(transaction, requirement);
|
||||
|
||||
// Construct response.
|
||||
model.PopulateItemConfig(responseData.Config, transaction, requirement);
|
||||
PopulateRequirementResponseItemData(model, transaction, requirement, responseData.requirement);
|
||||
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Bring associated data into line with the transaction.
|
||||
/// </summary>
|
||||
/// <param name="transaction"></param>
|
||||
/// <returns></returns>
|
||||
private bool UpdateAssociatedData(SbmTransaction transaction, SbmRequirement requirement)
|
||||
{
|
||||
// Update transaction totals.
|
||||
List<SbmRequirement> requirements = TransactionMgr.GetRequirementsForTransaction(requirement.TransactionId);
|
||||
Internals.TransactionMgr.RefreshTransactionTotals(transaction, requirements.Where(item => SysId.IsValid(item.Id)));
|
||||
if (!Internals.TransactionMgr.UpdateTransaction(transaction, DbUpdateInfo))
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} Failed to update transaction. {Internals.TransactionMgr.ErrorStateMessage.TrimEnd('.')}.");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Sarand.BusinessMgr.Net.Core.Web.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
||||
using Sarand.BusinessMgr.Web.Portal.Components;
|
||||
using Sarand.BusinessMgr.Web.Portal.Models.Requirements;
|
||||
using Sarand.BusinessMgr.Web.Portal.Models.Transactions;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Security;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Sarand.BusinessMgr.Web.Portal.Controllers.Requirements
|
||||
{
|
||||
//=======================================================================
|
||||
public partial class RequirementController : SbmController_Portal
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public RequirementController(SbmLocaliser localiser, ILogger<RequirementController> logger) :
|
||||
base(localiser, logger)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
[HttpGet]
|
||||
public IActionResult Index(String transactionTypeName)
|
||||
{
|
||||
if (!ValidUserSession)
|
||||
AutoLoginUser();
|
||||
|
||||
// No Requirements index page - redirect to Home page.
|
||||
return RedirectToAction("", "");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
[HttpGet]
|
||||
[Route("ProductionControl")]
|
||||
public IActionResult ProductionControl(String transactionTypeName)
|
||||
{
|
||||
if (!ValidUserSession)
|
||||
AutoLoginUser();
|
||||
|
||||
// Redirect to sign-in if not signed-in.
|
||||
if (!ValidUserSession)
|
||||
{
|
||||
ClearKeepLoggedInCookie();
|
||||
return RedirectToAction("", "Security");
|
||||
}
|
||||
|
||||
// Requirement page.
|
||||
Model_Requirement model = new Model_Requirement(Localiser);
|
||||
RefreshModel(model);
|
||||
model.Filter.Mode = $"{Model_Requirement.ViewMode.ProductionControl}";
|
||||
model.Paging.PageNo = SessionData_Portal.Profile.ProductionControl.Filter.PageNo;
|
||||
model.Paging.PageLength = SessionData_Portal.Profile.ProductionControl.Filter.PageLength;
|
||||
model.PopulateListConfig();
|
||||
return View(model);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
+17
-12
@@ -131,6 +131,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Transactions
|
||||
if (!ValidUserSession) return GetAjaxResult_InvalidSession(responseData);
|
||||
if (!ValidReferer) return Forbid();
|
||||
RefreshModel(model);
|
||||
messageTitle = model.GetTransactionsTypeCaption(model.GetFilterTransactionType());
|
||||
|
||||
// Populate configuration data.
|
||||
PopulateTransactionConfig(model, responseData);
|
||||
@@ -165,12 +166,12 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Transactions
|
||||
// View mode.
|
||||
public class ModeData
|
||||
{
|
||||
public bool? Search { get; set; }
|
||||
public bool? Maintain { get; set; }
|
||||
public bool? SearchRequirement { get; set; }
|
||||
public bool? DeliveryPlanning { get; set; }
|
||||
public bool? TransactionsForSourceTrans { get; set; }
|
||||
public bool? TransactionsForAssociation { get; set; }
|
||||
public ushort? Search { get; set; }
|
||||
public ushort? Maintain { get; set; }
|
||||
public ushort? SearchRequirement { get; set; }
|
||||
public ushort? DeliveryPlanning { get; set; }
|
||||
public ushort? TransactionsForSourceTrans { get; set; }
|
||||
public ushort? TransactionsForAssociation { get; set; }
|
||||
}
|
||||
public ModeData Mode { get; set; }
|
||||
/// <summary>Status Cats to refresh caption with transaction count.</summary>
|
||||
@@ -191,6 +192,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Transactions
|
||||
if (!ValidUserSession) return GetAjaxResult_InvalidSession(responseData);
|
||||
if (!ValidReferer) return Forbid();
|
||||
RefreshModel(model);
|
||||
messageTitle = model.GetTransactionsTypeCaption(model.GetFilterTransactionType());
|
||||
|
||||
// Populate configuration data.
|
||||
PopulateTransactionConfig(model, responseData);
|
||||
@@ -199,17 +201,17 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Transactions
|
||||
responseData.Mode = new AjaxResponse_TransactionList.ModeData();
|
||||
Model_Transaction.ViewMode viewMode = model.GetFilterMode();
|
||||
if (viewMode == Model_Transaction.ViewMode.Maintain)
|
||||
responseData.Mode.Maintain = true;
|
||||
responseData.Mode.Maintain = 1;
|
||||
else if (viewMode == Model_Transaction.ViewMode.SearchRequirement)
|
||||
responseData.Mode.SearchRequirement = true;
|
||||
responseData.Mode.SearchRequirement = 1;
|
||||
else if (viewMode == Model_Transaction.ViewMode.DeliveryPlanning)
|
||||
responseData.Mode.DeliveryPlanning = true;
|
||||
responseData.Mode.DeliveryPlanning = 1;
|
||||
else if (viewMode == Model_Transaction.ViewMode.TransactionsForSourceTrans)
|
||||
responseData.Mode.TransactionsForSourceTrans = true;
|
||||
responseData.Mode.TransactionsForSourceTrans = 1;
|
||||
else if (viewMode == Model_Transaction.ViewMode.TransactionsForAssociation)
|
||||
responseData.Mode.TransactionsForAssociation = true;
|
||||
responseData.Mode.TransactionsForAssociation = 1;
|
||||
else
|
||||
responseData.Mode.Search = true;
|
||||
responseData.Mode.Search = 1;
|
||||
|
||||
// Status Cats.
|
||||
responseData.StatusCats = model.GetTransactionStatusCats(model.GetFilterTransactionType()).Select(item => new AjaxResponse_Data.ItemCodeDesc(item.Code, item.Desc)).ToList();
|
||||
@@ -348,6 +350,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Transactions
|
||||
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve transaction for Id: '{model.Transaction.Id}'");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
|
||||
}
|
||||
messageTitle = model.GetTransactionsTypeCaption(transaction.TransactionType);
|
||||
|
||||
// Construct response.
|
||||
model.PopulateItemConfig(responseData.Config, transaction);
|
||||
@@ -404,6 +407,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Transactions
|
||||
|
||||
// Retrieve existing item.
|
||||
SbmTransaction transaction = TransactionMgr.GetTransactionById(transactionId);
|
||||
messageTitle = model.GetTransactionsTypeCaption(transaction?.TransactionType ?? Sbm.TransactionType.Unknown);
|
||||
if (transaction == null && SysId.IsValid(transactionId))
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve transaction for Id: '{model.Transaction.Id}'");
|
||||
@@ -420,6 +424,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Controllers.Transactions
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
transaction = TransactionMgr.CreateTransaction(associationId, model.GetTransactionType());
|
||||
messageTitle = model.GetTransactionsTypeCaption(transaction?.TransactionType ?? Sbm.TransactionType.Unknown);
|
||||
if (transaction == null)
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} Failed to create Transaction. {TransactionMgr.ErrorStateMessage.TrimEnd('.')}.");
|
||||
|
||||
+3
-10
@@ -1,23 +1,16 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Sarand.BusinessMgr.Net.Core.Web.App;
|
||||
using Sarand.BusinessMgr.Net.Core.Web.Helpers;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr;
|
||||
using Sarand.BusinessMgr.Web.Portal.Components;
|
||||
using Sarand.BusinessMgr.Web.Portal.Models.Transactions;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Security;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Sarand.BusinessMgr.Web.Portal.Models.Transactions;
|
||||
using Sarand.BusinessMgr.Web.Portal.Components;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using System.Transactions;
|
||||
|
||||
namespace Sarand.BusinessMgr.Web.Portal.Controllers.Transactions
|
||||
{
|
||||
|
||||
@@ -68,7 +68,6 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Codes
|
||||
if (CodeType.Code != null)
|
||||
{
|
||||
String controlName = "CodeTypeCode";
|
||||
CodeType.Code = CodeType.Code.ToUpperInvariant();
|
||||
responseData.SetControlValue(controlName, CodeType.Code);
|
||||
if (StringUtil.IsBlank(CodeType.Code))
|
||||
responseData.SetControlError(controlName, Localiser["msg.validation.mandatory.value"]);
|
||||
|
||||
@@ -377,6 +377,12 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Commodities
|
||||
public bool? IsOrganisation { get; set; }
|
||||
public bool? IsIndividual { get; set; }
|
||||
public bool? IsGroup { get; set; }
|
||||
// Decimals.
|
||||
public class DecimalsData
|
||||
{
|
||||
public int? PackQty { get; set; } = 0;
|
||||
}
|
||||
public DecimalsData Decimals { get; } = new DecimalsData();
|
||||
// Item fields.
|
||||
public class FieldData
|
||||
{
|
||||
@@ -414,6 +420,10 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Commodities
|
||||
bool managedByAccounts = Internals.AccountsConsole.IsItemTypeManagedByAccounts(Sbm.ItemType.Commodity);
|
||||
bool showNotes = true;
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Decimals.
|
||||
config.Decimals.PackQty = Internals.GetOwnerOption_NumericDecimals(Sbm.OrgOption_NumericDecimals.OrderQuantity);
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Commodity.
|
||||
|
||||
|
||||
@@ -194,7 +194,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Commodities
|
||||
if (Commodity.SalesPackQty != null)
|
||||
{
|
||||
String controlName = GetFieldName(Model_Commodity.ItemField.SalesPackQty);
|
||||
if (!StringUtil.IsBlank(Commodity.SalesPackQty) && (!StringUtil.IsNumeric(Commodity.SalesPackQty) || GetCommoditySalesPackQty() < 1))
|
||||
if (!StringUtil.IsBlank(Commodity.SalesPackQty) && (!StringUtil.IsDecimal(Commodity.SalesPackQty) || GetCommoditySalesPackQty() < 1))
|
||||
responseData.SetControlError(controlName, Localiser["msg.validation.invalid.value"]);
|
||||
}
|
||||
|
||||
@@ -266,6 +266,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Commodities
|
||||
else
|
||||
msg += $" Issue: None.";
|
||||
SaLogger.Warn($"{SysUtil.Fn} {msg}");
|
||||
responseData.SetControlError(GetFieldName(Model_Commodity.ItemField.Code), Localiser["msg.validation.duplicate.value"]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Contacts
|
||||
public String ContactType { get; set; }
|
||||
public String Search { get; set; }
|
||||
public String Email { get; set; }
|
||||
public String AssociationTypeExclude { get; set; }
|
||||
}
|
||||
public FilterData Filter { get; } = new FilterData();
|
||||
public ViewMode GetFilterMode()
|
||||
@@ -54,6 +55,13 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Contacts
|
||||
affiliateType = (Sbm.AffiliateType)StringUtil.ToInt(Filter.ContactType);
|
||||
return affiliateType;
|
||||
}
|
||||
public Sbm.AssociationType GetFilterAssociationTypeExclude()
|
||||
{
|
||||
Sbm.AssociationType associationType = (Sbm.AssociationType)SbmSystem.GetSystemCodes(Sbm.SystemCode.AssociationType).GetTypeForCode(Filter.AssociationTypeExclude);
|
||||
if (associationType == 0 && !StringUtil.IsBlank(Filter.AssociationTypeExclude) && StringUtil.IsNumeric(Filter.AssociationTypeExclude, true))
|
||||
associationType = (Sbm.AssociationType)StringUtil.ToInt(Filter.AssociationTypeExclude);
|
||||
return associationType;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Contact properties.
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
||||
using Sarand.BusinessMgr.Web.Portal.Models.Transactions;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
@@ -28,6 +29,8 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Requirements
|
||||
Pos,
|
||||
Id,
|
||||
TransactionId,
|
||||
TransactionType,
|
||||
TransactionRef,
|
||||
AssociationName,
|
||||
AssociationId,
|
||||
Type,
|
||||
@@ -53,13 +56,16 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Requirements
|
||||
NominalCode,
|
||||
RandDIndicator,
|
||||
// Commodity.
|
||||
Commodity,
|
||||
CommodityId,
|
||||
ProductCode,
|
||||
DrawingIssue,
|
||||
AssetId,
|
||||
Quantity,
|
||||
QuantityProd,
|
||||
Unit,
|
||||
UomId,
|
||||
PackQty,
|
||||
MaterialSourceCode,
|
||||
LocationIdStock,
|
||||
AllocationIndicator,
|
||||
@@ -69,6 +75,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Requirements
|
||||
AmountDisc,
|
||||
AmountNet,
|
||||
TaxCodeId,
|
||||
TaxCode,
|
||||
TaxRate,
|
||||
AmountTax,
|
||||
AmountTot,
|
||||
@@ -182,7 +189,6 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Requirements
|
||||
bool isPurchaseInvoice = transactionType == Sbm.TransactionType.PurchaseInvoice || transactionType == Sbm.TransactionType.ProformaPurchaseInvoice;
|
||||
|
||||
// Requirement.
|
||||
Sbm.RequirementType requirementType = GetFilterRequirementType();
|
||||
SbmRequirement.StatusCat requirementStatusCat = GetFilterRequirementStatusCat();
|
||||
|
||||
// Options.
|
||||
@@ -303,10 +309,24 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Requirements
|
||||
}
|
||||
else config.Column.Hide.Add($"{ItemField.AmountUnit}");
|
||||
|
||||
// Actual Amount - Maintain mode only.
|
||||
if (UserCanViewFinancials() && modeIsMaintain)
|
||||
{
|
||||
// Actual Amount is shown.
|
||||
}
|
||||
else config.Column.Hide.Add($"{ItemField.AmountAct}");
|
||||
|
||||
// Discount Amount - Maintain mode only.
|
||||
if (UserCanViewFinancials() && modeIsMaintain)
|
||||
{
|
||||
// Discount Amount is shown.
|
||||
}
|
||||
else config.Column.Hide.Add($"{ItemField.AmountDisc}");
|
||||
|
||||
// Net Amount - Maintain mode only.
|
||||
if (UserCanViewFinancials() && modeIsMaintain)
|
||||
{
|
||||
// Unit Amount is shown.
|
||||
// Net Amount is shown.
|
||||
}
|
||||
else config.Column.Hide.Add($"{ItemField.AmountNet}");
|
||||
|
||||
@@ -398,33 +418,14 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Requirements
|
||||
//-------------------------------------------------------------------
|
||||
private String GetListCaptionByTransactionType(Sbm.TransactionType transactionType)
|
||||
{
|
||||
String transactionTypeCaption = GetTransactionTypeCaption(transactionType);
|
||||
String transactionTypeCaption = GetTransactionsTypeCaption(transactionType);
|
||||
if (!StringUtil.IsBlank(transactionTypeCaption))
|
||||
return Localiser.GetText("caption.item.requirements", new object[] { transactionTypeCaption });
|
||||
return Localiser["label.requirements"];
|
||||
}
|
||||
private String GetTransactionTypeCaption(Sbm.TransactionType transactionType)
|
||||
private String GetTransactionsTypeCaption(Sbm.TransactionType transactionType)
|
||||
{
|
||||
switch (transactionType)
|
||||
{
|
||||
case Sbm.TransactionType.Project: return Localiser["caption.projects"];
|
||||
case Sbm.TransactionType.SalesLead: return Localiser["caption.sales.leads"];
|
||||
case Sbm.TransactionType.SalesQuote: return Localiser["caption.sales.quotes"];
|
||||
case Sbm.TransactionType.ProformaSalesOrder: return Localiser["caption.proforma.sales.orders"];
|
||||
case Sbm.TransactionType.SalesPO: return Localiser["caption.sales.purchase.orders"];
|
||||
case Sbm.TransactionType.SalesOrder: return Localiser["caption.sales.orders"];
|
||||
case Sbm.TransactionType.SalesDispatch: return Localiser["caption.sales.dispatches"];
|
||||
case Sbm.TransactionType.ProformaSalesInvoice: return Localiser["caption.proforma.sales.invoices"];
|
||||
case Sbm.TransactionType.SalesInvoice: return Localiser["caption.sales.invoices"];
|
||||
case Sbm.TransactionType.PurchaseQuote: return Localiser["caption.purchase.quotes"];
|
||||
case Sbm.TransactionType.ProformaPurchaseOrder: return Localiser["caption.proforma.purchase.orders"];
|
||||
case Sbm.TransactionType.PurchaseSO: return Localiser["caption.purchase.sales.orders"];
|
||||
case Sbm.TransactionType.PurchaseOrder: return Localiser["caption.purchase.orders"];
|
||||
case Sbm.TransactionType.PurchaseDelivery: return Localiser["caption.purchase.deliveries"];
|
||||
case Sbm.TransactionType.ProformaPurchaseInvoice: return Localiser["caption.proforma.purchase.invoices"];
|
||||
case Sbm.TransactionType.PurchaseInvoice: return Localiser["caption.purchase.invoices"];
|
||||
}
|
||||
return "";
|
||||
return Model_Transaction.GetTransactionsTypeCaption(transactionType, Localiser, "");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -438,6 +439,12 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Requirements
|
||||
public bool? IsOrganisation { get; set; }
|
||||
public bool? IsIndividual { get; set; }
|
||||
public bool? IsGroup { get; set; }
|
||||
// Decimals.
|
||||
public class DecimalsData
|
||||
{
|
||||
public int? ItemQty { get; set; } = 0;
|
||||
}
|
||||
public DecimalsData Decimals { get; } = new DecimalsData();
|
||||
// Item fields.
|
||||
public class FieldData
|
||||
{
|
||||
@@ -459,17 +466,18 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Requirements
|
||||
/// </summary>
|
||||
public void PopulateItemConfig(ItemConfigData config, SbmTransaction transaction, SbmRequirement requirement)
|
||||
{
|
||||
PopulateItemConfig(config, requirement.GetItemId(), transaction.TransactionType, requirement.RequirementType);
|
||||
PopulateItemConfig(config, requirement?.GetItemId(), transaction?.TransactionType ?? Sbm.TransactionType.Unknown, transaction?.TransactionStatusCat ?? SbmTransaction.StatusCat.Pending, requirement?.RequirementType ?? Sbm.RequirementType.Detail);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Populate item configuration for new or existing requirement.
|
||||
/// </summary>
|
||||
public void PopulateItemConfig(ItemConfigData config, ItemId requirementItemId, Sbm.TransactionType transactionType, Sbm.RequirementType requirementType)
|
||||
public void PopulateItemConfig(ItemConfigData config, ItemId requirementItemId, Sbm.TransactionType transactionType, SbmTransaction.StatusCat transactionStatusCat, Sbm.RequirementType requirementType)
|
||||
{
|
||||
// Item type.
|
||||
bool isSales = SbmTransaction.IsSalesType(transactionType);
|
||||
bool isPurchase = SbmTransaction.IsPurchaseType(transactionType);
|
||||
bool transactionClosed = transactionStatusCat == SbmTransaction.StatusCat.Closed;
|
||||
|
||||
// Configuration options.
|
||||
bool importedFromAccounts = Internals.AccountsConsole.ItemIsImportedFromAccounts(requirementItemId);
|
||||
@@ -477,6 +485,10 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Requirements
|
||||
bool showDrawingIssue = SessionConsole.DisplayAttribute(SbmDbDfn.ColumnIdx.Commodity_DrawingIssue);
|
||||
bool showNotes = true;
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Decimals.
|
||||
config.Decimals.ItemQty = Internals.GetOwnerOption_NumericDecimals(Sbm.OrgOption_NumericDecimals.OrderQuantity);
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Requirement.
|
||||
|
||||
@@ -496,10 +508,42 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Requirements
|
||||
config.Field.Readonly.Add($"{ItemField.DescBrief}");
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Sales order.
|
||||
// Commodity.
|
||||
|
||||
// Quantity.
|
||||
if (transactionClosed)
|
||||
config.Field.Readonly.Add($"{ItemField.Quantity}");
|
||||
|
||||
// Production Quantity.
|
||||
if (transactionClosed)
|
||||
config.Field.Readonly.Add($"{ItemField.QuantityProd}");
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Purchase order.
|
||||
// Amounts.
|
||||
|
||||
// Unit Amount.
|
||||
if (transactionClosed)
|
||||
config.Field.Readonly.Add($"{ItemField.AmountUnit}");
|
||||
|
||||
// Actual Amount.
|
||||
config.Field.Readonly.Add($"{ItemField.AmountAct}");
|
||||
|
||||
// Discount Amount.
|
||||
if (transactionClosed)
|
||||
config.Field.Readonly.Add($"{ItemField.AmountDisc}");
|
||||
|
||||
// Net Amount.
|
||||
config.Field.Readonly.Add($"{ItemField.AmountNet}");
|
||||
|
||||
// Tax Code.
|
||||
if (transactionClosed)
|
||||
config.Field.Readonly.Add($"{ItemField.TaxCode}");
|
||||
|
||||
// Tax Amount.
|
||||
config.Field.Readonly.Add($"{ItemField.AmountTax}");
|
||||
|
||||
// Total Amount.
|
||||
config.Field.Readonly.Add($"{ItemField.AmountTot}");
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Common.
|
||||
|
||||
@@ -48,8 +48,8 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Requirements
|
||||
public class FilterData
|
||||
{
|
||||
public String Mode { get; set; }
|
||||
public String TransactionId { get; set; }
|
||||
public String TransactionType { get; set; }
|
||||
public String Type { get; set; }
|
||||
public String Search { get; set; }
|
||||
public String TransactionStatusCat { get; set; }
|
||||
public String StatusCat { get; set; }
|
||||
@@ -59,18 +59,17 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Requirements
|
||||
{
|
||||
return EnumUtil.ParseEnum(Filter.Mode, ViewMode.Search);
|
||||
}
|
||||
public SysId GetFilterTransactionId()
|
||||
{
|
||||
return SysId.ToSysId(Filter.TransactionId);
|
||||
}
|
||||
public Sbm.TransactionType GetFilterTransactionType()
|
||||
{
|
||||
Sbm.TransactionType transactionType = (Sbm.TransactionType)Internals.TransactionTypeCodes.GetTypeForCode(Filter.Type);
|
||||
if (transactionType == 0 && !StringUtil.IsBlank(Filter.Type) && StringUtil.IsNumeric(Filter.Type, true))
|
||||
transactionType = (Sbm.TransactionType)StringUtil.ToInt(Filter.Type);
|
||||
return transactionType;
|
||||
}
|
||||
public Sbm.RequirementType GetFilterRequirementType()
|
||||
{
|
||||
Sbm.RequirementType transactionType = (Sbm.RequirementType)Internals.RequirementTypeCodes.GetTypeForCode(Filter.Type);
|
||||
if (transactionType == 0 && !StringUtil.IsBlank(Filter.Type) && StringUtil.IsNumeric(Filter.Type, true))
|
||||
transactionType = (Sbm.RequirementType)StringUtil.ToInt(Filter.Type);
|
||||
Sbm.TransactionType transactionType = (Sbm.TransactionType)Internals.TransactionTypeCodes.GetTypeForCode(Filter.TransactionType);
|
||||
if (transactionType == 0 && !StringUtil.IsBlank(Filter.TransactionType) && StringUtil.IsNumeric(Filter.TransactionType, true))
|
||||
transactionType = (Sbm.TransactionType)StringUtil.ToInt(Filter.TransactionType);
|
||||
if (transactionType == 0 && SysId.IsValid(GetFilterTransactionId()))
|
||||
transactionType = TransactionMgr.GetTransactionType(GetFilterTransactionId());
|
||||
return transactionType;
|
||||
}
|
||||
public SbmTransaction.StatusCat GetFilterTransactionStatusCat()
|
||||
@@ -134,6 +133,10 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Requirements
|
||||
{
|
||||
return (Sbm.RequirementType)Internals.RequirementTypeCodes.GetTypeForCode(Requirement.Type);
|
||||
}
|
||||
public SysId GetRequirementCommodityId()
|
||||
{
|
||||
return SysId.ToSysId(Requirement.CommodityId);
|
||||
}
|
||||
public SaStatus GetRequirementStatus()
|
||||
{
|
||||
return SacsSystem.GetStatusForCode(Requirement.StatusCode);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Core.Web.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
@@ -233,7 +234,7 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Transactions
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// List Caption.
|
||||
config.Caption = StringUtil.OnBlank(GetListCaptionByTransactionType(transactionType), Localiser["label.transactions"]);
|
||||
config.Caption = StringUtil.OnBlank(GetTransactionsTypeCaption(transactionType), Localiser["label.transactions"]);
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Actions.
|
||||
@@ -536,28 +537,32 @@ namespace Sarand.BusinessMgr.Web.Portal.Models.Transactions
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
private String GetListCaptionByTransactionType(Sbm.TransactionType transactionType)
|
||||
public String GetTransactionsTypeCaption(Sbm.TransactionType transactionType)
|
||||
{
|
||||
return GetTransactionsTypeCaption(transactionType, Localiser, Localiser["label.transactions"]);
|
||||
}
|
||||
public static String GetTransactionsTypeCaption(Sbm.TransactionType transactionType, SbmLocaliser localiser, String defaultCaption)
|
||||
{
|
||||
switch (transactionType)
|
||||
{
|
||||
case Sbm.TransactionType.Project: return Localiser["caption.projects"];
|
||||
case Sbm.TransactionType.SalesLead: return Localiser["caption.sales.leads"];
|
||||
case Sbm.TransactionType.SalesQuote: return Localiser["caption.sales.quotes"];
|
||||
case Sbm.TransactionType.ProformaSalesOrder: return Localiser["caption.proforma.sales.orders"];
|
||||
case Sbm.TransactionType.SalesPO: return Localiser["caption.sales.purchase.orders"];
|
||||
case Sbm.TransactionType.SalesOrder: return Localiser["caption.sales.orders"];
|
||||
case Sbm.TransactionType.SalesDispatch: return Localiser["caption.sales.dispatches"];
|
||||
case Sbm.TransactionType.ProformaSalesInvoice: return Localiser["caption.proforma.sales.invoices"];
|
||||
case Sbm.TransactionType.SalesInvoice: return Localiser["caption.sales.invoices"];
|
||||
case Sbm.TransactionType.PurchaseQuote: return Localiser["caption.purchase.quotes"];
|
||||
case Sbm.TransactionType.ProformaPurchaseOrder: return Localiser["caption.proforma.purchase.orders"];
|
||||
case Sbm.TransactionType.PurchaseSO: return Localiser["caption.purchase.sales.orders"];
|
||||
case Sbm.TransactionType.PurchaseOrder: return Localiser["caption.purchase.orders"];
|
||||
case Sbm.TransactionType.PurchaseDelivery: return Localiser["caption.purchase.deliveries"];
|
||||
case Sbm.TransactionType.ProformaPurchaseInvoice: return Localiser["caption.proforma.purchase.invoices"];
|
||||
case Sbm.TransactionType.PurchaseInvoice: return Localiser["caption.purchase.invoices"];
|
||||
case Sbm.TransactionType.Project: return localiser["caption.projects"];
|
||||
case Sbm.TransactionType.SalesLead: return localiser["caption.sales.leads"];
|
||||
case Sbm.TransactionType.SalesQuote: return localiser["caption.sales.quotes"];
|
||||
case Sbm.TransactionType.ProformaSalesOrder: return localiser["caption.proforma.sales.orders"];
|
||||
case Sbm.TransactionType.SalesPO: return localiser["caption.sales.purchase.orders"];
|
||||
case Sbm.TransactionType.SalesOrder: return localiser["caption.sales.orders"];
|
||||
case Sbm.TransactionType.SalesDispatch: return localiser["caption.sales.dispatches"];
|
||||
case Sbm.TransactionType.ProformaSalesInvoice: return localiser["caption.proforma.sales.invoices"];
|
||||
case Sbm.TransactionType.SalesInvoice: return localiser["caption.sales.invoices"];
|
||||
case Sbm.TransactionType.PurchaseQuote: return localiser["caption.purchase.quotes"];
|
||||
case Sbm.TransactionType.ProformaPurchaseOrder: return localiser["caption.proforma.purchase.orders"];
|
||||
case Sbm.TransactionType.PurchaseSO: return localiser["caption.purchase.sales.orders"];
|
||||
case Sbm.TransactionType.PurchaseOrder: return localiser["caption.purchase.orders"];
|
||||
case Sbm.TransactionType.PurchaseDelivery: return localiser["caption.purchase.deliveries"];
|
||||
case Sbm.TransactionType.ProformaPurchaseInvoice: return localiser["caption.proforma.purchase.invoices"];
|
||||
case Sbm.TransactionType.PurchaseInvoice: return localiser["caption.purchase.invoices"];
|
||||
}
|
||||
return Localiser["label.transactions"];
|
||||
return defaultCaption;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -80,9 +80,4 @@
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Portal\Controllers\Requirements\" />
|
||||
<Folder Include="Views\Requirement\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
@inject SbmLocaliser Localiser
|
||||
@{
|
||||
// Ensure view is only included once in page.
|
||||
if (!Model.RegisterView("Views/Assets/Asset/Panel-AssetSelect")) return;
|
||||
if (!Model.RegisterView(Html.ViewContext)) return;
|
||||
Model.AdditionalFiles_JS.Add("js/sbm-asset.js");
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
@inject SbmLocaliser Localiser
|
||||
@{
|
||||
// Ensure view is only included once in page.
|
||||
if (!Model.RegisterView("Views/Assets/Asset/Panel-AssetMaintain")) return;
|
||||
if (!Model.RegisterView(Html.ViewContext)) return;
|
||||
Model.AdditionalFiles_JS.Add("js/sbm-asset.js");
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
@inject SbmLocaliser Localiser
|
||||
@{
|
||||
// Ensure view is only included once in page.
|
||||
if (!Model.RegisterView("Views/Assets/Asset/Panel-AssetSelect")) return;
|
||||
if (!Model.RegisterView(Html.ViewContext)) return;
|
||||
Model.AdditionalFiles_JS.Add("js/sbm-asset.js");
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
@inject SbmLocaliser Localiser
|
||||
@{
|
||||
// Ensure view is only included once in page.
|
||||
if (!Model.RegisterView("Views/Assets/AssetCategory/Panel-AssetCategoryDialog")) return;
|
||||
if (!Model.RegisterView(Html.ViewContext)) return;
|
||||
Model.AdditionalFiles_JS.Add("js/sbm-asset-cat.js");
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
@inject SbmLocaliser Localiser
|
||||
@{
|
||||
// Ensure view is only included once in page.
|
||||
if (!Model.RegisterView("Views/Assets/AssetCategory/Panel-AssetCategoryMaintain")) return;
|
||||
if (!Model.RegisterView(Html.ViewContext)) return;
|
||||
Model.AdditionalFiles_JS.Add("js/sbm-asset-cat.js");
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
@inject SbmLocaliser Localiser
|
||||
@{
|
||||
// Ensure view is only included once in page.
|
||||
if (!Model.RegisterView("Views/Assets/AssetCategory/Panel-AssetCategorySelect")) return;
|
||||
if (!Model.RegisterView(Html.ViewContext)) return;
|
||||
Model.AdditionalFiles_JS.Add("js/sbm-asset-cat.js");
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
@{
|
||||
/* Association dialog panel */
|
||||
// Ensure view is only included once in page.
|
||||
if (!Model.RegisterView("Views/Association/Panel-AssociationDialog")) return;
|
||||
if (!Model.RegisterView(Html.ViewContext)) return;
|
||||
}
|
||||
|
||||
<script type="text/javascript">
|
||||
@@ -33,12 +33,12 @@
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="sbm-label">
|
||||
<label for="cbAssociationType"><span>@Localiser["label.type"]</span><span class="required"> *</span></label>
|
||||
<label for="cbAssocType"><span>@Localiser["label.type"]</span><span class="required"> *</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="sbm-control">
|
||||
<select name="Association.Type" id="cbAssociationType" class="AssociationType sbm-select"></select>
|
||||
<select name="Association.Type" id="cbAssocType" class="AssocType sbm-select"></select>
|
||||
</div>
|
||||
<div class="sbm-message"></div>
|
||||
</div>
|
||||
@@ -54,12 +54,12 @@
|
||||
<div class="row">
|
||||
<div class="col-sm-5">
|
||||
<div class="sbm-label">
|
||||
<label for="cbAssociationStatus"><span>@Localiser["label.status"]</span><span class="required"> *</span></label>
|
||||
<label for="cbAssocStatus"><span>@Localiser["label.status"]</span><span class="required"> *</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="sbm-control">
|
||||
<select id="cbAssociationStatus" class="AssociationStatus sbm-select sbm-auto-val" name="Association.StatusCode"></select>
|
||||
<select id="cbAssocStatus" class="AssocStatus sbm-select sbm-auto-val" name="Association.StatusCode"></select>
|
||||
</div>
|
||||
<div class="sbm-message"></div>
|
||||
</div>
|
||||
@@ -74,17 +74,17 @@
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<div class="sbm-label">
|
||||
<label for="ifAssociationOwner"><span>@Localiser["label.owner"]</span><span class="required"> *</span></label>
|
||||
<label for="ifAssocOwner"><span>@Localiser["label.owner"]</span><span class="required"> *</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="sbm-control row">
|
||||
<div class="col">
|
||||
<input type="hidden" name="Association.ContactIdOwner" id="" class=" AssociationOwnerId sbm-input" />
|
||||
<input type="text" id="ifAssociationOwner" class="AssociationOwner sbm-input sbm-auto-val" readonly="readonly" />
|
||||
<input type="hidden" name="Association.ContactIdOwner" id="" class=" AssocOwnerId sbm-input" />
|
||||
<input type="text" id="ifAssocOwner" class="AssocOwner sbm-input sbm-auto-val" readonly="readonly" />
|
||||
</div>
|
||||
<div class="fixed">
|
||||
@* <div class="sbm-action AssociationOwnerSearch"><img src="~/img/action/search24.png" alt="" title="" /></div> *@
|
||||
@* <div class="sbm-action AssocOwnerSearch"><img src="~/img/action/search24.png" alt="" title="" /></div> *@
|
||||
</div>
|
||||
</div>
|
||||
<div class="sbm-message"></div>
|
||||
@@ -97,14 +97,14 @@
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<div class="sbm-label">
|
||||
<label for="ifAssociationTarget"><span>@Localiser["label.target"]</span><span class="required"> *</span></label>
|
||||
<label for="ifAssocTarget"><span>@Localiser["label.target"]</span><span class="required"> *</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="sbm-control row">
|
||||
<div class="col">
|
||||
<input type="hidden" name="Association.TargetId" id="" class=" AssociationTargetId sbm-input" />
|
||||
<input type="text" id="ifAssociationTarget" class="AssociationTarget sbm-input sbm-auto-val" readonly="readonly" />
|
||||
<input type="hidden" name="Association.TargetId" id="" class=" AssocTargetId sbm-input" />
|
||||
<input type="text" id="ifAssocTarget" class="AssocTarget sbm-input sbm-auto-val" readonly="readonly" />
|
||||
</div>
|
||||
<div class="fixed">
|
||||
<div class="sbm-action AssocTargetSearch"><img src="~/img/action/search24.png" alt="" title="" /></div>
|
||||
@@ -126,12 +126,12 @@
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="sbm-label">
|
||||
<label for="ifAssociationCode"><span>@Localiser["label.code"]</span></label>
|
||||
<label for="ifAssocCode"><span>@Localiser["label.code"]</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="sbm-control">
|
||||
<input type="text" name="Association.Code" id="ifAssociationCode" class="AssociationCode sbm-input upper sbm-auto-val" maxlength="@Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Association_Code)" />
|
||||
<input type="text" name="Association.Code" id="ifAssocCode" class="AssocCode sbm-input upper sbm-auto-val" maxlength="@Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Association_Code)" />
|
||||
</div>
|
||||
<div class="sbm-message"></div>
|
||||
</div>
|
||||
@@ -147,12 +147,12 @@
|
||||
<div class="row">
|
||||
<div class="col-sm-5">
|
||||
<div class="sbm-label">
|
||||
<label for="ifAssociationExtRef"><span>@Localiser["label.reference.external"]</span></label>
|
||||
<label for="ifAssocExtRef"><span>@Localiser["label.reference.external"]</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="sbm-control">
|
||||
<input type="text" name="Association.ReferenceExt" id="ifAssociationExtRef" class="AssociationExtRef sbm-input upper sbm-auto-val" maxlength="@Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Association_ExtRef)" />
|
||||
<input type="text" name="Association.ReferenceExt" id="ifAssocExtRef" class="AssocExtRef sbm-input upper sbm-auto-val" maxlength="@Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Association_ExtRef)" />
|
||||
</div>
|
||||
<div class="sbm-message"></div>
|
||||
</div>
|
||||
@@ -170,12 +170,12 @@
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="sbm-label">
|
||||
<label for="ifAssociationLocation"><span>@Localiser["label.location"]</span></label>
|
||||
<label for="ifAssocLocation"><span>@Localiser["label.location"]</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="sbm-control">
|
||||
<input type="text" name="Association.Location" id="ifAssociationLocation" class="AssociationLocation sbm-input sbm-auto-val" maxlength="@Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Association_Location)" />
|
||||
<input type="text" name="Association.Location" id="ifAssocLocation" class="AssocLocation sbm-input sbm-auto-val" maxlength="@Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Association_Location)" />
|
||||
</div>
|
||||
<div class="sbm-message"></div>
|
||||
</div>
|
||||
@@ -191,12 +191,12 @@
|
||||
<div class="row">
|
||||
<div class="col-sm-5">
|
||||
<div class="sbm-label">
|
||||
<label for="ifAssociationGroup"><span>@Localiser["label.group"]</span></label>
|
||||
<label for="ifAssocGroup"><span>@Localiser["label.group"]</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="sbm-control">
|
||||
<input type="text" name="Association.Group" id="ifAssociationGroup" class="AssociationGroup sbm-input sbm-auto-val" maxlength="@Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Association_Group)" />
|
||||
<input type="text" name="Association.Group" id="ifAssocGroup" class="AssocGroup sbm-input sbm-auto-val" maxlength="@Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Association_Group)" />
|
||||
</div>
|
||||
<div class="sbm-message"></div>
|
||||
</div>
|
||||
@@ -211,12 +211,12 @@
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<div class="sbm-label">
|
||||
<label for="ifAssociationNotes"><span>@Localiser["label.notes"]</span></label>
|
||||
<label for="ifAssocNotes"><span>@Localiser["label.notes"]</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="sbm-control">
|
||||
<textarea name="Association.Notes" id="ifAssociationNotes" class="AssociationNotes sbm-textarea sbm-auto-val" rows="3" maxlength="@Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Association_Notes)"></textarea>
|
||||
<textarea name="Association.Notes" id="ifAssocNotes" class="AssocNotes sbm-textarea sbm-auto-val" rows="3" maxlength="@Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Association_Notes)"></textarea>
|
||||
</div>
|
||||
<div class="sbm-message"></div>
|
||||
</div>
|
||||
@@ -227,7 +227,3 @@
|
||||
|
||||
<div class="spacer2"></div>
|
||||
</div>
|
||||
|
||||
@* Contact panels. *@
|
||||
<partial name="~/Views/Contact/Panel-ContactSelect.cshtml" />
|
||||
<partial name="~/Views/Contact/Panel-ContactDialog.cshtml" />
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
@{
|
||||
/* Association maintain panel */
|
||||
// Ensure view is only included once in page.
|
||||
if (!Model.RegisterView("Views/Association/Panel-AssociationMaintain")) return;
|
||||
if (!Model.RegisterView(Html.ViewContext)) return;
|
||||
Model.AdditionalFiles_JS.Add("js/sbm-assoc.js");
|
||||
}
|
||||
|
||||
@@ -63,8 +63,11 @@
|
||||
}
|
||||
|
||||
<partial name="Panel-AssociationList.cshtml" />
|
||||
|
||||
</div>
|
||||
<partial name="Panel-AssociationDialog.cshtml" />
|
||||
</div>
|
||||
|
||||
<partial name="Panel-AssociationDialog.cshtml" />
|
||||
|
||||
@* Contact panels. *@
|
||||
<partial name="~/Views/Contact/Panel-ContactSelect.cshtml" />
|
||||
<partial name="~/Views/Contact/Panel-ContactDialog.cshtml" />
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
@{
|
||||
/* Association select panel */
|
||||
// Ensure view is only included once in page.
|
||||
if (!Model.RegisterView("Views/Association/Panel-AssociationSelect")) return;
|
||||
if (!Model.RegisterView(Html.ViewContext)) return;
|
||||
Model.AdditionalFiles_JS.Add("js/sbm-assoc.js");
|
||||
Model_Association ModelAssociation = Model as Model_Association;
|
||||
}
|
||||
@@ -46,3 +46,4 @@
|
||||
|
||||
</div>
|
||||
|
||||
<partial name="Panel-AssociationDialog.cshtml" />
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
<div class="sbm-panel CodeTypes fullheight">
|
||||
|
||||
<script type="text/javascript">
|
||||
sbm.lbl.codes = '@(Localiser.GetJavascriptText("label.codes"))';
|
||||
sbm.dlg.title.createItem = '@(Localiser.GetJavascriptText("caption.code.type.create"))';
|
||||
sbm.dlg.title.updateItem = '@(Localiser.GetJavascriptText("caption.code.type.update"))';
|
||||
</script>
|
||||
@@ -56,6 +57,7 @@
|
||||
<th class="pl-2">@Localiser["label.code"]</th>
|
||||
<th class="">@Localiser["label.name"]</th>
|
||||
<th class="center">@Localiser["label.codes"]</th>
|
||||
<th class="center">@Localiser["label.code.len"]</th>
|
||||
<th class="center">@Localiser["label.status"]</th>
|
||||
<th class="right" style="width:2%;"></th>
|
||||
</tr>
|
||||
@@ -77,6 +79,7 @@
|
||||
<td><div class="CodeTypeCode pl-1"></div></td>
|
||||
<td><div class="CodeTypeName"></div></td>
|
||||
<td class="center"><div class="CodeTypeCodes"></div></td>
|
||||
<td class="center"><div class="CodeTypeCodeLength"></div></td>
|
||||
<td><div class="CodeTypeStatusDesc center"></div></td>
|
||||
<td>
|
||||
<div class="right">
|
||||
@@ -116,9 +119,9 @@
|
||||
<label for="ifCodeTypeCode"><span>@Localiser["label.code"]</span><span class="required"> *</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-9">
|
||||
<div class="col-sm-3">
|
||||
<div class="sbm-control">
|
||||
@Html.TextBoxFor(model => model.CodeType.Code, new { @id = "ifCodeTypeCode", @class = "CodeTypeCode sbm-input upper", @maxlength = @Model.GetControlMaxLength(SaCodeTypeDbDfn.ColumnIdx.SaCodeType_Code) })
|
||||
@Html.TextBoxFor(model => model.CodeType.Code, new { @id = "ifCodeTypeCode", @class = "CodeTypeCode sbm-input", @maxlength = @Model.GetControlMaxLength(SaCodeTypeDbDfn.ColumnIdx.SaCodeType_Code) })
|
||||
</div>
|
||||
<div class="sbm-message"></div>
|
||||
</div>
|
||||
@@ -133,7 +136,7 @@
|
||||
<label for="ifCodeTypeName"><span>@Localiser["label.name"]</span><span class="required"> *</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-9">
|
||||
<div class="col-sm">
|
||||
<div class="sbm-control">
|
||||
@Html.TextBoxFor(model => model.CodeType.Name, new { @id = "ifCodeTypeName", @class = "CodeTypeName sbm-input", @maxlength = @Model.GetControlMaxLength(SaCodeTypeDbDfn.ColumnIdx.SaCodeType_Name) })
|
||||
</div>
|
||||
@@ -142,6 +145,23 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* Code Length *@
|
||||
<div class="sbm-form-control CodeTypeCodeLength">
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<div class="sbm-label">
|
||||
<label for="ifCodeTypeCodeLength"><span>@Localiser["label.code.length"]</span><span class="required"> *</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
<div class="sbm-control">
|
||||
@Html.TextBoxFor(model => model.CodeType.MaxCodeLength, new { @id = "ifCodeTypeCodeLength", @class = "CodeTypeCodeLength sbm-input", @readonly = true, @maxlength = 3 })
|
||||
</div>
|
||||
<div class="sbm-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* Status *@
|
||||
<div class="sbm-form-control CodeTypeStatus">
|
||||
<div class="row">
|
||||
@@ -150,7 +170,7 @@
|
||||
<label for="cbCodeTypeStatus"><span>@Localiser["label.status"]</span><span class="required"> *</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-9">
|
||||
<div class="col-sm-3">
|
||||
<div class="sbm-control">
|
||||
<select id="cbCodeTypeStatus" class="sbm-select CodeTypeStatus" name="CodeType.StatusCode"></select>
|
||||
</div>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
@{
|
||||
/* Commodity - Dialog panel */
|
||||
// Ensure view is only included once in page.
|
||||
if (!Model.RegisterView("Views/Commodity/Panel-CommodityDialog")) return;
|
||||
if (!Model.RegisterView(Html.ViewContext)) return;
|
||||
}
|
||||
|
||||
<script type="text/javascript">
|
||||
@@ -38,7 +38,7 @@
|
||||
<label for="ifCommodityCode"><span>@Localiser["label.code"]</span><span class="required"> *</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="col-sm-7">
|
||||
<div class="sbm-control">
|
||||
@Html.TextBox("Commodity.Code", "", new { @id = "ifCommodityCode", @class = "CommodityCode sbm-input upper sbm-auto-val", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Commodity_Code) })
|
||||
</div>
|
||||
@@ -53,8 +53,7 @@
|
||||
@* Commodity Type *@
|
||||
<div class="sbm-form-control @Model_Commodity.GetFieldName(Model_Commodity.ItemField.Type)">
|
||||
<div class="row">
|
||||
<div class="col-sm-1"></div>
|
||||
<div class="col-sm-3">
|
||||
<div class="col-sm-4">
|
||||
<div class="sbm-label">
|
||||
<label for="cbCommodityType"><span>@Localiser["label.type"]</span><span class="required"> *</span></label>
|
||||
</div>
|
||||
@@ -99,7 +98,7 @@
|
||||
<label for="ifCommoditySalesPrice"><span>@Localiser["label.price"]</span><span class="required"> *</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="col-sm-4">
|
||||
<div class="sbm-control">
|
||||
@Html.TextBox("Commodity.SalesPrice", "", new { @id = "ifCommoditySalesPrice", @class = "CommoditySalesPrice sbm-input right sbm-auto-val sbm-format-currency", @maxlength = 12 })
|
||||
</div>
|
||||
@@ -114,8 +113,7 @@
|
||||
@* Sales Unit *@
|
||||
<div class="sbm-form-control @Model_Commodity.GetFieldName(Model_Commodity.ItemField.SalesUnit)">
|
||||
<div class="row">
|
||||
<div class="col-sm-1"></div>
|
||||
<div class="col-sm-3">
|
||||
<div class="col-sm-4">
|
||||
<div class="sbm-label">
|
||||
<label for="ifCommoditySalesUnit"><span>@Localiser["label.unit"]</span><span class="required"> *</span></label>
|
||||
</div>
|
||||
@@ -123,7 +121,7 @@
|
||||
<div class="col-sm">
|
||||
<div class="sbm-control">
|
||||
<div class="row">
|
||||
<div class="col-5">
|
||||
<div class="col-5 pr-1">
|
||||
<select id="" class="CommoditySalesUnitCategory sbm-select" name=""></select>
|
||||
</div>
|
||||
<div class="col-7">
|
||||
@@ -150,7 +148,7 @@
|
||||
<label for="ifCommoditySalesTax"><span>@Localiser["label.tax"]</span><span class="required"> *</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="col-sm-7">
|
||||
<div class="sbm-control">
|
||||
<select id="" class="CommoditySalesTaxCode sbm-select sbm-auto-val" name="Commodity.SalesTaxCode"></select>
|
||||
</div>
|
||||
@@ -166,15 +164,14 @@
|
||||
<div class="sbm-form-control @Model_Commodity.GetFieldName(Model_Commodity.ItemField.SalesPackQty)">
|
||||
@Html.Hidden("Commodity.SalesUomId")
|
||||
<div class="row">
|
||||
<div class="col-sm-1"></div>
|
||||
<div class="col-sm-3">
|
||||
<div class="col-sm-4">
|
||||
<div class="sbm-label">
|
||||
<label for="ifCommoditySalesUnit"><span>@Localiser["label.pack.quantity"]</span><span class="required"> *</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="col-sm-4">
|
||||
<div class="sbm-control">
|
||||
@Html.TextBox("Commodity.SalesPackQty", "", new { @id = "ifCommoditySalesPackQty", @class = "CommoditySalesPackQty sbm-input right sbm-auto-val sbm-format-integer", @maxlength = 5 })
|
||||
@Html.TextBox("Commodity.SalesPackQty", "", new { @id = "ifCommoditySalesPackQty", @class = "CommoditySalesPackQty sbm-input right sbm-auto-val", @maxlength = 5 })
|
||||
</div>
|
||||
<div class="sbm-message"></div>
|
||||
</div>
|
||||
@@ -192,7 +189,7 @@
|
||||
<label for="cbCommodityStatus"><span>@Localiser["label.status"]</span><span class="required"> *</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="col-sm-4">
|
||||
<div class="sbm-control">
|
||||
<select id="cbCommodityStatus" class="CommodityStatus sbm-select sbm-auto-val" name="Commodity.StatusCode"></select>
|
||||
</div>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
@{
|
||||
/* Commodity - Maintain panel */
|
||||
// Ensure view is only included once in page.
|
||||
if (!Model.RegisterView("Views/Commodity/Panel-CommodityMaintain")) return;
|
||||
if (!Model.RegisterView(Html.ViewContext)) return;
|
||||
Model.AdditionalFiles_JS.Add("js/sbm-cmd.js");
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<div class="sbm-panel-data sbm-flex">
|
||||
|
||||
@* Filter form - wrap header to include paging controls. *@
|
||||
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmCommodityFilter", @class = "sbm-form", @onSubmit = "return false;" }))
|
||||
@using (@Html.BeginForm(FormMethod.Post, new { @id = "", @class = "frmCommodityFilter sbm-form", @onSubmit = "return false;" }))
|
||||
{
|
||||
@Html.Hidden("Filter.Mode", Model_Commodity.ViewMode.Maintain, new { @id = "" })
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
@{
|
||||
/* Commodity - Select panel */
|
||||
// Ensure view is only included once in page.
|
||||
if (!Model.RegisterView("Views/Commodity/Panel-CommoditySelect")) return;
|
||||
if (!Model.RegisterView(Html.ViewContext)) return;
|
||||
Model.AdditionalFiles_JS.Add("js/sbm-cmd.js");
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
@inject SbmLocaliser Localiser
|
||||
@{
|
||||
// Ensure view is only included once in page.
|
||||
if (!Model.RegisterView("Views/Common/SelectItem")) return;
|
||||
if (!Model.RegisterView(Html.ViewContext)) return;
|
||||
// Scripts.
|
||||
Model.AdditionalFiles_JS.Add("js/sbm-sel-itm.js");
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
@{
|
||||
/* Contact dialog panel */
|
||||
// Ensure view is only included once in page.
|
||||
if (!Model.RegisterView("Views/Contact/Panel-ContactDialog")) return;
|
||||
if (!Model.RegisterView(Html.ViewContext)) return;
|
||||
}
|
||||
|
||||
<script type="text/javascript">
|
||||
@@ -466,7 +466,3 @@
|
||||
|
||||
<div class="spacer2"></div>
|
||||
</div>
|
||||
|
||||
@* Association panels. *@
|
||||
<partial name="~/Views/Association/Panel-AssociationSelect.cshtml" />
|
||||
<partial name="~/Views/Association/Panel-AssociationDialog.cshtml" />
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
@{
|
||||
/* Contact maintain panel */
|
||||
// Ensure view is only included once in page.
|
||||
if (!Model.RegisterView("Views/Contact/Panel-ContactMaintain")) return;
|
||||
if (!Model.RegisterView(Html.ViewContext)) return;
|
||||
Model.AdditionalFiles_JS.Add("js/sbm-contact.js");
|
||||
}
|
||||
|
||||
@@ -69,3 +69,7 @@
|
||||
</div>
|
||||
|
||||
<partial name="Panel-ContactDialog.cshtml" />
|
||||
|
||||
@* Association panels. *@
|
||||
<partial name="~/Views/Association/Panel-AssociationSelect.cshtml" />
|
||||
<partial name="~/Views/Association/Panel-AssociationDialog.cshtml" />
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
@{
|
||||
/* Contact select panel */
|
||||
// Ensure view is only included once in page.
|
||||
if (!Model.RegisterView("Views/Contact/Panel-ContactSelect")) return;
|
||||
if (!Model.RegisterView(Html.ViewContext)) return;
|
||||
Model.AdditionalFiles_JS.Add("js/sbm-contact.js");
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
@using (@Html.BeginForm(FormMethod.Post, new { @id = "", @class = "frmContactFilter sbm-form", @onSubmit = "return false;" }))
|
||||
{
|
||||
@Html.Hidden("Filter.Mode", Model_Contact.ViewMode.Search, new { @id = "" })
|
||||
@Html.Hidden("Filter.AssociationTypeExclude", Model_Contact.ViewMode.Search, new { @id = "", @class = "FilterAssocTypeExclude" })
|
||||
|
||||
@* Filter Panel *@
|
||||
<div class="sbm-panel-filter">
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
@model Model_Requirement
|
||||
@inject SbmLocaliser Localiser
|
||||
@{
|
||||
/* Requirement page. */
|
||||
ViewData["Title"] = "Requirements";
|
||||
}
|
||||
|
||||
<partial name="Panel-RequirementMaintain.cshtml" />
|
||||
@@ -0,0 +1,373 @@
|
||||
@* View is decoupled from Requirement model as it may be included in other views, eg. Transactions. *@
|
||||
@model SbmModel_Portal
|
||||
@inject SbmLocaliser Localiser
|
||||
@{
|
||||
/* Requirement - Dialog panel */
|
||||
// Ensure view is only included once in page.
|
||||
if (!Model.RegisterView(Html.ViewContext)) return;
|
||||
}
|
||||
|
||||
<script type="text/javascript">
|
||||
sbm.dlg.title.createRequirement = '@Localiser.GetJavascriptText("caption.commodity.create")';
|
||||
sbm.dlg.title.updateRequirement = '@Localiser.GetJavascriptText("caption.commodity.update")';
|
||||
</script>
|
||||
|
||||
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmRequirementId", @class = "sbm-form" }))
|
||||
{
|
||||
@Html.Hidden("Requirement.Id", "", new { @id = "", @class = "RequirementId" })
|
||||
@Html.Hidden("Requirement.DataGroups", "", new { @id = "", @class = "RequirementDataGroups" })
|
||||
}
|
||||
|
||||
<div id="dlgRequirement" class="sbm-dialog" title="">
|
||||
|
||||
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmRequirement", @class = "sbm-form", @onSubmit = "return false;" }))
|
||||
{
|
||||
@Html.Hidden("Requirement.Id", "", new { @id = "", @class = "RequirementId sbm-input" })
|
||||
@Html.Hidden("Requirement.Exists", "", new { @id = "", @class = "RequirementExists sbm-input" })
|
||||
@Html.Hidden("Requirement.SupersededStatusConfirmed", "", new { @id = "", @class = "SupersededStatusConfirmed sbm-input" })
|
||||
<div class="spacer2"></div>
|
||||
|
||||
@* Commodity *@
|
||||
<div class="sbm-form-control @Model_Requirement.GetFieldName(Model_Requirement.ItemField.Commodity)">
|
||||
<div class="row">
|
||||
<div class="col-sm-2">
|
||||
<div class="sbm-label">
|
||||
<label for="ifReqntProductCode"><span>@Localiser["label.item"]</span><span class="required"> *</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="sbm-control row">
|
||||
<div class="col">
|
||||
@Html.Hidden("Requirement.CommodityId", "", new { @id = "", @class = "ReqntCommodityId sbm-input" })
|
||||
<input type="text" id="ifReqntProductCode" class="ReqntProductCode sbm-input" readonly="readonly" />
|
||||
</div>
|
||||
<div class="fixed">
|
||||
<div class="sbm-action ReqntCommoditySearch"><img src="~/img/action/search24.png" alt="" title="" /></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sbm-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* Requirement Narrative *@
|
||||
<div class="sbm-form-control @Model_Requirement.GetFieldName(Model_Requirement.ItemField.DescBrief)">
|
||||
<div class="row">
|
||||
<div class="col-sm-2">
|
||||
<div class="sbm-label">
|
||||
<label for="ifReqntDesc"><span>@Localiser["label.description"]</span><span class="required"> *</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="sbm-control">
|
||||
@Html.TextBox("Requirement.DescBrief", "", new { @id = "ifReqntDesc", @class = "ReqntDesc sbm-input sbm-auto-val", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Requirement_DescBrief) })
|
||||
</div>
|
||||
<div class="sbm-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
|
||||
@* Sales Unit *@
|
||||
<div class="sbm-form-control @Model_Requirement.GetFieldName(Model_Requirement.ItemField.Unit)">
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<div class="sbm-label">
|
||||
<label for="cbReqntUnitType"><span>@Localiser["label.unit"]</span><span class="required"> *</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="sbm-control">
|
||||
<div class="row">
|
||||
<div class="col-5 pr-1">
|
||||
<select id="" class="ReqntUnitCategory sbm-select" name=""></select>
|
||||
</div>
|
||||
<div class="col-7 pr-2">
|
||||
<select id="cbReqntUnitType" class="ReqntUnitType sbm-select" name="Requirement.UomId"></select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sbm-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
|
||||
@* Sales Unit *@
|
||||
<div class="sbm-form-control @Model_Requirement.GetFieldName(Model_Requirement.ItemField.PackQty)">
|
||||
@Html.Hidden("Requirement.SalesUomId")
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<div class="sbm-label">
|
||||
<label for="ifRequirementSalesUnit"><span>@Localiser["label.pack.quantity"]</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<div class="sbm-control">
|
||||
<input type="text" id="ifReqntPackQty" class="ReqntPackQty sbm-input right" readonly="readonly" />
|
||||
</div>
|
||||
<div class="sbm-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
|
||||
@* Sales Price *@
|
||||
<div class="sbm-form-control @Model_Requirement.GetFieldName(Model_Requirement.ItemField.AmountUnit)">
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<div class="sbm-label">
|
||||
<label for="ifReqntAmountUnit"><span>@Localiser["label.amount.unit"]</span><span class="required"> *</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<div class="sbm-control">
|
||||
@Html.TextBox("Requirement.AmountUnit", "", new { @id = "ifReqntAmountUnit", @class = "ReqntAmountUnit sbm-input sbm-auto-val right sbm-format-currency", @readonly = true, @maxlength = 12 })
|
||||
</div>
|
||||
<div class="sbm-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
|
||||
@* Quantity *@
|
||||
<div class="sbm-form-control @Model_Requirement.GetFieldName(Model_Requirement.ItemField.Quantity)">
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<div class="sbm-label">
|
||||
<label for="ifReqntQuantity"><span>@Localiser["label.quantity"]</span><span class="required"> *</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<div class="sbm-control">
|
||||
@Html.TextBox("Requirement.Quantity", "", new { @id = "ifReqntQuantity", @class = "ReqntQuantity sbm-input sbm-auto-val right", @maxlength = 8 })
|
||||
</div>
|
||||
<div class="sbm-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
|
||||
@* Actual Amount *@
|
||||
<div class="sbm-form-control @Model_Requirement.GetFieldName(Model_Requirement.ItemField.AmountAct)">
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<div class="sbm-label">
|
||||
<label for="ifReqntAmountAct"><span>@Localiser["label.amount.actual"]</span><span class="required"> *</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<div class="sbm-control">
|
||||
@Html.TextBox("Requirement.AmountAct", "", new { @id = "ifReqntAmountAct", @class = "ReqntAmountAct sbm-input sbm-auto-val right sbm-format-currency", @readonly = true, @maxlength = 12 })
|
||||
</div>
|
||||
<div class="sbm-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
|
||||
@* Amount Disc*@
|
||||
<div class="sbm-form-control @Model_Requirement.GetFieldName(Model_Requirement.ItemField.AmountDisc)">
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<div class="sbm-label">
|
||||
<label for="ifReqntAmountDisc"><span>@Localiser["label.discount"]</span><span class="required"> *</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<div class="sbm-control">
|
||||
@Html.TextBox("Requirement.AmountDisc", "", new { @id = "ifReqntAmountDisc", @class = "ReqntAmountDisc sbm-input sbm-auto-val right sbm-format-currency", @readonly = true, @maxlength = 12 })
|
||||
</div>
|
||||
<div class="sbm-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
|
||||
@* Amount Net*@
|
||||
<div class="sbm-form-control @Model_Requirement.GetFieldName(Model_Requirement.ItemField.AmountNet)">
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<div class="sbm-label">
|
||||
<label for="ifReqntAmountNet"><span>@Localiser["label.amount.net"]</span><span class="required"> *</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<div class="sbm-control">
|
||||
@Html.TextBox("Requirement.AmountNet", "", new { @id = "ifReqntAmountNet", @class = "ReqntAmountNet sbm-input sbm-auto-val right sbm-format-currency", @readonly = true, @maxlength = 12 })
|
||||
</div>
|
||||
<div class="sbm-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
|
||||
@* Tax *@
|
||||
<div class="sbm-form-control @Model_Requirement.GetFieldName(Model_Requirement.ItemField.TaxCode)">
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<div class="sbm-label">
|
||||
<label for="cbReqntTaxCode"><span>@Localiser["label.tax"]</span><span class="required"> *</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-7">
|
||||
<div class="sbm-control">
|
||||
<select id="cbReqntTaxCode" class="ReqntTaxCode sbm-select sbm-auto-val" name="Requirement.TaxCode"></select>
|
||||
</div>
|
||||
<div class="sbm-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
|
||||
@* Amount Tax*@
|
||||
<div class="sbm-form-control @Model_Requirement.GetFieldName(Model_Requirement.ItemField.AmountTax)">
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<div class="sbm-label">
|
||||
<label for="ifReqntAmountTax"><span>@Localiser["label.amount.tax"]</span><span class="required"> *</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<div class="sbm-control">
|
||||
@Html.TextBox("Requirement.AmountTax", "", new { @id = "ifReqntAmountTax", @class = "ReqntAmountTax sbm-input sbm-auto-val right sbm-format-currency", @readonly = true, @maxlength = 12 })
|
||||
</div>
|
||||
<div class="sbm-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
|
||||
@* Required *@
|
||||
<div class="sbm-form-control @Model_Requirement.GetFieldName(Model_Requirement.ItemField.Required)">
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<div class="sbm-label">
|
||||
<label for="ifRequirementRequired"><span>@Localiser["label.required"]</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="sbm-control row">
|
||||
<div class="fixed">@Html.TextBox("Requirement.Required", "", new { @id = "ifRequirementRequired", @class = "RequirementRequired sbm-input sbm-calendar sbm-auto-val", @maxlen = 10 })</div>
|
||||
<div class="col"><div class="pt-2 pl-2"><img src="~/img/action/delete16.png" class="ClearRequirementRequired sbm-action" alt="" title="" /></div></div>
|
||||
</div>
|
||||
<div class="sbm-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
|
||||
@* Amount Tot*@
|
||||
<div class="sbm-form-control @Model_Requirement.GetFieldName(Model_Requirement.ItemField.AmountTot)">
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<div class="sbm-label">
|
||||
<label for="ifReqntAmountTot"><span>@Localiser["label.amount.total"]</span><span class="required"> *</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<div class="sbm-control">
|
||||
@Html.TextBox("Requirement.AmountTot", "", new { @id = "ifReqntAmountTot", @class = "ReqntAmountTot sbm-input sbm-auto-val right sbm-format-currency", @readonly = true, @maxlength = 12 })
|
||||
</div>
|
||||
<div class="sbm-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
|
||||
@* Requirement status *@
|
||||
<div class="sbm-form-control @Model_Requirement.GetFieldName(Model_Requirement.ItemField.Status)">
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<div class="sbm-label">
|
||||
<label for="cbRequirementStatus"><span>@Localiser["label.status"]</span><span class="required"> *</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="sbm-control">
|
||||
<select id="cbRequirementStatus" class="RequirementStatus sbm-select sbm-auto-val" name="Requirement.StatusCode"></select>
|
||||
</div>
|
||||
<div class="sbm-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* Requirement Notes *@
|
||||
<div class="sbm-form-control @Model_Requirement.GetFieldName(Model_Requirement.ItemField.Notes)">
|
||||
<div class="row">
|
||||
<div class="col-sm-2">
|
||||
<div class="sbm-label">
|
||||
<label for="ifRequirementNotes"><span>@Localiser["label.notes"]</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="sbm-control">
|
||||
@Html.TextArea("Requirement.Notes", "", new { @id = "ifRequirementNotes", @class = "RequirementNotes sbm-textarea sbm-auto-val", @rows = "3", @maxlength = @Model.GetControlMaxLength(SbmDbDfn.ColumnIdx.Requirement_Notes) })
|
||||
</div>
|
||||
<div class="sbm-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
}
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,74 @@
|
||||
@* View is decoupled from Requirement model as it may be included in other views, eg. Transactions. *@
|
||||
@model SbmModel_Portal
|
||||
@inject SbmLocaliser Localiser
|
||||
@{
|
||||
/* Requirement - List panel */
|
||||
/* NB Can potentially appear more than once on a page. */
|
||||
}
|
||||
|
||||
@* Item list *@
|
||||
<div class="sbm-panel-item-table sbm-flex">
|
||||
<table class="sbm-item-list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="@Model_Requirement.GetFieldName(Model_Requirement.ItemField.Sequence) width5pc nowrap right pl-2 pr-2">@Localiser["label.seq"]</th>
|
||||
<th class="@Model_Requirement.GetFieldName(Model_Requirement.ItemField.ProductCode) width25pc nowrap">@Localiser["label.code"]</th>
|
||||
<th class="@Model_Requirement.GetFieldName(Model_Requirement.ItemField.DescBrief) width25pc nowrap">@Localiser["label.description"]</th>
|
||||
<th class="@Model_Requirement.GetFieldName(Model_Requirement.ItemField.Quantity) width25pc nowrap right">@Localiser["label.quantity"]</th>
|
||||
@if (Model.UserCanViewFinancials())
|
||||
{
|
||||
<th class="@Model_Requirement.GetFieldName(Model_Requirement.ItemField.AmountUnit) width5pc nowrap right">@Localiser["label.amount.unit"]</th>
|
||||
<th class="@Model_Requirement.GetFieldName(Model_Requirement.ItemField.AmountNet) width5pc nowrap right">@Localiser["label.amount.net"]</th>
|
||||
}
|
||||
<th class="@Model_Requirement.GetFieldName(Model_Requirement.ItemField.Notes) width25pc d-none d-md-table-cell">@Localiser["label.notes"]</th>
|
||||
<th class="@Model_Requirement.GetFieldName(Model_Requirement.ItemField.Status) width5pc center">@Localiser["label.status"]</th>
|
||||
<th class="@Model_Requirement.GetFieldName(Model_Requirement.ItemField.Actions) width5pc right" style="width:2%;"></th>
|
||||
</tr>
|
||||
<tr><td colspan="6"><div class="sbm-panel-messages"></div></td></tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@* Element templates *@
|
||||
<div class="sbm-panel-item-template">
|
||||
|
||||
@* List burger dropdown template - ul is ignored *@
|
||||
<ul class="sbm-dropdown-menu RequirementList">
|
||||
<li class="sbm-dropdown-item sbm-action"><div class="sbm-label">XXX</div></li>
|
||||
</ul>
|
||||
|
||||
@* Item row template - table is ignored. *@
|
||||
<table>
|
||||
<tr class="sbm-row-item Requirement">
|
||||
<td class="@Model_Requirement.GetFieldName(Model_Requirement.ItemField.Sequence) nowrap right pl-2 pr-2"></td>
|
||||
<td class="@Model_Requirement.GetFieldName(Model_Requirement.ItemField.ProductCode) nowrap"></td>
|
||||
<td class="@Model_Requirement.GetFieldName(Model_Requirement.ItemField.DescBrief)"></td>
|
||||
<td class="@Model_Requirement.GetFieldName(Model_Requirement.ItemField.Quantity) right nowrap"></td>
|
||||
@if (Model.UserCanViewFinancials())
|
||||
{
|
||||
<td class="@Model_Requirement.GetFieldName(Model_Requirement.ItemField.AmountUnit) right nowrap"></td>
|
||||
<td class="@Model_Requirement.GetFieldName(Model_Requirement.ItemField.AmountNet) center nowrap"></td>
|
||||
}
|
||||
<td class="@Model_Requirement.GetFieldName(Model_Requirement.ItemField.Notes) d-none d-md-table-cell"></td>
|
||||
<td class="@Model_Requirement.GetFieldName(Model_Requirement.ItemField.Status) center nowrap"></td>
|
||||
<td class="@Model_Requirement.GetFieldName(Model_Requirement.ItemField.Actions)">
|
||||
<div class="right">
|
||||
@* Burger menu *@
|
||||
<ul class="nav navbar-nav navbar-light navbar-right sbm-burger">
|
||||
<li class="dropdown-toggle caret-off">
|
||||
<a href="#" class="dropdown" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="sbm-ellipsis-dot"></span><span class="sbm-ellipsis-dot"></span><span class="sbm-ellipsis-dot"></span></a>
|
||||
<ul class="dropdown-menu dropdown-menu-right sbm-dropdown-menu">@* Menu items will be inserted here. *@</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@* Item burger dropdown template - ul is ignored *@
|
||||
<ul class="sbm-dropdown-menu Requirement">
|
||||
<li class="sbm-dropdown-item sbm-action"><div class="sbm-label">XXX</div></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,66 @@
|
||||
@* View is decoupled from Requirement model as it may be included in other views, eg. Transactions. *@
|
||||
@model SbmModel_Portal
|
||||
@inject SbmLocaliser Localiser
|
||||
@{
|
||||
/* Requirement - Maintain panel */
|
||||
// Ensure view is only included once in page.
|
||||
if (!Model.RegisterView(Html.ViewContext)) return;
|
||||
Model.AdditionalFiles_JS.Add("js/sbm-req.js");
|
||||
}
|
||||
|
||||
<div class="sbm-panel Requirements fullheight">
|
||||
|
||||
<script type="text/javascript">
|
||||
</script>
|
||||
|
||||
<div class="sbm-panel-data sbm-flex">
|
||||
|
||||
@* Filter form - wrap header to include paging controls. *@
|
||||
@using (@Html.BeginForm(FormMethod.Post, new { @id = "", @class = "frmRequirementFilter sbm-form", @onSubmit = "return false;" }))
|
||||
{
|
||||
@Html.Hidden("Filter.Mode", Model_Requirement.ViewMode.Maintain, new { @id = "" })
|
||||
|
||||
@* Header - Page caption, paging controls, actions. *@
|
||||
<div class="sbm-panel-header">
|
||||
<div class="row">
|
||||
<div class="col"><partial name="~/Views/Common/ResultsPaging.cshtml" /></div>
|
||||
<div class="fixed center"><div class="sbm-panel-caption">@Localiser["label.Requirements"]</div></div>
|
||||
<div class="col right">
|
||||
@* Burger menu *@
|
||||
<ul class="nav navbar-nav navbar-dark navbar-right sbm-burger">
|
||||
<li class="dropdown-toggle caret-off">
|
||||
<a href="#" class="dropdown" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="navbar-toggler-icon"></span></a>
|
||||
<ul class="dropdown-menu dropdown-menu-right sbm-dropdown-menu">@* Menu items will be inserted here. *@</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* Filter Panel *@
|
||||
<div class="sbm-panel-filter">
|
||||
<div class="row">
|
||||
<div class="col-sm-4 row pb4">
|
||||
@* Requirement filter - code, description etc *@
|
||||
<div class="col-4 col-sm-4 sbm-label text-left text-sm-right">@Localiser["label.search"]</div>
|
||||
<div class="col-7 col-sm-8">
|
||||
@Html.TextBox("Filter.Search", "", new { @type = "search", @id = "", @class = "FilterSearch sbm-input", @maxlength = "32" })
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4 row pb4">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<partial name="Panel-RequirementList.cshtml" />
|
||||
|
||||
</div>
|
||||
|
||||
<partial name="Panel-RequirementDialog.cshtml" />
|
||||
|
||||
</div>
|
||||
|
||||
@* Commodity panels. *@
|
||||
<partial name="~/Views/Commodity/Panel-CommoditySelect.cshtml" />
|
||||
<partial name="~/Views/Commodity/Panel-CommodityDialog.cshtml" />
|
||||
@@ -0,0 +1,37 @@
|
||||
@* View is decoupled from Requirement model as it may be included in other views, eg. Transactions. *@
|
||||
@model SbmModel_Portal
|
||||
@inject SbmLocaliser Localiser
|
||||
@{
|
||||
/* Requirement - Select panel */
|
||||
// Ensure view is only included once in page.
|
||||
if (!Model.RegisterView(Html.ViewContext)) return;
|
||||
Model.AdditionalFiles_JS.Add("js/sbm-req.js");
|
||||
}
|
||||
|
||||
<script type="text/javascript">
|
||||
</script>
|
||||
|
||||
<div id="dlgRequirementSelect" class="sbm-dialog sbm-flex sbm-no-padding" title="@Localiser["label.requirements"]">
|
||||
|
||||
@using (@Html.BeginForm(FormMethod.Post, new { @id = "", @class = "frmRequirementFilter sbm-form", @onSubmit = "return false;" }))
|
||||
{
|
||||
@Html.Hidden("Filter.Mode", Model_Requirement.ViewMode.Search, new { @id = "", @class = "FilterMode" })
|
||||
@Html.Hidden("Filter.TransactionId", "", new { @id = "", @class = "FilterTransactionId" })
|
||||
|
||||
@* Filter Panel *@
|
||||
<div class="sbm-panel-filter">
|
||||
<div class="row">
|
||||
<div class="col-sm-4 row pb4">
|
||||
@* Requirement filter - name etc. *@
|
||||
<div class="col-4 col-sm-4 sbm-label text-left text-sm-right">@Localiser["label.search"]</div>
|
||||
<div class="col-8 col-sm-8">
|
||||
@Html.TextBox("Filter.Search", "", new { @type = "search", @id = "", @class = "FilterSearch sbm-input", @maxlength = "32" })
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<partial name="Panel-RequirementList.cshtml" />
|
||||
|
||||
</div>
|
||||
@@ -64,6 +64,8 @@
|
||||
sbm.lbl.refresh = '@(Localiser.GetJavascriptText("label.refresh"))';
|
||||
sbm.lbl.create = '@(Localiser.GetJavascriptText("label.create"))';
|
||||
sbm.lbl.edit = '@(Localiser.GetJavascriptText("label.edit"))';
|
||||
sbm.lbl.populate = '@(Localiser.GetJavascriptText("label.populate"))';
|
||||
sbm.lbl.items = '@(Localiser.GetJavascriptText("label.items"))';
|
||||
sbm.lbl.calendar = '@Localiser.GetJavascriptText("label.calendar")';
|
||||
sbm.lbl.yes = '@Localiser["label.yes"]';
|
||||
sbm.lbl.no = '@Localiser["label.no"]';
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
@{
|
||||
/* Transaction - Dialog panel */
|
||||
// Ensure view is only included once in page.
|
||||
if (!Model.RegisterView("Views/Transaction/Panel-TransactionDialog")) return;
|
||||
if (!Model.RegisterView(Html.ViewContext)) return;
|
||||
}
|
||||
|
||||
<script type="text/javascript">
|
||||
@@ -286,8 +286,3 @@
|
||||
}
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@* Association panels. *@
|
||||
<partial name="~/Views/Association/Panel-AssociationSelect.cshtml" />
|
||||
<partial name="~/Views/Association/Panel-AssociationDialog.cshtml" />
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
@{
|
||||
/* Transaction - Maintain panel */
|
||||
// Ensure view is only included once in page.
|
||||
if (!Model.RegisterView("Views/Transaction/Panel-TransactionMaintain")) return;
|
||||
if (!Model.RegisterView(Html.ViewContext)) return;
|
||||
Model.AdditionalFiles_JS.Add("js/sbm-trn.js");
|
||||
Model_Transaction ModelTransaction = Model as Model_Transaction;
|
||||
}
|
||||
@@ -83,3 +83,11 @@
|
||||
<partial name="Panel-TransactionDialog.cshtml" />
|
||||
|
||||
</div>
|
||||
|
||||
@* Association panels. *@
|
||||
<partial name="~/Views/Association/Panel-AssociationSelect.cshtml" />
|
||||
<partial name="~/Views/Association/Panel-AssociationDialog.cshtml" />
|
||||
|
||||
@* Requirement panels. *@
|
||||
<partial name="~/Views/Requirement/Panel-RequirementSelect.cshtml" />
|
||||
<partial name="~/Views/Requirement/Panel-RequirementDialog.cshtml" />
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
@{
|
||||
/* Transaction - Select panel */
|
||||
// Ensure view is only included once in page.
|
||||
if (!Model.RegisterView("Views/Transaction/Panel-TransactionSelect")) return;
|
||||
if (!Model.RegisterView(Html.ViewContext)) return;
|
||||
Model.AdditionalFiles_JS.Add("js/sbm-trn.js");
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
@using Sarand.BusinessMgr.Web.Portal.Models.Contacts
|
||||
@using Sarand.BusinessMgr.Web.Portal.Models.Commodities
|
||||
@using Sarand.BusinessMgr.Web.Portal.Models.Transactions
|
||||
@using Sarand.BusinessMgr.Web.Portal.Models.Requirements
|
||||
@using Sarand.BusinessMgr.Web.Portal.Models.Assets
|
||||
@using Sarand.BusinessMgr.Web.Portal.Models.Vehicles
|
||||
@using Sarand.BusinessMgr.Web.Portal.Models.Codes
|
||||
|
||||
@@ -62,6 +62,11 @@
|
||||
--color-panel-data: var(--color-RoyalBlue);
|
||||
}
|
||||
|
||||
.Requirements .sbm-panel-data
|
||||
{
|
||||
--color-panel-data: var(--color-CornflowerBlue);
|
||||
}
|
||||
|
||||
.CodeTypes .sbm-panel-data,
|
||||
.Codes .sbm-panel-data
|
||||
{
|
||||
@@ -110,6 +115,11 @@
|
||||
--color-dialog: var(--color-RoyalBlue);
|
||||
}
|
||||
|
||||
.ui-dialog.sbm-Requirement
|
||||
{
|
||||
--color-dialog: var(--color-CornflowerBlue);
|
||||
}
|
||||
|
||||
.ui-dialog.sbm-CodeTypes,
|
||||
.ui-dialog.sbm-Codes
|
||||
{
|
||||
|
||||
@@ -259,7 +259,7 @@ a:focus
|
||||
{
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: 7px;
|
||||
top: 5px;
|
||||
right: 48px;
|
||||
min-width: 180px;
|
||||
z-index: 1000;
|
||||
|
||||
@@ -222,12 +222,13 @@
|
||||
{
|
||||
//sbm.debug('selectAssetCategory', prm);
|
||||
let env = ac.env.select;
|
||||
if (!env.$pnl.items.length) return;
|
||||
env.prmSelect = prm;
|
||||
env.$frm.filter.find('.FilterAssetType').val('');
|
||||
env.$frm.filter.find('.FilterSearch').val(prm.search || '');
|
||||
env.$pnl.table.find('tbody tr').remove();
|
||||
sbm.openDialog(env.$dlg.select, 1000, 800);
|
||||
if (env.$pnl.items.length) setTimeout(function () { ac.refreshResults(env); }, 250);
|
||||
setTimeout(function () { ac.refreshResults(env); }, 250);
|
||||
}
|
||||
ac.selectItemRow = function (env, $item, item)
|
||||
{
|
||||
@@ -265,15 +266,16 @@
|
||||
{
|
||||
let env = { mode: { search: 1 }, data: {}, ajax: {}, $pnl: {}, $frm: {}, $ctrl: {}, $dlg: {} };
|
||||
|
||||
env.$pnl.items = $($pnlItems);
|
||||
env.$pnl.header = env.$pnl.items.find('.sbm-panel-header');
|
||||
env.$pnl.bgr = env.$pnl.header.find('.sbm-burger');
|
||||
let $items = env.$pnl.items = $($pnlItems);
|
||||
if (!$items.length) return env;
|
||||
env.$pnl.hdr = $items.find('.sbm-panel-header');
|
||||
env.$pnl.bgr = env.$pnl.hdr.find('.sbm-burger').invisible();
|
||||
env.$pnl.mnu = env.$pnl.bgr.find('ul.sbm-dropdown-menu');
|
||||
env.$pnl.table = env.$pnl.items.find('.sbm-panel-item-table');
|
||||
env.$pnl.table = $items.find('.sbm-panel-item-table');
|
||||
env.$pnl.msgs = env.$pnl.table.find('.sbm-panel-messages');
|
||||
env.$pnl.tmpls = env.$pnl.items.find('.sbm-panel-item-template');
|
||||
env.$pnl.tmpls = $items.find('.sbm-panel-item-template');
|
||||
|
||||
env.$frm.filter = env.$pnl.items.find('.frmAssetCategoryFilter');
|
||||
env.$frm.filter = $items.find('.frmAssetCategoryFilter');
|
||||
env.$frm.filter.on('input', '.FilterSearch', function () { ac.refreshResults(env,250); });
|
||||
env.$frm.filter.on('change', '.FilterAssetType', function () { ac.refreshResults(env, 50); });
|
||||
|
||||
@@ -281,7 +283,7 @@
|
||||
var opt = sbm.dlgOpts();
|
||||
opt.dialogClass += " sbm-AssetCategory";
|
||||
env.$dlg.item = $('#dlgAssetCategory').dialog(opt);
|
||||
env.$frm.item = $('#frmAssetCategory').on('input', '.sbm-input, .sbm-textarea', function () { sbm.clearControlError(this); }).on('change', '.sbm-select', function () { sbm.clearControlError(this); });
|
||||
env.$frm.item = $('#frmAssetCategory').off('input').on('input', '.sbm-input, .sbm-textarea', function () { sbm.clearControlError(this); }).off('change').on('change', '.sbm-select', function () { sbm.clearControlError(this); });
|
||||
|
||||
var opt = sbm.dlgOpts();
|
||||
opt.dialogClass += " sbm-AssetCategory";
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
{
|
||||
if (!env.data.awaitingRefreshResponse)
|
||||
{
|
||||
$('.sbm-burger', env.$pnl.header).invisible();
|
||||
$('.sbm-burger', env.$pnl.hdr).invisible();
|
||||
env.$pnl.table.find('tbody tr').remove();
|
||||
env.$pnl.msgs.hide().empty().append($('<div class="sbm-message">' + sbm.msg.dataQuerying + '</div>')).fadeIn(200);
|
||||
}
|
||||
@@ -148,6 +148,7 @@
|
||||
let $dlg = env.$dlg.item;
|
||||
let $frm = env.$frm.item;
|
||||
sbm.configureItemControls(cfg, $frm);
|
||||
env.$frm.item.off('dblclick').on('dblclick', '.sbm-input.AssetCategory', function () { as.selectItemAssetCategory(env); }).off('click').on('click', '.sbm-action.AssetCategorySearch', function () { as.selectItemAssetCategory(env); });
|
||||
var btns = {};
|
||||
btns[sbm.lbl.ok] = function () { as.storeItem(env); };
|
||||
btns[sbm.lbl.cancel] = function () { delete env.prmEdit; $(this).dialog('close'); };
|
||||
@@ -242,12 +243,13 @@
|
||||
{
|
||||
//sbm.debug('selectAsset', prm);
|
||||
let env = as.env.select;
|
||||
if (!env.$pnl.items.length) return;
|
||||
env.prmSelect = prm;
|
||||
env.$frm.filter.find('.FilterAssetType').val('');
|
||||
env.$frm.filter.find('.FilterSearch').val(prm.search || '');
|
||||
env.$pnl.table.find('tbody tr').remove();
|
||||
sbm.openDialog(env.$dlg.select, 1000, 800);
|
||||
if (env.$pnl.items.length) setTimeout(function () { as.refreshResults(env); }, 250);
|
||||
setTimeout(function () { as.refreshResults(env); }, 250);
|
||||
}
|
||||
as.selectItemRow = function (env, $item, item)
|
||||
{
|
||||
@@ -285,15 +287,16 @@
|
||||
{
|
||||
let env = { mode: { search: 1 }, data: {}, ajax: {}, $pnl: {}, $frm: {}, $ctrl: {}, $dlg: {} };
|
||||
|
||||
env.$pnl.items = $($pnlItems);
|
||||
env.$pnl.header = env.$pnl.items.find('.sbm-panel-header');
|
||||
env.$pnl.bgr = env.$pnl.header.find('.sbm-burger');
|
||||
let $items = env.$pnl.items = $($pnlItems);
|
||||
if (!$items.length) return env;
|
||||
env.$pnl.hdr = $items.find('.sbm-panel-header');
|
||||
env.$pnl.bgr = env.$pnl.hdr.find('.sbm-burger').invisible();
|
||||
env.$pnl.mnu = env.$pnl.bgr.find('ul.sbm-dropdown-menu');
|
||||
env.$pnl.table = env.$pnl.items.find('.sbm-panel-item-table');
|
||||
env.$pnl.msgs = env.$pnl.items.find('.sbm-panel-messages');
|
||||
env.$pnl.tmpls = env.$pnl.items.find('.sbm-panel-item-template');
|
||||
env.$pnl.table = $items.find('.sbm-panel-item-table');
|
||||
env.$pnl.msgs = $items.find('.sbm-panel-messages');
|
||||
env.$pnl.tmpls = $items.find('.sbm-panel-item-template');
|
||||
|
||||
env.$frm.filter = env.$pnl.items.find('.frmAssetFilter');
|
||||
env.$frm.filter = $items.find('.frmAssetFilter');
|
||||
env.$frm.filter.on('input', '.FilterSearch', function () { as.refreshResults(env, 250); });
|
||||
env.$frm.filter.on('click', '.AssetCategorySearch', function () { as.selectFilterAssetCategory(env); }).on('dblclick', '.FilterAssetCategory', function () { as.selectFilterAssetCategory(env); });
|
||||
env.$frm.filter.on('click', '.AssetCategoryClear', function () { as.onSelectFilterAssetCategory(env, {}) });
|
||||
@@ -303,8 +306,7 @@
|
||||
opt.dialogClass += " sbm-Asset";
|
||||
env.$dlg.item = $('#dlgAsset').dialog(opt);
|
||||
env.$frm.item = env.$dlg.item.find('#frmAsset');
|
||||
$(env.$frm.item).on('input', '.sbm-input, .sbm-textarea', function () { sbm.clearControlError(this); }).on('change', '.sbm-select', function () { sbm.clearControlError(this); });
|
||||
$(env.$frm.item).on('dblclick', '.sbm-input.AssetCategory', as.selectItemAssetCategory).on('click', '.sbm-action.AssetCategorySearch', as.selectItemAssetCategory);
|
||||
env.$frm.item.off('input').on('input', '.sbm-input, .sbm-textarea', function () { sbm.clearControlError(this); }).off('change').on('change', '.sbm-select', function () { sbm.clearControlError(this); });
|
||||
|
||||
return env;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
as.storeConfig(env, response);
|
||||
let cfg = env.data.cfgList;
|
||||
env.mode = response.mode;
|
||||
if (cfg.caption) env.$pnl.items.find('.sbm-panel-caption').text(cfg.caption);
|
||||
if (cfg.caption) env.$pnl.hdr.find('.sbm-panel-caption').text(cfg.caption);
|
||||
|
||||
// Menu.
|
||||
if (env.$pnl.bgr.length)
|
||||
@@ -131,30 +131,32 @@
|
||||
as.clearItem(env, cfg);
|
||||
let prefix = cfg.field.prefix;
|
||||
let $ctrls = $('.sbm-input,.sbm-textarea,.sbm-select', env.$frm.item);
|
||||
if (cfg.type) sbm.populateSelectCodeDesc('#cbAssociationType', [{ code: cfg.type.code, desc: cfg.type.desc }])
|
||||
if (cfg.type) sbm.populateSelectCodeDesc('#cbAssocType', [{ code: cfg.type.code, desc: cfg.type.desc }])
|
||||
env.$ctrl.targetActions.filter('.AssocTargetSearch').show();
|
||||
$ctrls.filter('.AssociationTarget').off('dblclick').on('dblclick', function () { as.selectTarget(env); });
|
||||
env.$ctrl.target.off('dblclick').on('dblclick', function () { as.selectTarget(env); });
|
||||
if ((target || {}).id)
|
||||
{
|
||||
$ctrls.filter('.AssociationTargetId').val(target.id);
|
||||
$ctrls.filter('.AssociationTarget').val(target.name);
|
||||
env.$ctrl.targetId.val(target.id);
|
||||
env.$ctrl.target.val(target.name);
|
||||
}
|
||||
$ctrls.filter('.AssociationStatus').val(env.data.defaultStatusCode);
|
||||
$ctrls.filter('.AssocStatus').val(env.data.defaultStatusCode);
|
||||
as.openItemDlg(env, cfg, title);
|
||||
}
|
||||
as.clearItem = function (env, cfg)
|
||||
{
|
||||
sbm.clearItemForm(env.$frm.item);
|
||||
let prefix = cfg.field.prefix;
|
||||
sbm.populateSelectCodeDesc('#cbAssociationType', env.data.associationTypes);
|
||||
sbm.populateSelectCodeDesc('#cbAssocType', env.data.associationTypes);
|
||||
env.$ctrl.targetActions.hide();
|
||||
sbm.populateSelectCodeDesc('#cbAssociationStatus', env.data.statuses);
|
||||
sbm.populateSelectCodeDesc('#cbAssocStatus', env.data.statuses);
|
||||
}
|
||||
as.openItemDlg = function (env, cfg, title)
|
||||
{
|
||||
sbm.configureItemControls(cfg, env.$frm.item);
|
||||
let $ctrls = $('.sbm-input,.sbm-textarea,.sbm-select', env.$frm.item);
|
||||
$ctrls.filter('.AssociationTarget').prop('disabled', false)
|
||||
env.$ctrl.target.prop('disabled', false)
|
||||
env.$ctrl.targetActions.filter('.AssocTargetSearch').off('click').on('click', function () { as.selectTarget(env); });
|
||||
env.$ctrl.targetActions.filter('.AssocTargetEdit').off('click').on('click', function () { as.editTarget(env); });
|
||||
let $dlg = env.$dlg.item;
|
||||
let btns = {};
|
||||
btns[sbm.lbl.ok] = function () { as.storeItem(env); };
|
||||
@@ -164,33 +166,6 @@
|
||||
sbm.openDialog($dlg, 720, 640);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
as.selectTarget = function (env)
|
||||
{
|
||||
sbm.fn.selectContact({ fnSuccess: function (item) { as.onSelectTarget(env, item); } });
|
||||
}
|
||||
as.onSelectTarget = function (env, item)
|
||||
{
|
||||
//sbm.debug('onSelectTarget', env, item);
|
||||
let $ctrls = $('.sbm-input,.sbm-textarea,.sbm-select', env.$frm.item);
|
||||
$ctrls.filter('.AssociationTargetId').val(item.id);
|
||||
$ctrls.filter('.AssociationTarget').val(item.name);
|
||||
}
|
||||
as.editTarget = function (env)
|
||||
{
|
||||
let cfg = {
|
||||
id: $('.sbm-input', env.$frm.item).filter('.AssociationTargetId').val(),
|
||||
fnSuccess: function (item) { as.onEditTarget(env, item); }
|
||||
};
|
||||
sbm.fn.editContact(cfg);
|
||||
}
|
||||
as.onEditTarget = function (env, item)
|
||||
{
|
||||
//sbm.debug('onEditTarget', env, item);
|
||||
let $ctrls = $('.sbm-input,.sbm-textarea,.sbm-select', env.$frm.item);
|
||||
$ctrls.filter('.AssociationTarget').val(item.name);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
as.updateItem = function (env, id)
|
||||
{
|
||||
@@ -211,15 +186,42 @@
|
||||
let $ctrls = $('.sbm-input,.sbm-textarea,.sbm-select', $frm);
|
||||
$ctrls.filter('.AssociationId').val(item.id);
|
||||
$ctrls.filter('.AssociationExists').val(1);
|
||||
sbm.selectOrAdd($ctrls.filter('.AssociationType'), item.typeCode, item.typeDesc)
|
||||
$ctrls.filter('.AssociationOwnerId').val(item.ownerId);
|
||||
$ctrls.filter('.AssociationTargetId').val(item.targetId);
|
||||
sbm.selectOrAdd($ctrls.filter('.AssocType'), item.typeCode, item.typeDesc)
|
||||
$ctrls.filter('.AssocOwnerId').val(item.ownerId);
|
||||
env.$ctrl.targetId.val(item.targetId);
|
||||
env.$ctrl.targetActions.filter('.AssocTargetEdit').show();
|
||||
$ctrls.filter('.AssociationTarget').off('dblclick').on('dblclick', function () { as.editTarget(env); });
|
||||
sbm.selectOrAdd($ctrls.filter('.AssociationStatus'), item.statusCode, item.statusDesc)
|
||||
env.$ctrl.target.off('dblclick').on('dblclick', function () { as.editTarget(env); });
|
||||
sbm.selectOrAdd($ctrls.filter('.AssocStatus'), item.statusCode, item.statusDesc)
|
||||
as.openItemDlg(env, cfg, cfg.title || sbm.dlg.title.updateAssociation);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
as.selectTarget = function (env)
|
||||
{
|
||||
sbm.fn.selectContact({ assocType: env.$frm.item.find('#cbAssocType').val(), fnSuccess: function (item) { as.onSelectTarget(env, item); } });
|
||||
}
|
||||
as.onSelectTarget = function (env, item)
|
||||
{
|
||||
//sbm.debug('onSelectTarget', env, item);
|
||||
let $ctrls = $('.sbm-input,.sbm-textarea,.sbm-select', env.$frm.item);
|
||||
env.$ctrl.targetId.val(item.id);
|
||||
env.$ctrl.target.val(item.name);
|
||||
}
|
||||
as.editTarget = function (env)
|
||||
{
|
||||
let cfg = {
|
||||
id: env.$ctrl.targetId.val(),
|
||||
fnSuccess: function (item) { as.onEditTarget(env, item); }
|
||||
};
|
||||
sbm.fn.editContact(cfg);
|
||||
}
|
||||
as.onEditTarget = function (env, item)
|
||||
{
|
||||
//sbm.debug('onEditTarget', env, item);
|
||||
let $ctrls = $('.sbm-input,.sbm-textarea,.sbm-select', env.$frm.item);
|
||||
env.$ctrl.target.val(item.name);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
as.storeItem = function (env)
|
||||
{
|
||||
@@ -256,6 +258,7 @@
|
||||
{
|
||||
let env = as.env.select;
|
||||
//sbm.debug('listAssociations', env, prm);
|
||||
if (!env.$pnl.items.length) return;
|
||||
env.prmList = prm;
|
||||
let $frm = env.$frm.filter;
|
||||
$frm.find('.FilterOwnerId').val(prm.ownerId);
|
||||
@@ -268,7 +271,7 @@
|
||||
btns[sbm.lbl.close] = function () { delete env.prmSelect; delete env.prmList; $(this).dialog('close'); };
|
||||
$dlg.dialog('option', 'buttons', btns);
|
||||
sbm.openDialog($dlg, 1000, 800);
|
||||
if (env.$pnl.items.length) setTimeout(function () { as.refreshResults(env); }, 250);
|
||||
setTimeout(function () { as.refreshResults(env); }, 250);
|
||||
}
|
||||
|
||||
/* Params: type, search. */
|
||||
@@ -276,6 +279,7 @@
|
||||
{
|
||||
let env = as.env.select;
|
||||
//sbm.debug('selectAssociation', env, prm);
|
||||
if (!env.$pnl.items.length) return;
|
||||
env.prmSelect = prm;
|
||||
let $frm = env.$frm.filter;
|
||||
$frm.find('.FilterOwnerId,.FilterTargetId').val('');
|
||||
@@ -289,7 +293,7 @@
|
||||
btns[sbm.lbl.cancel] = function () { delete env.prmSelect; delete env.prmList; $(this).dialog('close'); };
|
||||
$dlg.dialog('option', 'buttons', btns);
|
||||
sbm.openDialog($dlg, 1000, 800);
|
||||
if (env.$pnl.items.length) setTimeout(function () { as.refreshResults(env); }, 250);
|
||||
setTimeout(function () { as.refreshResults(env); }, 250);
|
||||
}
|
||||
as.selectItemRow = function (env, $item, item)
|
||||
{
|
||||
@@ -309,10 +313,9 @@
|
||||
/* Params: type, target{id,name}, fnSuccess. */
|
||||
sbm.fn.createAssociation = function (prm)
|
||||
{
|
||||
sbm.debug('createAssociation', prm);
|
||||
//sbm.debug('createAssociation', prm);
|
||||
let env = as.env.select;
|
||||
env.prmEdit = prm;
|
||||
sbm.debug(env.data.cfgCust);
|
||||
if (prm.type == env.data.cfgCust.type.code)
|
||||
as.createItem(env, env.data.cfgCust, sbm.lbl.createCust, prm.target)
|
||||
else if (prm.type == env.data.cfgSupp.type.code)
|
||||
@@ -320,36 +323,37 @@
|
||||
}
|
||||
as.onItemEdited = function (env, item)
|
||||
{
|
||||
sbm.debug('onItemEdited', env, item);
|
||||
//sbm.debug('onItemEdited', env, item);
|
||||
let fn = (env.prmEdit || {}).fnSuccess;
|
||||
if (fn) fn({ id: item.targetId });
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------
|
||||
as.initContactEnv = function ($pnlItems)
|
||||
as.initEnv = function ($pnlItems)
|
||||
{
|
||||
let env = { mode: { search: 1 }, data: {}, ajax: {}, $pnl: {}, $frm: {}, $ctrl: {}, $dlg: {} };
|
||||
|
||||
env.$pnl.items = $($pnlItems);
|
||||
env.$pnl.header = env.$pnl.items.find('.sbm-panel-header');
|
||||
env.$pnl.bgr = env.$pnl.header.find('.sbm-burger');
|
||||
let $items = env.$pnl.items = $($pnlItems);
|
||||
if (!$items.length) return env;
|
||||
env.$pnl.hdr = $items.find('.sbm-panel-header');
|
||||
env.$pnl.bgr = env.$pnl.hdr.find('.sbm-burger').invisible();
|
||||
env.$pnl.mnu = env.$pnl.bgr.find('ul.sbm-dropdown-menu');
|
||||
env.$pnl.table = env.$pnl.items.find('.sbm-panel-item-table');
|
||||
env.$pnl.table = $items.find('.sbm-panel-item-table');
|
||||
env.$pnl.msgs = env.$pnl.table.find('.sbm-panel-messages');
|
||||
env.$pnl.tmpls = env.$pnl.items.find('.sbm-panel-item-template');
|
||||
|
||||
env.$frm.filter = env.$pnl.items.find('.frmAssociationFilter');
|
||||
env.$pnl.tmpls = $items.find('.sbm-panel-item-template');
|
||||
env.$frm.filter = $items.find('.frmAssociationFilter');
|
||||
env.$frm.filter.on('input', '.FilterSearch', function () { as.refreshResults(env, 250); });
|
||||
env.$ctrl.filterAssocType = env.$frm.filter.find('.sbm-select.FilterAssociationType').on('change', function () { env.$frm.filter.find('.sbm-input.FilterAssociationType').val(env.$frm.filter.find('.sbm-select.FilterAssociationType').val()); as.refreshResults(env, 50); });
|
||||
|
||||
var opt = sbm.dlgOpts();
|
||||
opt.dialogClass += " sbm-Association";
|
||||
env.$dlg.item = $('#dlgAssociation').dialog(opt);
|
||||
env.$frm.itemId = $('#frmAssociationId');
|
||||
env.$frm.item = $('#frmAssociation').on('input', '.sbm-input, .sbm-textarea', function () { sbm.clearControlError(this); }).on('change', '.sbm-select', function () { sbm.clearControlError(this); });
|
||||
env.$frm.item = $('#frmAssociation').off('input').on('input', '.sbm-input, .sbm-textarea', function () { sbm.clearControlError(this); }).off('change').on('change', '.sbm-select', function () { sbm.clearControlError(this); });
|
||||
env.$ctrl.targetId = env.$frm.item.find('.AssocTargetId');
|
||||
env.$ctrl.target = env.$frm.item.find('.AssocTarget');
|
||||
env.$ctrl.targetActions = env.$frm.item.find('.AssocTarget .sbm-control .sbm-action');
|
||||
env.$ctrl.targetActions.filter('.AssocTargetSearch').off('click').on('click', function () { as.selectTarget(env); });
|
||||
env.$ctrl.targetActions.filter('.AssocTargetEdit').off('click').on('click', function () { as.editTarget(env); });
|
||||
|
||||
var opt = sbm.dlgOpts();
|
||||
opt.dialogClass += " sbm-Association";
|
||||
@@ -361,9 +365,9 @@
|
||||
//--------------------------------------------------------------
|
||||
$(function ()
|
||||
{
|
||||
as.env.maint = as.initContactEnv('.sbm-panel.Associations');
|
||||
as.env.maint = as.initEnv('.sbm-panel.Associations');
|
||||
if (as.env.maint.$pnl.items.length) setTimeout(function () { as.refreshResults(as.env.maint); }, 250);
|
||||
as.env.select = as.initContactEnv('#dlgAssociationSelect');
|
||||
as.env.select = as.initEnv('#dlgAssociationSelect');
|
||||
if (as.env.select.$pnl.items.length) setTimeout(function () { as.refreshConfig(as.env.select); }, 250);
|
||||
});
|
||||
|
||||
|
||||
@@ -140,12 +140,15 @@
|
||||
sbm.populateSelectCodeDesc(env.$ctrl.saleTaxCode, env.data.taxCodes.map(function (tax) { return { code: tax.code, desc: tax.caption }; }));
|
||||
env.$ctrl.saleTaxCode.val(env.data.taxCodeDefault);
|
||||
sbm.populateSelectCodeDesc(env.$ctrl.saleUomCat, env.data.uomCats);
|
||||
co.populateSalesUomType(env, env.data.uomTypeDefault);
|
||||
co.populateSaleUomType(env, env.data.uomTypeDefault);
|
||||
}
|
||||
co.openItemDlg = function (env, cfg, title)
|
||||
{
|
||||
let $dlg = env.$dlg.item;
|
||||
let $frm = env.$frm.item;
|
||||
env.$ctrl.saleTaxCode.off('change').on('change', function () { co.onSaleTaxCodeSelected(env); });
|
||||
env.$ctrl.saleUomCat.off('change').on('change', function () { co.onSaleUomCatSelected(env); })
|
||||
env.$ctrl.saleUomTyp.off('change').on('change', function () { co.onSaleUomSelected(env); });
|
||||
sbm.configureItemControls(cfg, $frm);
|
||||
var btns = {};
|
||||
btns[sbm.lbl.ok] = function () { co.storeItem(env); };
|
||||
@@ -155,48 +158,6 @@
|
||||
sbm.openDialog($dlg, 720, 640);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
co.onTaxCodeSelected = function (env, $taxCode)
|
||||
{
|
||||
}
|
||||
co.onSaleTaxCodeSelected = function (env)
|
||||
{
|
||||
co.onTaxCodeSelected(env.$ctrl.saleTaxCode);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
co.onUomCatSelected = function (env, $saleUomCat, $saleUom)
|
||||
{
|
||||
let uomCat = $saleUomCat.val();
|
||||
let uom = $saleUom.val();
|
||||
let uoms = env.data.uoms.filter(function (uom) { return uom.category == uomCat; }).map(function (uom) { return { code: uom.type, desc: uom.caption }; });
|
||||
sbm.populateSelectCodeDesc($saleUom, uoms);
|
||||
$saleUom.val(uom);
|
||||
}
|
||||
co.onSaleUomCatSelected = function (env)
|
||||
{
|
||||
co.onUomCatSelected(env, env.$ctrl.saleUomCat, env.$ctrl.saleUom);
|
||||
}
|
||||
co.populateUomType = function (env, $saleUomCat, $saleUom, type)
|
||||
{
|
||||
//sbm.debug('populateUomType', type);
|
||||
let uom = env.data.uoms.find(function (uom) { return uom.type == type; });
|
||||
if (!uom) return;
|
||||
$saleUomCat.val(uom.category).trigger('change');
|
||||
$saleUom.val(uom.type);
|
||||
}
|
||||
co.populateSalesUomType = function (env, type)
|
||||
{
|
||||
co.populateUomType(env, env.$ctrl.saleUomCat, env.$ctrl.saleUom, type);
|
||||
}
|
||||
co.onUomSelected = function (env, $saleUomCat, $saleUom)
|
||||
{
|
||||
}
|
||||
co.onSaleUomSelected = function (env)
|
||||
{
|
||||
co.onUomSelected(env, env.$ctrl.saleUomCat, env.$ctrl.saleUom);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
co.updateItem = function (env, id)
|
||||
{
|
||||
@@ -219,11 +180,55 @@
|
||||
$ctrls.filter('.CommodityId').val(item.id);
|
||||
$ctrls.filter('.CommodityExists').val(1);
|
||||
sbm.selectOrAdd($ctrls.filter('.CommodityType'), item.typeCode, item.typeDesc);
|
||||
co.populateSalesUomType(env, item.salesUnitType);
|
||||
co.populateSaleUomType(env, item.salesUnitType);
|
||||
$ctrls.filter('.CommoditySalesPackQty').off('blur').on('blur', function () { sbm.formatNumber($(this), cfg.decimals.packQty); }).trigger('blur');
|
||||
sbm.selectOrAdd($ctrls.filter('.CommodityStatus'), item.statusCode, item.field.value.Status);
|
||||
co.openItemDlg(env, cfg, sbm.dlg.title.updateCommodity);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
co.onTaxCodeSelected = function (env, $taxCode)
|
||||
{
|
||||
}
|
||||
co.onSaleTaxCodeSelected = function (env)
|
||||
{
|
||||
co.onTaxCodeSelected(env.$ctrl.saleTaxCode);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
co.onUomCatSelected = function (env, $saleUomCat, $saleUomTyp)
|
||||
{
|
||||
let uomCat = $saleUomCat.val();
|
||||
let uom = $saleUomTyp.val();
|
||||
let uoms = env.data.uoms.filter(function (uom) { return uom.category == uomCat; }).map(function (uom) { return { code: uom.type, desc: uom.caption }; });
|
||||
sbm.populateSelectCodeDesc($saleUomTyp, uoms);
|
||||
$saleUomTyp.val(uom);
|
||||
}
|
||||
co.onSaleUomCatSelected = function (env)
|
||||
{
|
||||
co.onUomCatSelected(env, env.$ctrl.saleUomCat, env.$ctrl.saleUomTyp);
|
||||
}
|
||||
co.populateUomType = function (env, $saleUomCat, $saleUomTyp, type)
|
||||
{
|
||||
//sbm.debug('populateUomType');
|
||||
let uom = env.data.uoms.find(function (uom) { return uom.type == type; });
|
||||
if (!uom) return;
|
||||
$saleUomCat.val(uom.category).trigger('change');
|
||||
co.onUomCatSelected(env, $saleUomCat, $saleUomTyp);
|
||||
$saleUomTyp.val(uom.type);
|
||||
}
|
||||
co.populateSaleUomType = function (env, type)
|
||||
{
|
||||
co.populateUomType(env, env.$ctrl.saleUomCat, env.$ctrl.saleUomTyp, type);
|
||||
}
|
||||
co.onUomSelected = function (env, $saleUomCat, $saleUomTyp)
|
||||
{
|
||||
}
|
||||
co.onSaleUomSelected = function (env)
|
||||
{
|
||||
co.onUomSelected(env, env.$ctrl.saleUomCat, env.$ctrl.saleUomTyp);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
co.storeItem = function (env)
|
||||
{
|
||||
@@ -261,12 +266,13 @@
|
||||
{
|
||||
//sbm.debug('selectCommodity', prm);
|
||||
let env = co.env.select;
|
||||
if (!env.$pnl.items.length) return;
|
||||
env.prmSelect = prm;
|
||||
env.$frm.filter.find('.FilterCommodityType').val('');
|
||||
env.$frm.filter.find('.FilterSearch').val(prm.search || '');
|
||||
env.$pnl.table.find('tbody tr').remove();
|
||||
sbm.openDialog(env.$dlg.select, 1000, 800);
|
||||
if (env.$pnl.items.length) setTimeout(function () { co.refreshResults(env); }, 250);
|
||||
setTimeout(function () { co.refreshResults(env); }, 250);
|
||||
}
|
||||
co.selectItemRow = function (env, $item, item)
|
||||
{
|
||||
@@ -305,24 +311,25 @@
|
||||
let env = { mode: { search: 1 }, data: {}, ajax: {}, $pnl: {}, $frm: {}, $ctrl: {}, $dlg: {} };
|
||||
|
||||
let $items = env.$pnl.items = $($pnlItems);
|
||||
env.$pnl.header = $items.find('.sbm-panel-header');
|
||||
env.$pnl.bgr = env.$pnl.header.find('.sbm-burger');
|
||||
if (!$items.length) return env;
|
||||
env.$pnl.hdr = $items.find('.sbm-panel-header');
|
||||
env.$pnl.bgr = env.$pnl.hdr.find('.sbm-burger').invisible();
|
||||
env.$pnl.mnu = env.$pnl.bgr.find('ul.sbm-dropdown-menu');
|
||||
env.$pnl.table = $items.find('.sbm-panel-item-table');
|
||||
env.$pnl.msgs = env.$pnl.table.find('.sbm-panel-messages');
|
||||
env.$pnl.tmpl = $items.find('.sbm-panel-item-template');
|
||||
|
||||
env.$frm.filter = $items.find('#frmCommodityFilter');
|
||||
env.$frm.filter = $items.find('.frmCommodityFilter');
|
||||
env.$frm.filter.on('input', '.FilterSearch', function () { co.refreshResults(env, 250); }).on('change', '.FilterCommodityType,.FilterStatusCat', function () { co.refreshResults(env, 50); });
|
||||
|
||||
env.$frm.itemId = $items.find('#frmCommodityId');
|
||||
var opt = sbm.dlgOpts();
|
||||
opt.dialogClass += " sbm-Commodity";
|
||||
env.$dlg.item = $items.find('#dlgCommodity').dialog(opt);
|
||||
env.$frm.item = env.$dlg.item.find('#frmCommodity').on('input', '.sbm-input, .sbm-textarea', function () { sbm.clearControlError(this); }).on('change', '.sbm-select', function () { sbm.clearControlError(this); });
|
||||
env.$frm.item.on('blur', '.sbm-input.sbm-format-integer', function () { sbm.formatInteger($(this)); }).on('blur', '.sbm-input.sbm-format-currency', function () { sbm.formatCurrency($(this)); });
|
||||
env.$ctrl.saleTaxCode = env.$frm.item.find('.sbm-select.CommoditySalesTaxCode').on('change', function () { co.onSaleTaxCodeSelected(env); });
|
||||
env.$ctrl.saleUomCat = env.$frm.item.find('.sbm-select.CommoditySalesUnitCategory').on('change', function () { co.onSaleUomCatSelected(env); })
|
||||
env.$ctrl.saleUom = env.$frm.item.find('.sbm-select.CommoditySalesUnitType').on('change', function () { co.onSaleUomSelected(env); });
|
||||
env.$frm.item = env.$dlg.item.find('#frmCommodity').off('input').on('input', '.sbm-input, .sbm-textarea', function () { sbm.clearControlError(this); }).off('change').on('change', '.sbm-select', function () { sbm.clearControlError(this); });
|
||||
env.$frm.item.off('blur').on('blur', '.sbm-input.sbm-format-integer', function () { sbm.formatInteger($(this)); }).off('blur').on('blur', '.sbm-input.sbm-format-currency', function () { sbm.formatCurrency($(this)); });
|
||||
env.$ctrl.saleTaxCode = env.$frm.item.find('.sbm-select.CommoditySalesTaxCode');
|
||||
env.$ctrl.saleUomCat = env.$frm.item.find('.sbm-select.CommoditySalesUnitCategory');
|
||||
env.$ctrl.saleUomTyp = env.$frm.item.find('.sbm-select.CommoditySalesUnitType');
|
||||
|
||||
var opt = sbm.dlgOpts();
|
||||
opt.dialogClass += " sbm-Commodity";
|
||||
|
||||
@@ -17,13 +17,12 @@
|
||||
env.$pnl.table.find('tbody tr').remove();
|
||||
env.$pnl.msgs.hide().empty().append($('<div class="sbm-message">' + sbm.msg.dataQuerying + '</div>')).fadeIn(200);
|
||||
}
|
||||
env.ajax.codeTypes = env.ajax.codeTypes || { url: sbm.url.base + 'Codes/CodeType/Ajax/GetCodeTypes', formSel: env.$frm.filter, callbackFn: function (response) { ct.handleCodeTypes(env, response); } };
|
||||
sbm.doAjaxRequest(env.ajax.codeTypes, delay || 50);
|
||||
sbm.doAjaxRequest(env.ajax.codeTypes = env.ajax.codeTypes || { url: sbm.url.base + 'Codes/CodeType/Ajax/GetCodeTypes', formSel: env.$frm.filter, callbackFn: function (response) { ct.handleCodeTypes(env, response); } }, delay || 50);
|
||||
ct.awaitingRefreshResponse = true;
|
||||
}
|
||||
ct.handleCodeTypes = function (env, response)
|
||||
{
|
||||
//sbm.debug('handleCodeTypes', response);
|
||||
sbm.debug('handleCodeTypes', response);
|
||||
delete ct.awaitingRefreshResponse;
|
||||
let $table = $('table', env.$pnl.table).find('tbody tr').remove().end();
|
||||
env.$pnl.msgs.hide().empty();
|
||||
@@ -41,7 +40,7 @@
|
||||
env.$pnl.bgr.invisible();
|
||||
env.$pnl.mnu.empty();
|
||||
env.$pnl.mnu.append(ct.getFilterMenuOption(env, sbm.lbl.refresh, function () { ct.refreshResults(env); }, 'sbm-refresh'));
|
||||
env.$pnl.mnu.append(ct.getFilterMenuOption(env, sbm.lbl.create, function () { ct.createItem(env); }, 'sbm-add'));
|
||||
env.$pnl.mnu.append(ct.getFilterMenuOption(env, sbm.lbl.populate, function () { ct.populate(env); }, 'sbm-process'));
|
||||
env.$pnl.bgr.toggleVisibility(!!$('.sbm-dropdown-item', env.$pnl.mnu).length);
|
||||
}
|
||||
|
||||
@@ -59,18 +58,21 @@
|
||||
$item.prop('id', ct.getItemId(item));
|
||||
$item.find('.CodeTypeCode').text(item.code);
|
||||
$item.find('.CodeTypeName').text(item.name);
|
||||
$item.find('.CodeTypeCodeLength').text(item.codeLength);
|
||||
$item.find('.CodeTypeCodes').text(item.codeCount);
|
||||
$item.find('.CodeTypeStatusDesc').text(item.statusDesc).removeStatusClasses().addClass('sbm-status-' + item.statusCode.toLowerCase());
|
||||
// Actions.
|
||||
let fnUpd = function () { ct.updateItem(env, $item, item) };
|
||||
var $bgr = $('.sbm-burger', $item).invisible();
|
||||
let $mnu = $('ul.sbm-dropdown-menu', $bgr).empty();
|
||||
if (!item.deleted)
|
||||
{
|
||||
let fnUpd = function () { ct.updateItem(env, $item, item) };
|
||||
$mnu.append(ct.getItemMenuOption(env, sbm.lbl.edit, fnUpd, 'sbm-edit'));
|
||||
$('.CodeTypeName', $item).off('click').on('click', fnUpd).addClass('sbm-action-text');
|
||||
$('.CodeTypeCodes', $item).off('click').on('click', function () { sbm.goToPage('Codes/Code/' + item.code); return false; }).on('dblclick', function () { return false; }).addClass('sbm-action-text');
|
||||
$item.find('.CodeTypeCode,.CodeTypeName').off('click').on('click', fnUpd).addClass('sbm-action-text');
|
||||
$item.off('dblclick').on('dblclick', fnUpd);
|
||||
let fnCodes = function () { sbm.goToPage('Codes/Code/' + item.code); return false; };
|
||||
$('.CodeTypeCodes', $item).off('click').on('click', fnCodes).on('dblclick', function () { return false; }).addClass('sbm-action-text');
|
||||
$mnu.append(ct.getItemMenuOption(env, sbm.lbl.codes, fnCodes, 'sbm-process'));
|
||||
}
|
||||
$bgr.toggleVisibility(!!$('.sbm-dropdown-item', $mnu).length);
|
||||
return $item;
|
||||
@@ -106,9 +108,16 @@
|
||||
return $opt.find('div.sbm-label').text(lbl).end().on('click', fn).addClass(cls);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
ct.populate=function(env)
|
||||
{
|
||||
sbm.doAjaxRequest(env.ajax.populate = env.ajax.populate || { url: sbm.url.base + 'Codes/CodeType/Ajax/Populate', formSel: env.$frm.filter, callbackFn: function (response) { ct.handleCodeTypes(env, response); } });
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
ct.createItem = function (env)
|
||||
{
|
||||
return;
|
||||
ct.clearItem();
|
||||
sbm.populateSelectCodeDesc('#cbCodeTypeStatus', sbm.data.statusesCreate);
|
||||
$('#cbCodeTypeStatus').val(sbm.data.statusCodeDefault).prop('readonly', false);
|
||||
@@ -154,6 +163,7 @@
|
||||
$ctrls.filter('.CodeTypeId').val(item.id);
|
||||
$ctrls.filter('.CodeTypeCode').val(item.code).prop('readonly', true);
|
||||
$ctrls.filter('.CodeTypeName').val(item.name);
|
||||
$ctrls.filter('.CodeTypeCodeLength').val(item.codeLength);
|
||||
$ctrls.filter('.CodeTypeNotes').val(item.notes);
|
||||
$ctrls.filter('.CodeTypeStatus').val(item.statusCode);
|
||||
ct.openCodeTypeDlg(env, sbm.dlg.title.updateItem);
|
||||
@@ -190,13 +200,13 @@
|
||||
{
|
||||
let env = { mode: { search: 1 }, data: {}, ajax: {}, $pnl: {}, $frm: {}, $ctrl: {}, $dlg: {} };
|
||||
let $items = env.$pnl.items = $('.sbm-panel.CodeTypes');
|
||||
env.$pnl.header = $items.find('.sbm-panel-header');
|
||||
env.$pnl.bgr = env.$pnl.header.find('.sbm-burger');
|
||||
//if (!$items.length) return env;
|
||||
env.$pnl.hdr = $items.find('.sbm-panel-header');
|
||||
env.$pnl.bgr = env.$pnl.hdr.find('.sbm-burger').invisible();
|
||||
env.$pnl.mnu = env.$pnl.bgr.find('ul.sbm-dropdown-menu');
|
||||
env.$pnl.table = $items.find('.sbm-panel-item-table');
|
||||
env.$pnl.msgs = env.$pnl.table.find('.sbm-panel-messages');
|
||||
env.$pnl.tmpl = $items.find('.sbm-panel-item-template');
|
||||
|
||||
env.$frm.filter = $items.find('#frmCodeTypeFilter');
|
||||
env.$frm.filter.on('input', '.FilterSearch', function () { ct.refreshResults(env, 250); });
|
||||
|
||||
@@ -205,7 +215,7 @@
|
||||
opt.dialogClass += " sbm-CodeTypes";
|
||||
env.$dlg.item = $items.find('#dlgCodeType').dialog(opt);
|
||||
env.$frm.item = env.$dlg.item.find('#frmCodeType');
|
||||
env.$frm.item.on('input', '.sbm-input, .sbm-textarea', function () { sbm.clearControlError(this); }).on('change', '.sbm-select', function () { sbm.clearControlError(this); });
|
||||
env.$frm.item.off('input').on('input', '.sbm-input, .sbm-textarea', function () { sbm.clearControlError(this); }).off('change').on('change', '.sbm-select', function () { sbm.clearControlError(this); });
|
||||
|
||||
ct.env.maint = env;
|
||||
if (ct.env.maint.$pnl.items.length)
|
||||
|
||||
@@ -127,6 +127,7 @@
|
||||
{
|
||||
let $dlg = env.$dlg.item;
|
||||
let $frm = env.$frm.item;
|
||||
$frm.off('dblclick').on('dblclick', '.sbm-input.CodeCategory', function () { cd.selectCategory(env); }).off('click').on('click', '.sbm-action.CodeCategorySearch', function () { cd.selectCategory(env); });
|
||||
var btns = {};
|
||||
btns[sbm.lbl.ok] = function () { cd.storeItem(env); };
|
||||
btns[sbm.lbl.cancel] = function () { delete env.prmEdit; $(this).dialog('close'); };
|
||||
@@ -212,13 +213,13 @@
|
||||
{
|
||||
let env = { mode: { search: 1 }, data: {}, ajax: {}, $pnl: {}, $frm: {}, $ctrl: {}, $dlg: {} };
|
||||
let $items = env.$pnl.items = $('.sbm-panel.Codes');
|
||||
env.$pnl.header = $items.find('.sbm-panel-header');
|
||||
env.$pnl.bgr = env.$pnl.header.find('.sbm-burger');
|
||||
//if (!$items.length) return env;
|
||||
env.$pnl.hdr = $items.find('.sbm-panel-header');
|
||||
env.$pnl.bgr = env.$pnl.hdr.find('.sbm-burger').invisible();
|
||||
env.$pnl.mnu = env.$pnl.bgr.find('ul.sbm-dropdown-menu');
|
||||
env.$pnl.table = $items.find('.sbm-panel-item-table');
|
||||
env.$pnl.msgs = env.$pnl.table.find('.sbm-panel-messages');
|
||||
env.$pnl.tmpl = $items.find('.sbm-panel-item-template');
|
||||
|
||||
env.$frm.filter = $items.find('#frmCodeFilter');
|
||||
env.$frm.filter.on('input', '.FilterSearch', function () { cd.refreshResults(env, 250); }).on('change', '.FilterCodeTypeCode', function () { cd.refreshResults(env, 250); });
|
||||
|
||||
@@ -228,8 +229,7 @@
|
||||
opt.dialogClass += " sbm-Codes";
|
||||
env.$dlg.item = $items.find('#dlgCode').dialog(opt);
|
||||
env.$frm.item = env.$dlg.item.find('#frmCode');
|
||||
env.$frm.item.on('input', '.sbm-input, .sbm-textarea', function () { sbm.clearControlError(this); }).on('change', '.sbm-select', function () { sbm.clearControlError(this); });
|
||||
env.$frm.item.on('dblclick', '.sbm-input.CodeCategory', function () { cd.selectCategory(env); }).on('click', '.sbm-action.CodeCategorySearch', function () { cd.selectCategory(env); });
|
||||
env.$frm.item.off('input').on('input', '.sbm-input, .sbm-textarea', function () { sbm.clearControlError(this); }).off('change').on('change', '.sbm-select', function () { sbm.clearControlError(this); });
|
||||
|
||||
cd.env.maint = env;
|
||||
if (cd.env.maint.$pnl.items.length)
|
||||
|
||||
@@ -198,7 +198,7 @@
|
||||
}
|
||||
co.onCreateAssociation = function (env, item)
|
||||
{
|
||||
sbm.debug('onCreateAssociation', env, item);
|
||||
//sbm.debug('onCreateAssociation', env, item);
|
||||
let $frm = env.$frm.itemId;
|
||||
$('.ContactId', $frm).val(item.id);
|
||||
sbm.doAjaxRequest(env.ajax.refreshItem = env.ajax.refreshItem || { url: sbm.url.base + 'Contact/Ajax/GetItem', formSel: $frm, callbackFn: function (response) { co.onStoreItem(env, response); } }, 50);
|
||||
@@ -243,17 +243,19 @@
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
/* Params: type, search, fnSuccess. */
|
||||
/* Params: type, assocType, search, fnSuccess. */
|
||||
sbm.fn.selectContact = function (prm)
|
||||
{
|
||||
//sbm.debug('selectContact', prm);
|
||||
let env = co.env.select;
|
||||
if (!env.$pnl.items.length) return;
|
||||
env.prmSelect = prm;
|
||||
env.$frm.filter.find('.FilterContactType').val('');
|
||||
env.$frm.filter.find('.FilterContactType').val(prm.type || '');
|
||||
env.$frm.filter.find('.FilterSearch').val(prm.search || '');
|
||||
env.$frm.filter.find('.FilterAssocTypeExclude').val(prm.assocType || '');
|
||||
env.$pnl.table.find('tbody tr').remove();
|
||||
sbm.openDialog(env.$dlg.select, 1000, 800);
|
||||
if (env.$pnl.items.length) setTimeout(function () { co.refreshResults(env); }, 250);
|
||||
setTimeout(function () { co.refreshResults(env); }, 250);
|
||||
}
|
||||
co.selectItemRow = function (env, $item, item)
|
||||
{
|
||||
@@ -287,25 +289,26 @@
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
co.initContactEnv = function ($pnlItems)
|
||||
co.initEnv = function ($pnlItems)
|
||||
{
|
||||
let env = { mode: { search: 1 }, data: {}, ajax: {}, $pnl: {}, $frm: {}, $ctrl: {}, $dlg: {} };
|
||||
|
||||
env.$pnl.items = $($pnlItems);
|
||||
env.$pnl.header = env.$pnl.items.find('.sbm-panel-header');
|
||||
env.$pnl.bgr = env.$pnl.header.find('.sbm-burger');
|
||||
let $items = env.$pnl.items = $($pnlItems);
|
||||
if (!$items.length) return env;
|
||||
env.$pnl.hdr = $items.find('.sbm-panel-header');
|
||||
env.$pnl.bgr = env.$pnl.hdr.find('.sbm-burger').invisible();
|
||||
env.$pnl.mnu = env.$pnl.bgr.find('ul.sbm-dropdown-menu');
|
||||
env.$pnl.table = env.$pnl.items.find('.sbm-panel-item-table');
|
||||
env.$pnl.table = $items.find('.sbm-panel-item-table');
|
||||
env.$pnl.msgs = env.$pnl.table.find('.sbm-panel-messages');
|
||||
env.$pnl.tmpls = env.$pnl.items.find('.sbm-panel-item-template');
|
||||
|
||||
env.$frm.filter = env.$pnl.items.find('.frmContactFilter');
|
||||
env.$pnl.tmpls = $items.find('.sbm-panel-item-template');
|
||||
env.$frm.filter = $items.find('.frmContactFilter');
|
||||
env.$frm.filter.on('input', '.FilterSearch', function () { co.refreshResults(env, 250); }).on('change', '.FilterContactType', function () { co.refreshResults(env, 50); });
|
||||
|
||||
var opt = sbm.dlgOpts();
|
||||
opt.dialogClass += " sbm-Contact";
|
||||
env.$dlg.item = $('#dlgContact').dialog(opt);
|
||||
env.$frm.itemId = $('#frmContactId');
|
||||
env.$frm.item = $('#frmContact').on('input', '.sbm-input, .sbm-textarea', function () { sbm.clearControlError(this); }).on('change', '.sbm-select', function () { sbm.clearControlError(this); });
|
||||
env.$frm.item = $('#frmContact').off('input').on('input', '.sbm-input, .sbm-textarea', function () { sbm.clearControlError(this); }).off('change').on('change', '.sbm-select', function () { sbm.clearControlError(this); });
|
||||
|
||||
var opt = sbm.dlgOpts();
|
||||
opt.dialogClass += " sbm-Contact";
|
||||
@@ -319,9 +322,9 @@
|
||||
//--------------------------------------------------------------
|
||||
$(function ()
|
||||
{
|
||||
co.env.maint = co.initContactEnv('.sbm-panel.Contacts');
|
||||
co.env.maint = co.initEnv('.sbm-panel.Contacts');
|
||||
if (co.env.maint.$pnl.items.length) setTimeout(function () { co.refreshResults(co.env.maint); }, 250);
|
||||
co.env.select = co.initContactEnv('#dlgContactSelect');
|
||||
co.env.select = co.initEnv('#dlgContactSelect');
|
||||
co.env.select.$frm.filter.find('.FilterContactType option[value="GRP"]').remove();
|
||||
if (co.env.select.$pnl.items.length) setTimeout(function () { co.refreshConfig(co.env.select); }, 250);
|
||||
});
|
||||
|
||||
@@ -114,7 +114,7 @@
|
||||
{
|
||||
$sel = $($sel); code = code || 'code'; desc = desc || 'desc';
|
||||
for (const value of values || [])
|
||||
$sel.find($('option[value="'+value[code]+'"]').text(value[desc]));
|
||||
$sel.find($('option[value="' + value[code] + '"]').text(value[desc]));
|
||||
}
|
||||
sbm.populateSelectCodeDesc = function ($sel, values)
|
||||
{
|
||||
@@ -184,7 +184,7 @@
|
||||
let $ctrl = $('.sbm-form-control', $frm).show();
|
||||
for (var name in fld.label || {}) { /* ... */ };
|
||||
(fld.hide || []).forEach(function (v, i, a) { $ctrl.filter('.' + fld.prefix + v).hide().find('.sbm-input,.sbm-textarea,.sbm-select,.sbm-checkbox').filter('.sbm-auto-val').prop('disabled', true); });
|
||||
(fld.readonly || []).forEach(function (v, i, a) { $ctrl.filter('.' + fld.prefix + v).find('.sbm-input,.sbm.textarea,.sbm-select,.sbm-checkbox').filter('.sbm-auto-val').prop('readonly', true).prop('disabled', true); });
|
||||
(fld.readonly || []).forEach(function (v, i, a) { $ctrl.filter('.' + fld.prefix + v).find('.sbm-input,.sbm.textarea,.sbm-select,.sbm-checkbox').filter('.sbm-auto-val').prop('readonly', true).filter('.sbm-select,.sbm-checkbox').prop('disabled', true); });
|
||||
}
|
||||
sbm.populateFormValues = function (cfg, $frm, val)
|
||||
{
|
||||
@@ -197,6 +197,11 @@
|
||||
if (sbm.isNumeric($ctrl.val()))
|
||||
$ctrl.val(parseFloat($ctrl.val()).toFixed(0));
|
||||
}
|
||||
sbm.formatNumber = function ($ctrl, decs)
|
||||
{
|
||||
if (sbm.isNumeric($ctrl.val()))
|
||||
$ctrl.val(parseFloat($ctrl.val()).toFixed(Math.max(0, Math.min(4, decs))));
|
||||
}
|
||||
sbm.formatCurrency = function ($ctrl)
|
||||
{
|
||||
if (sbm.isNumeric($ctrl.val()))
|
||||
|
||||
@@ -0,0 +1,358 @@
|
||||
/*
|
||||
* Requirement page scripts.
|
||||
*/
|
||||
|
||||
(function (win, doc, undef)
|
||||
{
|
||||
"use strict";
|
||||
let re = sbm.mdl.Reqnts = { env: {} };
|
||||
|
||||
//--------------------------------------------------------------
|
||||
re.refreshConfig = function (env, delay)
|
||||
{
|
||||
sbm.doAjaxRequest(env.ajax.refreshConfig = env.ajax.refreshConfig || { url: sbm.url.base + 'Requirement/Ajax/Config', formSel: env.$frm.filter, callbackFn: function (response) { re.doRefreshConfig(env, response); } }, delay || 50);
|
||||
}
|
||||
re.doRefreshConfig = function (env, response)
|
||||
{
|
||||
Object.assign(env.data, response.data);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
re.refreshResults = function (env, delay)
|
||||
{
|
||||
if (!re.awaitingRefreshResponse)
|
||||
{
|
||||
env.$pnl.bgr.invisible();
|
||||
env.$pnl.table.find('tbody tr').remove();
|
||||
env.$pnl.msgs.hide().empty().append($('<div class="sbm-message">' + sbm.msg.dataQuerying + '</div>')).fadeIn(200);
|
||||
}
|
||||
env.ajax.refreshResults = env.ajax.refreshResults || { url: sbm.url.base + 'Requirement/Ajax/List', formSel: env.$frm.filter, callbackFn: function (response) { re.doRefreshResults(env, response); } };
|
||||
sbm.doAjaxRequest(env.ajax.refreshResults, delay || 50);
|
||||
re.awaitingRefreshResponse = true;
|
||||
}
|
||||
re.doRefreshResults = function (env, response)
|
||||
{
|
||||
//sbm.debug('doRefreshResults', env, response);
|
||||
delete re.awaitingRefreshResponse;
|
||||
env.$pnl.msgs.hide().empty();
|
||||
let $table = $('table', env.$pnl.table).find('tbody tr').remove().end();
|
||||
sbm.refreshPaging(response, env.$frm.filter, function () { re.refreshResults(env); });
|
||||
if (!response.success) return;
|
||||
re.doRefreshConfig(env, response);
|
||||
env.mode = response.mode;
|
||||
|
||||
// Menu.
|
||||
if (env.$pnl.bgr.length)
|
||||
{
|
||||
env.$pnl.bgr.invisible();
|
||||
env.$pnl.mnu.empty();
|
||||
env.$pnl.mnu.append(re.getFilterMenuOption(env, sbm.lbl.refresh, function () { re.refreshResults(env); }, 'sbm-refresh'));
|
||||
if (env.data.cfgList.action.allow.create) env.$pnl.mnu.append(re.getFilterMenuOption(env, sbm.lbl.create, function () { re.createItem(env, env.data.cfgItemNew); }, 'sbm-add'));
|
||||
env.$pnl.bgr.toggleVisibility(!!$('.sbm-dropdown-item', env.$pnl.mnu).length);
|
||||
}
|
||||
|
||||
// Items.
|
||||
var items = response.requirements || [];
|
||||
if (!items.length)
|
||||
return env.$pnl.msgs.append($('<div class="sbm-message">' + sbm.msg.dataNoneFound + '</div>')).fadeIn(500);
|
||||
for (const item of items)
|
||||
$table.append(re.populateItem(env, re.getItemTemplate(env), item));
|
||||
sbm.configureItemTable(env.data.cfgList, $table);
|
||||
}
|
||||
re.populateItem = function (env, $item, item)
|
||||
{
|
||||
if (!item) return $item;
|
||||
$item.prop('id', re.getItemId(item));
|
||||
let cfg = env.data.cfgList;
|
||||
if (cfg) sbm.populateItemValues(cfg, $item, item.field.value);
|
||||
let prefix = cfg.column.prefix;
|
||||
$('.' + prefix + 'Status', $item).text(item.statusDesc).removeStatusClasses().addClass('sbm-status-' + item.statusCode.toLowerCase());
|
||||
if (!env.mode.search)
|
||||
{
|
||||
// Actions.
|
||||
var $bgr = $('.sbm-burger', $item).hide();
|
||||
let $mnu = $('ul.sbm-dropdown-menu', $bgr).empty();
|
||||
if (!item.deleted)
|
||||
{
|
||||
let fnUpd = function () { re.updateItem(env, item.id) };
|
||||
$mnu.append(re.getItemMenuOption(env, sbm.lbl.edit, fnUpd, 'sbm-edit'));
|
||||
$('.RequirementCode,.RequirementDesc', $item).off('click').on('click', fnUpd).addClass('sbm-action-text');
|
||||
$item.off('dblclick').on('dblclick', fnUpd);
|
||||
}
|
||||
$bgr.toggle(!!$('.sbm-dropdown-item', $mnu).length);
|
||||
}
|
||||
else
|
||||
{
|
||||
$item.off('click').on('click', function () { re.selectItemRow(env, $item, item); });
|
||||
$item.off('dblclick').on('dblclick', function () { re.selectItem(env); });
|
||||
}
|
||||
return $item;
|
||||
}
|
||||
re.getItemId = function (item)
|
||||
{
|
||||
return 'Cmd_' + (item || {}).id;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
re.getFilterDropdownTemplate = function (env)
|
||||
{
|
||||
return $('.sbm-dropdown-menu.RequirementList li.sbm-dropdown-item', env.$pnl.tmpl).clone();
|
||||
}
|
||||
re.getItemTemplate = function (env)
|
||||
{
|
||||
return $('table tr.sbm-row-item.Requirement', env.$pnl.tmpl).clone();
|
||||
}
|
||||
re.getItemDropdownTemplate = function (env)
|
||||
{
|
||||
return $('.sbm-dropdown-menu.Requirement li.sbm-dropdown-item', env.$pnl.tmpl).clone();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
re.getFilterMenuOption = function (env, lbl, fn, cls)
|
||||
{
|
||||
return re.getMenuOption(re.getFilterDropdownTemplate(env), lbl, fn, cls);
|
||||
}
|
||||
re.getItemMenuOption = function (env, lbl, fn, cls)
|
||||
{
|
||||
return re.getMenuOption(re.getItemDropdownTemplate(env), lbl, fn, cls);
|
||||
}
|
||||
re.getMenuOption = function ($opt, lbl, fn, cls)
|
||||
{
|
||||
return $opt.find('div.sbm-label').text(lbl).end().on('click', fn).addClass(cls);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
re.createItem = function (env, cfg)
|
||||
{
|
||||
re.clearItem(env, cfg);
|
||||
let $frm = env.$frm.item;
|
||||
$frm.find('.RequirementType').val(env.data.requirementTypeDefault);
|
||||
$frm.find('.RequirementStatus').val(env.data.defaultStatusCode);
|
||||
re.openItemDlg(env, cfg, sbm.dlg.title.createRequirement);
|
||||
}
|
||||
re.clearItem = function (env, cfg)
|
||||
{
|
||||
sbm.clearItemForm(env.$frm.item);
|
||||
sbm.populateSelectCodeDesc('#cbRequirementStatus', env.data.statuses);
|
||||
sbm.populateSelectCodeDesc(env.$ctrl.saleTaxCode, env.data.taxCodes.map(function (tax) { return { code: tax.code, desc: tax.caption }; }));
|
||||
env.$ctrl.saleTaxCode.val(env.data.taxCodeDefault);
|
||||
sbm.populateSelectCodeDesc(env.$ctrl.uomCat, env.data.uomCats);
|
||||
re.populateUomType(env, env.data.uomTypeDefault);
|
||||
}
|
||||
re.openItemDlg = function (env, cfg, title)
|
||||
{
|
||||
let $dlg = env.$dlg.item;
|
||||
let $frm = env.$frm.item;
|
||||
env.$ctrl.saleTaxCode.off('change').on('change', function () { re.onTaxCodeSelected(env); });
|
||||
env.$ctrl.uomCat.off('change').on('change', function () { re.onUomCatSelected(env); })
|
||||
env.$ctrl.uomTyp.off('change').on('change', function () { re.onUomSelected(env); });
|
||||
sbm.configureItemControls(cfg, $frm);
|
||||
var btns = {};
|
||||
btns[sbm.lbl.ok] = function () { re.storeItem(env); };
|
||||
btns[sbm.lbl.cancel] = function () { delete env.prmEdit; $(this).dialog('close'); };
|
||||
$dlg.dialog('option', 'buttons', btns);
|
||||
if (title) $dlg.dialog('option', 'title', title);
|
||||
sbm.openDialog($dlg, 720, 640);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
re.updateItem = function (env, id)
|
||||
{
|
||||
let $frm = env.$frm.itemId;
|
||||
$('.RequirementId', $frm).val(id);
|
||||
$('.RequirementDataGroups', $frm).val('Sales');
|
||||
env.ajax.updateItem = env.ajax.updateItem || { url: sbm.url.base + 'Requirement/Ajax/GetItem', formSel: $frm, callbackFn: function (response) { re.onUpdateItem(env, response); } };
|
||||
sbm.doAjaxRequest(env.ajax.updateItem, 50);
|
||||
}
|
||||
re.onUpdateItem = function (env, response)
|
||||
{
|
||||
sbm.debug('onUpdateItem', env, response);
|
||||
if (!response.success) return;
|
||||
let cfg = response.config || {};
|
||||
re.clearItem(env, cfg);
|
||||
let item = response.requirement;
|
||||
let $frm = env.$frm.item;
|
||||
sbm.populateFormValues(cfg, $frm, item.field.value);
|
||||
let $ctrls = $frm.find('.sbm-input,.sbm-textarea,.sbm-select');
|
||||
$ctrls.filter('.RequirementId').val(item.id);
|
||||
$ctrls.filter('.RequirementExists').val(1);
|
||||
sbm.selectOrAdd($ctrls.filter('.RequirementType'), item.typeCode, item.typeDesc);
|
||||
re.populateUomType(env, item.unitType);
|
||||
sbm.selectOrAdd($ctrls.filter('.RequirementStatus'), item.statusCode, item.field.value.Status);
|
||||
re.openItemDlg(env, cfg, sbm.dlg.title.updateRequirement);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
re.onTaxCodeSelected = function (env)
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
re.onUomCatSelected = function (env)
|
||||
{
|
||||
//sbm.debug('onUomCatSelected', env);
|
||||
let $uomCat = env.$ctrl.uomCat;
|
||||
let $uomTyp = env.$ctrl.uomTyp;
|
||||
let uomCat = $uomCat.val();
|
||||
let uomTyp = $uomTyp.val();
|
||||
let uoms = env.data.uoms.filter(function (uom) { return uom.category == uomCat; }).map(function (uom) { return { code: uom.type, desc: uom.caption }; });
|
||||
sbm.populateSelectCodeDesc($uomTyp, uoms);
|
||||
$uomTyp.val(uomTyp);
|
||||
}
|
||||
re.populateUomType = function (env, type)
|
||||
{
|
||||
//sbm.debug('populateUomType', type);
|
||||
let $uomCat = env.$ctrl.uomCat;
|
||||
let $uomTyp = env.$ctrl.uomTyp;
|
||||
let uom = env.data.uoms.find(function (uom) { return uom.type == type; });
|
||||
if (!uom) return;
|
||||
$uomCat.val(uom.category).trigger('change');
|
||||
$uomTyp.val(uom.type);
|
||||
}
|
||||
re.onUomSelected = function (env)
|
||||
{
|
||||
let $uomCat = env.$ctrl.uomCat;
|
||||
let $uomTyp = env.$ctrl.uomTyp;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
re.storeItem = function (env)
|
||||
{
|
||||
env.ajax.storeItem = env.ajax.storeItem || { url: sbm.url.base + 'Requirement/Ajax/StoreItem', formSel: env.$frm.item, callbackFn: function (response) { re.onStoreItem(env, response); } };
|
||||
sbm.doAjaxRequest(env.ajax.storeItem, 50);
|
||||
}
|
||||
re.onStoreItem = function (env, response)
|
||||
{
|
||||
//sbm.debug('onStoreItem', env, response);
|
||||
sbm.refreshControlValues(response.controlValues);
|
||||
if (!response.success) return;
|
||||
env.$dlg.item.dialog('close');
|
||||
var item = response.requirement;
|
||||
if (env.prmEdit)
|
||||
{
|
||||
re.onItemEdited(env, item);
|
||||
}
|
||||
else if (env.$pnl.table.length)
|
||||
{
|
||||
env.$pnl.msgs.hide().empty();
|
||||
var $item = $('#' + re.getItemId(item), env.$pnl.table);
|
||||
if (!$item.length)
|
||||
{
|
||||
$item = re.getItemTemplate(env);
|
||||
$('table tbody', env.$pnl.table).prepend($item).show();
|
||||
}
|
||||
re.populateItem(env, $item, item);
|
||||
sbm.configureItemTable(env.data.cfgList, env.$pnl.table);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sbm.fn.maintainRequirements = function (prm)
|
||||
{
|
||||
let env = re.env.select;
|
||||
env.prmList = prm;
|
||||
prm.mode = 'Maintain';
|
||||
re.showRequirements(env, prm);
|
||||
}
|
||||
sbm.fn.selectRequirement = function (prm)
|
||||
{
|
||||
let env = re.env.select;
|
||||
env.prmSelect = prm;
|
||||
prm.mode = 'Search';
|
||||
re.showRequirements(env, prm);
|
||||
}
|
||||
/* Params: transId, search, fnSuccess. */
|
||||
re.showRequirements = function (env, prm)
|
||||
{
|
||||
//sbm.debug('showRequirements', env, prm, env.$frm.filter.find('.FilterMode'));
|
||||
if (!env.$pnl.items.length) return;
|
||||
env.$frm.filter.find('.FilterMode').val(prm.mode || null);
|
||||
env.$frm.filter.find('.FilterTransactionId').val(prm.transId);
|
||||
env.$frm.filter.find('.FilterSearch').val(prm.search || '');
|
||||
env.$pnl.table.find('tbody tr').remove();
|
||||
sbm.openDialog(env.$dlg.select, 1160, 800);
|
||||
setTimeout(function () { re.refreshResults(env); }, 250);
|
||||
}
|
||||
re.selectItemRow = function (env, $item, item)
|
||||
{
|
||||
//sbm.debug('selectItemRow', env, $item, item);
|
||||
env.$pnl.table.find('tr').removeClass('sbm-sel');
|
||||
$item.addClass('sbm-sel');
|
||||
env.prmSelect.item = item;
|
||||
}
|
||||
re.selectItem = function (env)
|
||||
{
|
||||
//sbm.debug('selectItem', env, env.prmSelect.item);
|
||||
env.$dlg.select.dialog('close');
|
||||
env.prmSelect.fnSuccess(env.prmSelect.item);
|
||||
delete env.prmSelect;
|
||||
}
|
||||
|
||||
/* Params: id, fnSuccess. */
|
||||
sbm.fn.editRequirement = function (prm)
|
||||
{
|
||||
//sbm.debug('editRequirement', prm);
|
||||
let env = re.env.select;
|
||||
env.prmEdit = prm;
|
||||
re.updateItem(env, prm.id);
|
||||
}
|
||||
re.onItemEdited = function (env, item)
|
||||
{
|
||||
//sbm.debug('re.onItemEdited', env, item);
|
||||
env.prmEdit.fnSuccess(item);
|
||||
delete env.prmEdit;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
re.initEnv = function ($pnlItems)
|
||||
{
|
||||
let env = { mode: { search: 1 }, data: {}, ajax: {}, $pnl: {}, $frm: {}, $ctrl: {}, $dlg: {} };
|
||||
|
||||
let $items = env.$pnl.items = $($pnlItems);
|
||||
if (!$items.length) return env;
|
||||
env.$pnl.hdr = $items.find('.sbm-panel-header');
|
||||
env.$pnl.bgr = env.$pnl.hdr.find('.sbm-burger').invisible();
|
||||
env.$pnl.mnu = env.$pnl.bgr.find('ul.sbm-dropdown-menu');
|
||||
env.$pnl.table = $items.find('.sbm-panel-item-table');
|
||||
env.$pnl.msgs = env.$pnl.table.find('.sbm-panel-messages');
|
||||
env.$pnl.tmpl = $items.find('.sbm-panel-item-template');
|
||||
env.$frm.filter = $items.find('.frmRequirementFilter');
|
||||
env.$frm.filter.on('input', '.FilterSearch', function () { re.refreshResults(env, 250); }).on('change', '.FilterRequirementType,.FilterStatusCat', function () { re.refreshResults(env, 50); });
|
||||
|
||||
env.$frm.itemId = $('#frmRequirementId');
|
||||
var opt = sbm.dlgOpts();
|
||||
opt.dialogClass += " sbm-Requirement";
|
||||
env.$dlg.item = $('#dlgRequirement').dialog(opt);
|
||||
env.$frm.item = env.$dlg.item.find('#frmRequirement').off('input').on('input', '.sbm-input, .sbm-textarea', function () { sbm.clearControlError(this); }).off('change').on('change', '.sbm-select', function () { sbm.clearControlError(this); });
|
||||
env.$frm.item.off('blur').on('blur', '.sbm-input.sbm-format-integer', function () { sbm.formatInteger($(this)); }).off('blur').on('blur', '.sbm-input.sbm-format-currency', function () { sbm.formatCurrency($(this)); });
|
||||
sbm.initCalendars(env.$frm.item.find('.sbm-input.sbm-calendar'), {});
|
||||
env.$ctrl.saleTaxCode = env.$frm.item.find('.sbm-select.ReqntTaxCode');
|
||||
env.$ctrl.uomCat = env.$frm.item.find('.sbm-select.ReqntUnitCategory');
|
||||
env.$ctrl.uomTyp = env.$frm.item.find('.sbm-select.ReqntUnitType');
|
||||
|
||||
var opt = sbm.dlgOpts();
|
||||
opt.dialogClass += " sbm-Requirement";
|
||||
opt.buttons[sbm.lbl.ok] = function () { re.selectItem(env); };
|
||||
opt.buttons[sbm.lbl.cancel] = function () { delete env.prmSelect; $(this).dialog('close'); };
|
||||
env.$dlg.select = $('#dlgRequirementSelect').dialog(opt);
|
||||
|
||||
return env;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
$(function ()
|
||||
{
|
||||
re.env.maint = re.initEnv('.sbm-panel.Requirements');
|
||||
if (re.env.maint.$pnl.items.length)
|
||||
{
|
||||
$('body').on('keydown', function (e) { let env = re.env.maint; if (e.which == 45/*Insert*/ && env.data.cfgList.action.allow.create) re.createItem(env, env.data.cfgItemNew); });
|
||||
setTimeout(function () { re.refreshResults(re.env.maint); }, 250);
|
||||
}
|
||||
re.env.select = re.initEnv('#dlgRequirementSelect');
|
||||
if (re.env.select.$pnl.items.length) setTimeout(function () { re.refreshConfig(re.env.select); }, 250);
|
||||
});
|
||||
|
||||
//--------------------------------------------------------------
|
||||
}(window, window.document));
|
||||
|
||||
/* The End */
|
||||
@@ -40,7 +40,7 @@
|
||||
tr.storeConfig(env, response);
|
||||
let cfg = env.data.cfgList;
|
||||
env.mode = response.mode;
|
||||
if (cfg.caption) env.$pnl.items.find('.sbm-panel-caption').text(cfg.caption);
|
||||
if (cfg.caption) env.$pnl.hdr.find('.sbm-panel-caption').text(cfg.caption);
|
||||
sbm.refreshSelectCaption(env.$frm.filter.find('.sbm-select.FilterStatusCat'), response.statusCats);
|
||||
|
||||
// Menu.
|
||||
@@ -79,9 +79,12 @@
|
||||
let fnUpd = function () { tr.updateItem(env, item.id) };
|
||||
$mnu.append(tr.getItemMenuOption(env, sbm.lbl.edit, fnUpd, 'sbm-edit'));
|
||||
$item.off('dblclick').on('dblclick', fnUpd).find('.TransactionReference').off('click').on('click', fnUpd).addClass('sbm-action-text');
|
||||
}
|
||||
let fnReqs = function () { tr.showRequirements(env, item); };
|
||||
$mnu.append(tr.getItemMenuOption(env, sbm.lbl.items, fnReqs, 'sbm-process'));
|
||||
$item.find('.TransactionItemCount').off('click').on('click', fnReqs).addClass('sbm-action-text');
|
||||
$bgr.toggle(!!$('.sbm-dropdown-item', $mnu).length);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$item.off('click').on('click', function () { tr.selectItemRow(env, $item, item); });
|
||||
@@ -91,7 +94,7 @@
|
||||
}
|
||||
tr.getItemId = function (item)
|
||||
{
|
||||
return 'Cmd_' + (item || {}).id;
|
||||
return 'Trn_' + (item || {}).id;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
@@ -129,7 +132,8 @@
|
||||
let $frm = env.$frm.item;
|
||||
env.$ctrl.trnType.val(env.$frm.filter.find('.sbm-input.FilterType').val());
|
||||
env.$ctrl.searchTgtAssoc.show();
|
||||
env.$ctrl.trnStatus.val(env.data.defaultStatusCode).trigger('change');
|
||||
env.$ctrl.trnStatus.val(env.data.defaultStatusCode);
|
||||
tr.onChangeStatus(env);
|
||||
env.$ctrl.trnRaised.datepicker('setDate', 'today');
|
||||
tr.openItemDlg(env, cfg, sbm.dlg.title.createTransaction);
|
||||
}
|
||||
@@ -142,6 +146,10 @@
|
||||
{
|
||||
let $dlg = env.$dlg.item;
|
||||
let $frm = env.$frm.item;
|
||||
$frm.find('.TransactionAssociation').off('dblclick').on('dblclick', function () { tr.selectAssocTarget(env); });
|
||||
env.$ctrl.searchTgtAssoc.off('click').on('click', function () { tr.selectAssocTarget(env); });
|
||||
env.$ctrl.trnStatus.off('change').on('change', function () { tr.onChangeStatus(env); });
|
||||
env.$ctrl.clearRequired.off('click').on('click', function () { env.$ctrl.trnRequired.val(''); });
|
||||
sbm.configureItemControls(cfg, $frm);
|
||||
var btns = {};
|
||||
btns[sbm.lbl.ok] = function () { tr.storeItem(env); };
|
||||
@@ -175,7 +183,7 @@
|
||||
$ctrls.filter('.TransactionAssociationId').val(item.field.value.AssociationId);
|
||||
env.$ctrl.searchTgtAssoc.hide();
|
||||
sbm.selectOrAdd(env.$ctrl.trnStatus, item.statusCode, item.field.value.Status);
|
||||
env.$ctrl.trnStatus.trigger('change');
|
||||
tr.onChangeStatus(env);
|
||||
tr.openItemDlg(env, cfg, sbm.dlg.title.updateTransaction);
|
||||
}
|
||||
|
||||
@@ -234,18 +242,30 @@
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
tr.showRequirements = function (env, item)
|
||||
{
|
||||
//sbm.debug('showRequirements');
|
||||
let fn = function (env, item)
|
||||
{
|
||||
sbm.debug('showRequirementsmaintainRequirementsDone', item);
|
||||
}
|
||||
sbm.fn.maintainRequirements({ transId: item.id, successFn: function (item) { fn(env, item); } });
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
/* Params: type, search, fnSuccess. */
|
||||
sbm.fn.selectTransaction = function (prm)
|
||||
{
|
||||
//sbm.debug('selectTransaction', prm);
|
||||
let env = tr.env.select;
|
||||
if (!env.$pnl.items.length) return;
|
||||
env.prmSelect = prm;
|
||||
env.$frm.filter.find('.FilterType').val('');
|
||||
env.$frm.filter.find('.FilterSearch').val(prm.search || '');
|
||||
env.$pnl.table.find('tbody tr').remove();
|
||||
sbm.openDialog(env.$dlg.select, 1000, 800);
|
||||
if (env.$pnl.items.length) setTimeout(function () { tr.refreshItems(env); }, 250);
|
||||
setTimeout(function () { tr.refreshItems(env); }, 250);
|
||||
}
|
||||
tr.selectItemRow = function (env, $item, item)
|
||||
{
|
||||
@@ -284,34 +304,32 @@
|
||||
let env = { mode: { search: 1 }, data: {}, ajax: {}, $pnl: {}, $frm: {}, $ctrl: {}, $dlg: {} };
|
||||
|
||||
let $items = env.$pnl.items = $($pnlItems);
|
||||
env.$pnl.header = $items.find('.sbm-panel-header');
|
||||
env.$pnl.bgr = env.$pnl.header.find('.sbm-burger');
|
||||
if (!$items.length) return env;
|
||||
env.$pnl.hdr = $items.find('.sbm-panel-header');
|
||||
env.$pnl.bgr = env.$pnl.hdr.find('.sbm-burger').invisible();
|
||||
env.$pnl.mnu = env.$pnl.bgr.find('ul.sbm-dropdown-menu');
|
||||
env.$pnl.table = $items.find('.sbm-panel-item-table');
|
||||
env.$pnl.msgs = env.$pnl.table.find('.sbm-panel-messages');
|
||||
env.$pnl.tmpl = $items.find('.sbm-panel-item-template');
|
||||
|
||||
env.$frm.filter = $items.find('.frmTransactionFilter');
|
||||
if (env.$frm.filter.length)
|
||||
env.$frm.filter.on('input', '.FilterSearch', function () { tr.refreshItems(env, 250); }).on('change', '.sbm-select.FilterType,.sbm-select.FilterStatusCat', function () { tr.refreshItems(env, 50); });
|
||||
|
||||
env.$frm.itemId = $items.find('#frmTransactionId');
|
||||
var opt = sbm.dlgOpts();
|
||||
opt.dialogClass += " sbm-Transaction";
|
||||
env.$dlg.item = $items.find('#dlgTransaction').dialog(opt);
|
||||
env.$frm.item = env.$dlg.item.find('#frmTransaction').on('input', '.sbm-input, .sbm-textarea', function () { sbm.clearControlError(this); }).on('change', '.sbm-select', function () { sbm.clearControlError(this); });
|
||||
env.$frm.item = env.$dlg.item.find('#frmTransaction').off('input').on('input', '.sbm-input, .sbm-textarea', function () { sbm.clearControlError(this); }).off('change').on('change', '.sbm-select', function () { sbm.clearControlError(this); });
|
||||
if (env.$frm.item.length)
|
||||
{
|
||||
env.$frm.item.on('blur', '.sbm-input.sbm-format-integer', function () { sbm.formatInteger($(this)); }).on('blur', '.sbm-input.sbm-format-currency', function () { sbm.formatCurrency($(this)); });
|
||||
env.$frm.item.off('blur').on('blur', '.sbm-input.sbm-format-integer', function () { sbm.formatInteger($(this)); }).off('blur').on('blur', '.sbm-input.sbm-format-currency', function () { sbm.formatCurrency($(this)); });
|
||||
env.$ctrl.trnType = env.$frm.item.find('.sbm-input.TransactionType');
|
||||
env.$frm.item.find('.TransactionAssociation').on('dblclick', function () { tr.selectAssocTarget(env); });
|
||||
env.$ctrl.searchTgtAssoc = env.$frm.item.find('.AssociationTargetSearch').on('click', function () { tr.selectAssocTarget(env); });
|
||||
env.$ctrl.searchTgtAssoc = env.$frm.item.find('.AssociationTargetSearch');
|
||||
env.$ctrl.trnStatus = env.$frm.item.find('.sbm-select.TransactionStatus');
|
||||
if (env.$ctrl.trnStatus.length) env.$ctrl.trnStatus.on('change', function () { tr.onChangeStatus(env); });
|
||||
sbm.initCalendars(env.$frm.item.find('.sbm-input.sbm-calendar'), {});
|
||||
env.$ctrl.trnRaised = env.$frm.item.find('.sbm-input.TransactionRaised');
|
||||
env.$ctrl.trnInProgress = env.$frm.item.find('.sbm-input.TransactionInProgress');
|
||||
env.$ctrl.trnRequired = env.$frm.item.find('.sbm-input.TransactionRequired');
|
||||
env.$ctrl.clearRequired = env.$frm.item.find('.ClearTransactionRequired').on('click', function () { env.$ctrl.trnRequired.val(''); });
|
||||
env.$ctrl.clearRequired = env.$frm.item.find('.ClearTransactionRequired');
|
||||
sbm.allowClearCalendar(env.$ctrl.trnRequired);
|
||||
env.$ctrl.trnClosed = env.$frm.item.find('.sbm-input.TransactionClosed');
|
||||
}
|
||||
|
||||
@@ -193,8 +193,7 @@
|
||||
opt.buttons[sbm.lbl.save] = function () { vc.storeItem(); };
|
||||
opt.buttons[sbm.lbl.cancel] = function () { $(this).dialog('close'); };
|
||||
$dlg.item = $('#dlgVehicleClass').dialog(opt);
|
||||
$frm.item = $('#frmVehicleClass');
|
||||
$($frm.item).on('input', '.sbm-input, .sbm-textarea', function () { sbm.clearControlError(this); }).on('change', '.sbm-select', function () { sbm.clearControlError(this); });
|
||||
$frm.item = $('#frmVehicleClass').off('input').on('input', '.sbm-input, .sbm-textarea', function () { sbm.clearControlError(this); }).off('change').on('change', '.sbm-select', function () { sbm.clearControlError(this); });
|
||||
|
||||
setTimeout(vc.refreshResults, 250);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user