This commit is contained in:
2021-03-08 00:48:26 +00:00
parent 7fd34f34fb
commit a76b741747

View File

@@ -10,7 +10,66 @@ using Newtonsoft.Json.Linq;
using System.Collections.Generic;
namespace AyaNova.Biz
{
{/*
Contract general notes / changes
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Overview
V7 contracts did this:
Limit rates that can be selected to only those selected in contract and which are set to "Contract rate" in themselves
or just offer those contract rates in addition to regular rates
apply a discount to all parts selected for that contract in effect
V8 contracts need to do this:
Markup OR Discount option (mutually exclusive)
Rates in addition to parts
Tag selectable to apply discount or markup
Can have multiple by tag but can have only one by non tag (all parts, all rates)
wo applies discount / markup if part or rate is tagged if tag is chosen
Keep in mind individual Units will be contractable as well
Special notes field kind of like popup notes but it doesn't popup, instead displays on workorder statically somewhere as a reminder.
perhaps a contract in effect section with a ui affordance to open for more details or perhaps not.
I can imagine the first time people would need to read it but after the thousandth it's just taking up space.
Response time duration control for notification purposes, overrides default response time globally set
if a unit has one and customer has one the shortest one applies as this is an entire workorder issue
User can make seperate workorders to work around this if it's an issue
Contracts are never tied directly to an object they affect other than the Customer or Headoffice with a foreign key link
workorders should never be reliant on the existance of a contract but rather just have a contract applied to them for example
Contracts *are* tied to objects that use them like Client, HeadOffice, Unit
Which contract to apply
In order of least to most specific: Headoffice, Customer, Unit
so Unit contract overrides any above contract
Contract applied field
objects with contract that affects then should seperately have a contract name field for contract applied
this supports not directly linking the contract but rather seeing it as an object that is applied to another object,
not linked to it. Can apply, unapply, delete contract and no affect on primary wo or other object
TAGS
in v7 contracts could be set to apply to all parts or none
in v8 need finer control so:
Contract needs selectable tags for any aspect to apply
Discount / markup etc parts / rates
So, in practice like in v7 you set a discount for all parts but then you can also on the same line restrict it to specific part tags and select tags right there
If any items have tags then there can be no "all Items" item? Or do they contradict each other in some way
i.e. a discount for all but a special discount if it's tagged this (could be zero percent so no change if tagged that way as a way to Exclude certain items)
The server then applies the discount based on whether the parts are tagged or not if that's the case in it's bizactions
then the picklist can be supplied the variant for contract id which pulls the contract, finds the tags and then populates the picklist with the extra tag search
MULTIPLE discount / markup ITEMS
Can have ONE default for all box
Can have multiple tagged ones (tag is REQUIRED)
Not two can have same tags in them, that's a biz rule / error
Algorithm:
Default item applied normally UNLESS tagged item which is more specific overrides it
*/
internal class ContractBiz : BizObject, IJobObject, ISearchAbleObject, IReportAbleObject, IExportAbleObject, INotifiableObject
{
internal ContractBiz(AyContext dbcontext, long currentUserId, long userTranslationId, AuthorizationRoles UserRoles)