Last active
May 29, 2024 20:03
-
-
Save hasokeric/120485a20f49d4e70a01ad18f49408d4 to your computer and use it in GitHub Desktop.
Under Issued Material on CustShip Count
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Count up the UnderIssuedMtls and UnderReportedOprs to show in the ShipDtl grid on Summary Tab | |
foreach (var row in ttShipDtl.Where(x => x.OurJobShipQty > 0).ToList()) | |
{ | |
// Get all the UnderIssuedMtl Count | |
int UnderIssuedMtlCount = (from jp in Db.JobPart | |
join jm in Db.JobMtl on new { jp.Company, jp.JobNum } equals new { jm.Company, jm.JobNum } | |
where jp.Company == row.Company && | |
jp.JobNum == row.JobNum && | |
jp.PartNum == row.PartNum && | |
jm.IssuedComplete == false && | |
jm.RequiredQty != 0 && | |
jm.QtyPer * (jp.ShippedQty + row.SellingShipmentQty) > jm.IssuedQty | |
select jm) | |
.Count(); | |
// Get the UnderReportedOpr Count | |
int UnderReportedOprCount = (from jp in Db.JobPart | |
join jo in Db.JobOper on new { jp.Company, jp.JobNum } equals new { jo.Company, jo.JobNum } | |
where jp.Company == row.Company && | |
jp.JobNum == row.JobNum && | |
jp.PartNum == row.PartNum && | |
jo.OpComplete == false && | |
jo.QtyPer * (jp.ShippedQty + row.SellingShipmentQty) > jo.QtyCompleted | |
select jo) | |
.Count(); | |
// Update the UD fields | |
row.SetUDField("DspJobMtlIssues_c", UnderIssuedMtlCount); | |
row.SetUDField("DspJobOprIssues_c", UnderReportedOprCount); | |
} | |
// Something Else | |
(from sd in Db.ShipDtl | |
join jh in Db.JobHead | |
on new { sd.Company, sd.JobNum } equals new { jh.Company, jh.JobNum } | |
where sd.Company == Session.CompanyID && | |
sd.PackNum == ipPackNum && | |
sd.OurJobShipQty > 0 && | |
jh.JobClosed == true | |
select sd).Any() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment