diff --git a/cirras-underwriting-api/cirras-underwriting-api-rest-endpoints/src/test/java/ca/bc/gov/mal/cirras/underwriting/api/rest/v1/endpoints/UwContractRolloverInvEndpointTest.java b/cirras-underwriting-api/cirras-underwriting-api-rest-endpoints/src/test/java/ca/bc/gov/mal/cirras/underwriting/api/rest/v1/endpoints/UwContractRolloverInvEndpointTest.java
index 519288b6..67b3111a 100644
--- a/cirras-underwriting-api/cirras-underwriting-api-rest-endpoints/src/test/java/ca/bc/gov/mal/cirras/underwriting/api/rest/v1/endpoints/UwContractRolloverInvEndpointTest.java
+++ b/cirras-underwriting-api/cirras-underwriting-api-rest-endpoints/src/test/java/ca/bc/gov/mal/cirras/underwriting/api/rest/v1/endpoints/UwContractRolloverInvEndpointTest.java
@@ -199,7 +199,7 @@ public void testRolloverGrainInventoryContract() throws CirrasUnderwritingServic
Assert.assertEquals(referrer.getContractId(), invContract.getContractId());
Assert.assertEquals(referrer.getCropYear(), invContract.getCropYear());
Assert.assertEquals(false, invContract.getFertilizerInd());
- Assert.assertEquals(false, invContract.getGrainFromPrevYearInd());
+ Assert.assertNull(invContract.getGrainFromPrevYearInd()); //No default is set anymore
Assert.assertEquals(false, invContract.getHerbicideInd());
Assert.assertEquals(null, invContract.getInventoryContractGuid());
Assert.assertEquals(null, invContract.getOtherChangesComment());
@@ -222,15 +222,20 @@ public void testRolloverGrainInventoryContract() throws CirrasUnderwritingServic
Assert.assertEquals(1, field.getDisplayOrder().intValue());
Assert.assertNotNull(field.getPlantings());
- Assert.assertEquals("More plantings than expected returned", 5, field.getPlantings().size());
+ Assert.assertEquals("More plantings than expected returned", 7, field.getPlantings().size());
for (InventoryField invField: field.getPlantings()) {
Assert.assertFalse("is hidden on printout ind is not false", invField.getIsHiddenOnPrintoutInd());
Integer lastYearCmdtyId = invField.getLastYearCropCommodityId();
+ Integer lastYearVrtyId = invField.getLastYearCropVarietyId();
+
//Check if commodity is oat or canola
- Assert.assertTrue("commodity id ("+lastYearCmdtyId+") not 24, 18, 65, 71 or none", lastYearCmdtyId == null || lastYearCmdtyId.equals(24) || lastYearCmdtyId.equals(18)|| lastYearCmdtyId.equals(65)|| lastYearCmdtyId.equals(71));
+ Assert.assertTrue("commodity id ("+lastYearCmdtyId+") not 24, 18, 65, 71, 1010893 or none", lastYearCmdtyId == null
+ || lastYearCmdtyId.equals(24) || lastYearCmdtyId.equals(18)
+ || lastYearCmdtyId.equals(65)|| lastYearCmdtyId.equals(71)
+ || lastYearCmdtyId.equals(1010893));
Assert.assertNull("Unseeded crop commodity not null", invField.getInventoryUnseeded().getCropCommodityId());
@@ -256,7 +261,7 @@ public void testRolloverGrainInventoryContract() throws CirrasUnderwritingServic
Assert.assertNull(invField.getLastYearCropVarietyId());
Assert.assertEquals("Canola not correct acres", (Double)50.0, invField.getInventoryUnseeded().getAcresToBeSeeded());
Assert.assertTrue("Unseeded Insurable not true", invField.getInventoryUnseeded().getIsUnseededInsurableInd());
- } else if (lastYearCmdtyId.equals(65)) {
+ } else if (lastYearCmdtyId.equals(65) && lastYearVrtyId != null && lastYearVrtyId.equals(119)) {
//Forage - From underseeded Alfalfa
Assert.assertEquals("ALFALFA", invField.getLastYearCropVarietyName());
Assert.assertEquals(119, invField.getLastYearCropVarietyId().intValue());
@@ -270,6 +275,20 @@ public void testRolloverGrainInventoryContract() throws CirrasUnderwritingServic
Assert.assertEquals("SILAGE CORN", invField.getLastYearCropCommodityName());
Assert.assertEquals("SILAGE CORN not correct acres", (Double)34.0, invField.getInventoryUnseeded().getAcresToBeSeeded());
Assert.assertTrue("Unseeded Insurable not true", invField.getInventoryUnseeded().getIsUnseededInsurableInd());
+ } else if (lastYearCmdtyId.equals(65) && lastYearVrtyId != null && lastYearVrtyId.equals(220)) {
+ //Underseeded forage seeded with CLOVER/GRASS
+ Assert.assertEquals("CLOVER/GRASS", invField.getLastYearCropVarietyName());
+ Assert.assertEquals(220, invField.getLastYearCropVarietyId().intValue());
+ Assert.assertEquals("FORAGE", invField.getLastYearCropCommodityName());
+ Assert.assertEquals("FORAGE CLOVER/GRASS not correct acres", (Double)90.0, invField.getInventoryUnseeded().getAcresToBeSeeded());
+ Assert.assertFalse("IsGrainUnseededDefaultInd", invField.getInventoryUnseeded().getIsUnseededInsurableInd());
+ } else if (lastYearCmdtyId.equals(1010893)) {
+ //FORAGE SEED - Brome
+ Assert.assertEquals("FORAGE SEED", invField.getLastYearCropCommodityName());
+ Assert.assertEquals("BROME", invField.getLastYearCropVarietyName());
+ Assert.assertEquals(1010999, invField.getLastYearCropVarietyId().intValue());
+ Assert.assertEquals("FORAGE SEED not correct acres", (Double)28.0, invField.getInventoryUnseeded().getAcresToBeSeeded());
+ Assert.assertFalse("IsGrainUnseededDefaultInd", invField.getInventoryUnseeded().getIsUnseededInsurableInd()); //Expected false because it's a forage commodity
}
}
@@ -337,14 +356,24 @@ public void testRolloverGrainInventoryContract() throws CirrasUnderwritingServic
INSERT INTO cuws.inventory_field(inventory_field_guid, insurance_plan_id, field_id, last_year_crop_commodity_id, crop_year, planting_number, underseeded_crop_variety_id, underseeded_acres, create_user, create_date, update_user, update_date, is_hidden_on_printout_ind)
VALUES ('AbcDeFg12394039485-5', 4, 123456999, null, 2021, 5, 1010863, 34, 'admin', now(), 'admin', now(), 'Y');
-
+
+ INSERT INTO cuws.inventory_field(inventory_field_guid, insurance_plan_id, field_id, last_year_crop_commodity_id, crop_year, planting_number, create_user, create_date, update_user, update_date, is_hidden_on_printout_ind)
+ VALUES ('AbcDeFg12394039485-6', 4, 123456999, null, 2021, 6, 'admin', now(), 'admin', now(), 'Y');
+
+ INSERT INTO cuws.inventory_field(inventory_field_guid, insurance_plan_id, field_id, last_year_crop_commodity_id, crop_year, planting_number, underseeded_crop_variety_id, underseeded_acres, create_user, create_date, update_user, update_date, is_hidden_on_printout_ind)
+ VALUES ('AbcDeFg12394039485-7', 4, 123456999, null, 2021, 7, 220, 50, 'admin', now(), 'admin', now(), 'Y');
+
+ INSERT INTO cuws.inventory_field(inventory_field_guid, insurance_plan_id, field_id, last_year_crop_commodity_id, crop_year, planting_number, underseeded_crop_variety_id, underseeded_acres, create_user, create_date, update_user, update_date, is_hidden_on_printout_ind)
+ VALUES ('AbcDeFg12394039485-8', 4, 123456999, null, 2021, 8, 220, 40, 'admin', now(), 'admin', now(), 'Y');
+
+
--Plantings
INSERT INTO cuws.inventory_seeded_grain (inventory_seeded_grain_guid, inventory_field_guid, crop_commodity_id, crop_variety_id, commodity_type_code, is_quantity_insurable_ind, is_replaced_ind, is_pedigree_ind, seeding_date, seeded_acres, is_spot_loss_insurable_ind, create_user, create_date, update_user, update_date)
VALUES (replace(cast(gen_random_uuid() as text), '-', ''), 'AbcDeFg12394039485-1', 24, 1010570, 'Forage Oat', 'N', 'N', 'N', null, 25, 'N', 'admin', now(), 'admin', now());
INSERT INTO cuws.inventory_seeded_grain (inventory_seeded_grain_guid, inventory_field_guid, crop_commodity_id, crop_variety_id, commodity_type_code, is_quantity_insurable_ind, is_replaced_ind, is_pedigree_ind, seeding_date, seeded_acres, is_spot_loss_insurable_ind, create_user, create_date, update_user, update_date)
VALUES (replace(cast(gen_random_uuid() as text), '-', ''), 'AbcDeFg12394039485-1', 26, 1010603, 'CPSW', 'N', 'Y', 'N', null, 0, 'N', 'admin', now(), 'admin', now());
INSERT INTO cuws.inventory_seeded_grain (inventory_seeded_grain_guid, inventory_field_guid, crop_commodity_id, crop_variety_id, commodity_type_code, is_quantity_insurable_ind, is_replaced_ind, is_pedigree_ind, seeding_date, seeded_acres, is_spot_loss_insurable_ind, create_user, create_date, update_user, update_date)
- VALUES (replace(cast(gen_random_uuid() as text), '-', ''), 'AbcDeFg12394039485-2', 18, 1010471, 'Argentine Canola', 'N', 'N', 'N', null, 40, 'N', 'admin', now(), 'admin', now());
+ VALUES (replace(cast(gen_random_uuid() as text), '-', ''), 'AbcDeFg12394039485-2', 18, 1010940, 'Polish Canola', 'N', 'N', 'N', null, 40, 'N', 'admin', now(), 'admin', now());
INSERT INTO cuws.inventory_seeded_grain (inventory_seeded_grain_guid, inventory_field_guid, crop_commodity_id, crop_variety_id, commodity_type_code, is_quantity_insurable_ind, is_replaced_ind, is_pedigree_ind, seeding_date, seeded_acres, is_spot_loss_insurable_ind, create_user, create_date, update_user, update_date)
VALUES (replace(cast(gen_random_uuid() as text), '-', ''), 'AbcDeFg12394039485-3', null, null, null, 'N', 'N', 'N', null, 30, 'N', 'admin', now(), 'admin', now());
INSERT INTO cuws.inventory_seeded_grain (inventory_seeded_grain_guid, inventory_field_guid, crop_commodity_id, crop_variety_id, commodity_type_code, is_quantity_insurable_ind, is_replaced_ind, is_pedigree_ind, seeding_date, seeded_acres, is_spot_loss_insurable_ind, create_user, create_date, update_user, update_date)
@@ -353,6 +382,15 @@ public void testRolloverGrainInventoryContract() throws CirrasUnderwritingServic
VALUES (replace(cast(gen_random_uuid() as text), '-', ''), 'AbcDeFg12394039485-4', 18, 1010471, 'Argentine Canola', 'N', 'Y', 'N', null, 100, 'N', 'admin', now(), 'admin', now());
INSERT INTO cuws.inventory_seeded_grain (inventory_seeded_grain_guid, inventory_field_guid, crop_commodity_id, crop_variety_id, commodity_type_code, is_quantity_insurable_ind, is_replaced_ind, is_pedigree_ind, seeding_date, seeded_acres, is_spot_loss_insurable_ind, create_user, create_date, update_user, update_date)
VALUES (replace(cast(gen_random_uuid() as text), '-', ''), 'AbcDeFg12394039485-5', 18, null, null, 'N', 'Y', 'N', null, null, 'N', 'admin', now(), 'admin', now());
+ --Variety: BROME Commodity: FORAGE SEED
+ INSERT INTO cuws.inventory_seeded_grain (inventory_seeded_grain_guid, inventory_field_guid, crop_commodity_id, crop_variety_id, commodity_type_code, is_quantity_insurable_ind, is_replaced_ind, is_pedigree_ind, seeding_date, seeded_acres, is_spot_loss_insurable_ind, create_user, create_date, update_user, update_date)
+ VALUES (replace(cast(gen_random_uuid() as text), '-', ''), 'AbcDeFg12394039485-6', 1010893, 1010999, 'Forage Seed', 'N', 'Y', 'N', null, 28, 'N', 'admin', now(), 'admin', now());
+ --Variety: TIMOTHY Commodity: FORAGE SEED -> Underseeded with Clover/Grass
+ INSERT INTO cuws.inventory_seeded_grain (inventory_seeded_grain_guid, inventory_field_guid, crop_commodity_id, crop_variety_id, commodity_type_code, is_quantity_insurable_ind, is_replaced_ind, is_pedigree_ind, seeding_date, seeded_acres, is_spot_loss_insurable_ind, create_user, create_date, update_user, update_date)
+ VALUES (replace(cast(gen_random_uuid() as text), '-', ''), 'AbcDeFg12394039485-7', 1010893, 1010998, 'Forage Seed', 'N', 'Y', 'N', null, 17.5, 'N', 'admin', now(), 'admin', now());
+ --Grain commodity with underseeded Clover/Grass -> Should merge with AbcDeFg12394039485-7
+ INSERT INTO cuws.inventory_seeded_grain (inventory_seeded_grain_guid, inventory_field_guid, crop_commodity_id, crop_variety_id, commodity_type_code, is_quantity_insurable_ind, is_replaced_ind, is_pedigree_ind, seeding_date, seeded_acres, is_spot_loss_insurable_ind, create_user, create_date, update_user, update_date)
+ VALUES (replace(cast(gen_random_uuid() as text), '-', ''), 'AbcDeFg12394039485-8', 18, 1010471, 'Argentine Canola', 'N', 'N', 'N', null, 40, 'N', 'admin', now(), 'admin', now());
*****************
DELETE STATEMENTS
diff --git a/cirras-underwriting-api/cirras-underwriting-persistence/src/main/resources/ca/bc/gov/mal/cirras/underwriting/persistence/v1/dao/mybatis/mapper/InventoryFieldMapper.xml b/cirras-underwriting-api/cirras-underwriting-persistence/src/main/resources/ca/bc/gov/mal/cirras/underwriting/persistence/v1/dao/mybatis/mapper/InventoryFieldMapper.xml
index 2ab06dbf..63f62a23 100644
--- a/cirras-underwriting-api/cirras-underwriting-persistence/src/main/resources/ca/bc/gov/mal/cirras/underwriting/persistence/v1/dao/mybatis/mapper/InventoryFieldMapper.xml
+++ b/cirras-underwriting-api/cirras-underwriting-persistence/src/main/resources/ca/bc/gov/mal/cirras/underwriting/persistence/v1/dao/mybatis/mapper/InventoryFieldMapper.xml
@@ -277,59 +277,109 @@
-- All plantings for this field
- WITH plantings AS (
- SELECT inv.inventory_field_guid,
- inv.field_id,
- inv.is_hidden_on_printout_ind,
- inv.underseeded_crop_variety_id,
- inv.underseeded_acres
- FROM inventory_field inv
- WHERE inv.field_id = #{fieldId}
- AND inv.crop_year = #{cropYear}
- AND inv.insurance_plan_id = #{insurancePlanId}
- )
- -- Only returns records if seeded acres > 0 exists for this field.
- SELECT p.field_id,
- ROW_NUMBER() OVER() AS planting_number,
- CASE WHEN p.underseeded_crop_variety_id IS NULL THEN isg.crop_commodity_id ELSE v.crop_commodity_id END AS last_year_crop_commodity_id,
- CASE WHEN p.underseeded_crop_variety_id IS NULL THEN c.commodity_name ELSE cv.commodity_name END AS last_year_crop_commodity_name,
- p.underseeded_crop_variety_id AS last_year_crop_variety_id,
- v.variety_name AS last_year_crop_variety_name,
- vi.is_grain_unseeded_default_ind,
- CASE WHEN p.underseeded_crop_variety_id IS NULL THEN SUM(isg.seeded_acres) ELSE SUM(p.underseeded_acres) END AS acres_to_be_seeded,
- -- Rollover for is_hidden_on_printout_ind is based on ALL plantings,
- -- not just those with seeded acres > 0. Set to Y if all plantings are Y,
- -- otherwise set to N.
- (SELECT MIN(all_p.is_hidden_on_printout_ind) FROM plantings all_p) AS is_hidden_on_printout_ind
- FROM plantings p
- LEFT JOIN (SELECT isg2.inventory_seeded_grain_guid, isg2.inventory_field_guid, isg2.seeded_acres, isg2.crop_commodity_id
- FROM inventory_seeded_grain isg2
- WHERE isg2.seeded_acres > 0) as isg
- ON isg.inventory_field_guid = p.inventory_field_guid
- LEFT JOIN crop_commodity c ON c.crop_commodity_id = isg.crop_commodity_id
- LEFT JOIN crop_variety v ON v.crop_variety_id = p.underseeded_crop_variety_id
- LEFT JOIN crop_commodity cv ON cv.crop_commodity_id = v.crop_commodity_id
- LEFT JOIN crop_variety_insurability vi ON vi.crop_variety_id = v.crop_variety_id
- WHERE ((isg.seeded_acres > 0 and v.crop_variety_id is null and isg.inventory_seeded_grain_guid is not null) or p.underseeded_crop_variety_id is not null)
- GROUP BY p.field_id, isg.crop_commodity_id, c.commodity_name, p.underseeded_crop_variety_id, v.variety_name, v.crop_commodity_id, cv.commodity_name, vi.is_grain_unseeded_default_ind
- UNION
- -- Only returns if no seeded acres > 0 exists for this field.
- SELECT p.field_id,
- 1 AS planting_number,
- null AS last_year_crop_commodity_id,
- null AS last_year_crop_commodity_name,
- null AS acres_to_be_seeded,
- null AS last_year_crop_variety_id,
- null AS last_year_crop_variety_name,
- null AS is_grain_unseeded_default_ind,
- -- Set to Y if all plantings are Y, otherwise set to N.
- MIN(p.is_hidden_on_printout_ind) AS is_hidden_on_printout_ind
- FROM plantings p
- WHERE NOT EXISTS (SELECT 1
- FROM plantings p2
- JOIN inventory_seeded_grain isg2 ON isg2.inventory_field_guid = p2.inventory_field_guid
- WHERE (isg2.seeded_acres > 0 and p.underseeded_crop_variety_id is null) or p.underseeded_crop_variety_id is not null)
- GROUP BY p.field_id
+ SELECT field_id,
+ ROW_NUMBER() OVER() AS planting_number,--planting_number,
+ last_year_crop_commodity_id,
+ last_year_crop_commodity_name,
+ SUM(acres_to_be_seeded) AS acres_to_be_seeded,
+ last_year_crop_variety_id,
+ last_year_crop_variety_name,
+ is_grain_unseeded_default_ind,
+ is_hidden_on_printout_ind
+ FROM (
+ WITH plantings AS (
+ SELECT inv.inventory_field_guid,
+ inv.field_id,
+ inv.is_hidden_on_printout_ind,
+ inv.underseeded_crop_variety_id,
+ inv.underseeded_acres,
+ v.variety_name AS underseeded_crop_variety_name,
+ cv.crop_commodity_id AS underseeded_crop_commodity_id,
+ cv.commodity_name AS underseeded_crop_commodity_name,
+ cvi.is_grain_unseeded_default_ind AS underseeded_is_grain_unseeded_default_ind
+ FROM inventory_field inv
+ LEFT JOIN crop_variety v ON v.crop_variety_id = inv.underseeded_crop_variety_id
+ LEFT JOIN crop_commodity cv ON cv.crop_commodity_id = v.crop_commodity_id
+ LEFT JOIN crop_variety_insurability cvi ON cvi.crop_variety_id = v.crop_variety_id
+ WHERE inv.field_id = #{fieldId}
+ AND inv.crop_year = #{cropYear}
+ AND inv.insurance_plan_id = #{insurancePlanId}
+ )
+ -- Only returns records if seeded acres > 0 exists for this field.
+ SELECT p.field_id,
+ CASE WHEN p.underseeded_crop_variety_id IS NULL THEN isg.crop_commodity_id ELSE p.underseeded_crop_commodity_id END AS last_year_crop_commodity_id,
+ CASE WHEN p.underseeded_crop_variety_id IS NULL THEN c.commodity_name ELSE p.underseeded_crop_commodity_name END AS last_year_crop_commodity_name,
+ CASE WHEN p.underseeded_crop_variety_id IS NULL THEN
+ --Only set variety if last years crop was forage
+ CASE WHEN c.insurance_plan_id = 5 THEN
+ isg.crop_variety_id
+ ELSE
+ NULL
+ END
+ ELSE p.underseeded_crop_variety_id
+ END AS last_year_crop_variety_id,
+ CASE WHEN p.underseeded_crop_variety_id IS NULL THEN
+ --Only set variety if last years crop was forage
+ CASE WHEN c.insurance_plan_id = 5 THEN
+ v.variety_name
+ ELSE
+ NULL
+ END
+ ELSE p.underseeded_crop_variety_name
+ END AS last_year_crop_variety_name,
+ CASE WHEN p.underseeded_crop_variety_id IS NULL THEN
+ --Only set variety if last years crop was forage
+ CASE WHEN c.insurance_plan_id = 5 THEN
+ vi.is_grain_unseeded_default_ind
+ ELSE
+ NULL
+ END
+ ELSE p.underseeded_is_grain_unseeded_default_ind
+ END AS is_grain_unseeded_default_ind,
+
+ CASE WHEN p.underseeded_crop_variety_id IS NULL THEN SUM(isg.seeded_acres) ELSE SUM(p.underseeded_acres) END AS acres_to_be_seeded,
+ -- Rollover for is_hidden_on_printout_ind is based on ALL plantings,
+ -- not just those with seeded acres > 0. Set to Y if all plantings are Y,
+ -- otherwise set to N.
+ (SELECT MIN(all_p.is_hidden_on_printout_ind) FROM plantings all_p) AS is_hidden_on_printout_ind
+ FROM plantings p
+ LEFT JOIN (SELECT isg2.inventory_seeded_grain_guid, isg2.inventory_field_guid, isg2.seeded_acres, isg2.crop_commodity_id, isg2.crop_variety_id
+ FROM inventory_seeded_grain isg2
+ WHERE isg2.seeded_acres > 0) as isg
+ ON isg.inventory_field_guid = p.inventory_field_guid
+ LEFT JOIN crop_commodity c ON c.crop_commodity_id = isg.crop_commodity_id
+ LEFT JOIN crop_variety v ON v.crop_variety_id = isg.crop_variety_id
+ LEFT JOIN crop_variety_insurability vi ON vi.crop_variety_id = v.crop_variety_id
+ WHERE ((isg.seeded_acres > 0 and p.underseeded_crop_variety_id is null and isg.inventory_seeded_grain_guid is not null) or p.underseeded_crop_variety_id is not null)
+ GROUP BY p.field_id, isg.crop_commodity_id, c.commodity_name
+ , isg.crop_variety_id, v.variety_name, c.insurance_plan_id, vi.is_grain_unseeded_default_ind
+ , p.underseeded_crop_variety_id, p.underseeded_crop_variety_name
+ , p.underseeded_crop_commodity_id, p.underseeded_crop_commodity_name, p.underseeded_is_grain_unseeded_default_ind
+ UNION ALL
+ -- Only returns if no seeded acres > 0 exists for this field.
+ SELECT p.field_id,
+ null AS last_year_crop_commodity_id,
+ null AS last_year_crop_commodity_name,
+ null AS acres_to_be_seeded,
+ null AS last_year_crop_variety_id,
+ null AS last_year_crop_variety_name,
+ null AS is_grain_unseeded_default_ind,
+ -- Set to Y if all plantings are Y, otherwise set to N.
+ MIN(p.is_hidden_on_printout_ind) AS is_hidden_on_printout_ind
+ FROM plantings p
+ WHERE NOT EXISTS (SELECT 1
+ FROM plantings p2
+ JOIN inventory_seeded_grain isg2 ON isg2.inventory_field_guid = p2.inventory_field_guid
+ WHERE (isg2.seeded_acres > 0 and p.underseeded_crop_variety_id is null) or p.underseeded_crop_variety_id is not null)
+ GROUP BY p.field_id
+ ) as rollover_plantings
+ GROUP BY field_id,
+ last_year_crop_commodity_id,
+ last_year_crop_commodity_name,
+ last_year_crop_variety_id,
+ last_year_crop_variety_name,
+ is_grain_unseeded_default_ind,
+ is_hidden_on_printout_ind
ORDER BY planting_number
diff --git a/cirras-underwriting-api/cirras-underwriting-persistence/src/test/java/ca/bc/gov/mal/cirras/underwriting/persistence/v1/dao/InventoryFieldDaoTest.java b/cirras-underwriting-api/cirras-underwriting-persistence/src/test/java/ca/bc/gov/mal/cirras/underwriting/persistence/v1/dao/InventoryFieldDaoTest.java
index bb998177..7a607a6a 100644
--- a/cirras-underwriting-api/cirras-underwriting-persistence/src/test/java/ca/bc/gov/mal/cirras/underwriting/persistence/v1/dao/InventoryFieldDaoTest.java
+++ b/cirras-underwriting-api/cirras-underwriting-persistence/src/test/java/ca/bc/gov/mal/cirras/underwriting/persistence/v1/dao/InventoryFieldDaoTest.java
@@ -316,21 +316,21 @@ public void testRemovePlantingLinkForFieldAndYear() throws Exception {
//INSERT Field
createField(userId);
- String forageInventoryFieldGuid1 = createInventoryField(cropYear1, fieldId2, 5, null, null, null, null, 1, userId);
+ String forageInventoryFieldGuid1 = createInventoryField(cropYear1, fieldId2, 5, false, null, null, null, null, 1, userId);
String inventorySeededForageGuid1 = createSeededForage(forageInventoryFieldGuid1, userId);
- String grainInventoryFieldGuid1 = createInventoryField(cropYear1, fieldId2, 4, 15.5, 1010430, "CHAMPION", inventorySeededForageGuid1, 1, userId);
+ String grainInventoryFieldGuid1 = createInventoryField(cropYear1, fieldId2, 4, false, 15.5, 1010430, "CHAMPION", inventorySeededForageGuid1, 1, userId);
- String forageInventoryFieldGuid2 = createInventoryField(cropYear1, fieldId2, 5, null, null, null, null, 2, userId);
+ String forageInventoryFieldGuid2 = createInventoryField(cropYear1, fieldId2, 5, false, null, null, null, null, 2, userId);
String inventorySeededForageGuid2 = createSeededForage(forageInventoryFieldGuid2, userId);
- String grainInventoryFieldGuid2 = createInventoryField(cropYear1, fieldId2, 4, 15.5, 1010430, "CHAMPION", inventorySeededForageGuid2, 2, userId);
+ String grainInventoryFieldGuid2 = createInventoryField(cropYear1, fieldId2, 4, false, 15.5, 1010430, "CHAMPION", inventorySeededForageGuid2, 2, userId);
- String forageInventoryFieldGuid3 = createInventoryField(cropYear2, fieldId2, 5, null, null, null, null, 2, userId);
+ String forageInventoryFieldGuid3 = createInventoryField(cropYear2, fieldId2, 5, false, null, null, null, null, 2, userId);
String inventorySeededForageGuid3 = createSeededForage(forageInventoryFieldGuid3, userId);
- String grainInventoryFieldGuid3 = createInventoryField(cropYear2, fieldId2, 4, 15.5, 1010430, "CHAMPION", inventorySeededForageGuid3, 1, userId);
+ String grainInventoryFieldGuid3 = createInventoryField(cropYear2, fieldId2, 4, false, 15.5, 1010430, "CHAMPION", inventorySeededForageGuid3, 1, userId);
- String forageInventoryFieldGuid4 = createInventoryField(cropYear3, fieldId2, 5, null, null, null, null, 2, userId);
+ String forageInventoryFieldGuid4 = createInventoryField(cropYear3, fieldId2, 5, false, null, null, null, null, 2, userId);
String inventorySeededForageGuid4 = createSeededForage(forageInventoryFieldGuid4, userId);
- String grainInventoryFieldGuid4 = createInventoryField(cropYear3, fieldId2, 4, 15.5, 1010430, "CHAMPION", inventorySeededForageGuid4, 1, userId);
+ String grainInventoryFieldGuid4 = createInventoryField(cropYear3, fieldId2, 4, false, 15.5, 1010430, "CHAMPION", inventorySeededForageGuid4, 1, userId);
InventoryFieldDao invFieldDao = persistenceSpringConfig.inventoryFieldDao();
@@ -493,61 +493,44 @@ public void testSelectForRolloverGrain() throws Exception {
InventoryFieldDao invFieldDao = persistenceSpringConfig.inventoryFieldDao();
- // INSERT inventory field
- InventoryFieldDto invFieldDto = new InventoryFieldDto();
-
- invFieldDto.setCropYear(cropYear);
- invFieldDto.setFieldId(fieldId2);
- invFieldDto.setInsurancePlanId(insurancePlanId);
- invFieldDto.setLastYearCropCommodityId(20);
- invFieldDto.setLastYearCropCommodityName("FALL RYE");
- invFieldDto.setIsHiddenOnPrintoutInd(true);
- invFieldDto.setUnderseededAcres(14.4);
- invFieldDto.setUnderseededCropVarietyId(119);
- invFieldDto.setUnderseededCropVarietyName("ALFALFA");
- invFieldDto.setPlantingNumber(1);
-
-
- invFieldDao.insert(invFieldDto, userId);
-
- String inventoryFieldGuid1 = invFieldDto.getInventoryFieldGuid();
-
- //Add second record
- InventoryFieldDto invField2Dto = new InventoryFieldDto();
-
- invField2Dto.setCropYear(cropYear);
- invField2Dto.setFieldId(fieldId2);
- invField2Dto.setInsurancePlanId(insurancePlanId);
- invField2Dto.setLastYearCropCommodityId(18);
- invField2Dto.setLastYearCropCommodityName("CANOLA");
- invField2Dto.setIsHiddenOnPrintoutInd(true);
- invField2Dto.setPlantingNumber(2);
- invFieldDao.insert(invField2Dto, userId);
-
- String inventoryFieldGuid2 = invField2Dto.getInventoryFieldGuid();
-
-
- //INSERT
+ //INSERT Inventory field and seeded records
//Add seeded grain to inv field 1
+ String inventoryFieldGuid1 = createInventoryField(cropYear, fieldId2, insurancePlanId, true, 14.4, 119, "ALFALFA", null, 1, userId);
createSeededGrain("Forage Oat", 24, 1010570, inventoryFieldGuid1, false, 0.0, userId); //Oat
- createSeededGrain("CPSW", 26, 1010602, inventoryFieldGuid1, true, 30.0, userId); //Wheat
+ String inventoryFieldGuid2 = createInventoryField(cropYear, fieldId2, insurancePlanId, true, null, null, null, null, 2, userId);
+ createSeededGrain("CPSW", 26, 1010602, inventoryFieldGuid2, true, 30.0, userId); //Wheat
+ String inventoryFieldGuid3 = createInventoryField(cropYear, fieldId2, insurancePlanId, true, null, null, null, null, 3, userId);
+ createSeededGrain("HRSW", 26, 1010617, inventoryFieldGuid3, true, 20.0, userId); //Wheat
+ String inventoryFieldGuid4 = createInventoryField(cropYear, fieldId2, insurancePlanId, true, null, null, null, null, 4, userId);
+ createSeededGrain("Forage Seed", 1010893, 1010999, inventoryFieldGuid4, true, 28.0, userId); //Variety: BROME Commodity: FORAGE SEED (Forage Commodity)
//Add seeded grain to inv field 2
- createSeededGrain(null, null, null, inventoryFieldGuid2, false, 20.0, userId); //No Commodity
- createSeededGrain("Forage Oat", 24, 1010570, inventoryFieldGuid2, true, 15.0, userId); //Oat
- createSeededGrain("Argentine Canola", 18, 1010471, inventoryFieldGuid2, true, 10.0, userId); //Canola
+ String inventoryFieldGuid5 = createInventoryField(cropYear, fieldId2, insurancePlanId, true, null, null, null, null, 5, userId);
+ createSeededGrain(null, null, null, inventoryFieldGuid5, false, 20.0, userId); //No Commodity
+ String inventoryFieldGuid6 = createInventoryField(cropYear, fieldId2, insurancePlanId, true, null, null, null, null, 6, userId);
+ createSeededGrain("Forage Oat", 24, 1010570, inventoryFieldGuid6, true, 15.0, userId); //Oat
+ String inventoryFieldGuid7 = createInventoryField(cropYear, fieldId2, insurancePlanId, true, null, null, null, null, 7, userId);
+ createSeededGrain("Argentine Canola", 18, 1010471, inventoryFieldGuid7, true, 10.0, userId); //Canola
+ String inventoryFieldGuid8 = createInventoryField(cropYear, fieldId2, insurancePlanId, true, 50.0, 220, "CLOVER/GRASS", null, 8, userId);
+ createSeededGrain("Forage Seed", 1010893, 1010998, inventoryFieldGuid8, true, 17.5, userId); //Variety: TIMOTHY Commodity: FORAGE SEED (Forage Commodity)
+ String inventoryFieldGuid9 = createInventoryField(cropYear, fieldId2, insurancePlanId, true, 50.0, 220, "CLOVER/GRASS", null, 9, userId);
+ createSeededGrain("Argentine Canola", 18, 1010471, inventoryFieldGuid9, true, 17.5, userId); //Canola Underseeded
//SELECT For Rollover
List dtos = invFieldDao.selectForRollover(fieldId2, cropYear, insurancePlanId);
Assert.assertNotNull(dtos);
//Expected
- //Four records
+ //Seven records
+ //Alfalfa: 14.4 acres because it's underseeded to Forage Oat
+ //Wheat: 50 acres
+ //FORAGE SEED - Brome: 28 acres
+ //No Commodity: 20 acres
//Oat: 15 acres
//Canola: 10 acres
- //No Commodity: 20 acres
- //Alfalfa: 14.4 acres because it's underseeded
- Assert.assertEquals("total records", 4, dtos.size());
+ //Clover/Grass: 100 acres because Forage Seed - Timothy is underseeded to Clover/Grass
+
+ Assert.assertEquals("total records", 7, dtos.size());
Integer plantingNumber = 0;
for (InventoryFieldDto ifDto : dtos) {
@@ -556,8 +539,12 @@ public void testSelectForRolloverGrain() throws Exception {
Assert.assertEquals(plantingNumber, ifDto.getPlantingNumber());
Assert.assertTrue(ifDto.getIsHiddenOnPrintoutInd());
Integer lastYearCmdtyId = ifDto.getLastYearCropCommodityId();
+ Integer lastYearVrtyId = ifDto.getLastYearCropVarietyId();
//Check if commodity is oat or canola
- Assert.assertTrue("commodity id not 24 or 18 or 65 or none", lastYearCmdtyId == null || lastYearCmdtyId.equals(24) || lastYearCmdtyId.equals(18) || lastYearCmdtyId.equals(65));
+ Assert.assertTrue("commodity id has to be in this list or none", lastYearCmdtyId == null
+ || lastYearCmdtyId.equals(24) || lastYearCmdtyId.equals(18)
+ || lastYearCmdtyId.equals(65) || lastYearCmdtyId.equals(26)
+ || lastYearCmdtyId.equals(1010893));
//Check acres according to commodity
if(lastYearCmdtyId == null) {
//No Commodity
@@ -573,6 +560,13 @@ public void testSelectForRolloverGrain() throws Exception {
Assert.assertNull(ifDto.getLastYearCropVarietyId());
Assert.assertEquals("Oat not correct acres", (Double)15.0, ifDto.getAcresToBeSeeded());
Assert.assertNull("IsGrainUnseededDefaultInd", ifDto.getIsGrainUnseededDefaultInd());
+ } else if (lastYearCmdtyId.equals(26)) {
+ //Wheat
+ Assert.assertEquals("WHEAT", ifDto.getLastYearCropCommodityName());
+ Assert.assertNull(ifDto.getLastYearCropVarietyName());
+ Assert.assertNull(ifDto.getLastYearCropVarietyId());
+ Assert.assertEquals("WHEAT not correct acres", (Double)50.0, ifDto.getAcresToBeSeeded());
+ Assert.assertNull("IsGrainUnseededDefaultInd", ifDto.getIsGrainUnseededDefaultInd());
} else if (lastYearCmdtyId.equals(18)) {
//Canola
Assert.assertEquals("CANOLA", ifDto.getLastYearCropCommodityName());
@@ -580,84 +574,72 @@ public void testSelectForRolloverGrain() throws Exception {
Assert.assertNull(ifDto.getLastYearCropVarietyId());
Assert.assertEquals("Canola not correct acres", (Double)10.0, ifDto.getAcresToBeSeeded());
Assert.assertNull("IsGrainUnseededDefaultInd", ifDto.getIsGrainUnseededDefaultInd());
- } else if (lastYearCmdtyId.equals(65)) {
+ } else if (lastYearCmdtyId.equals(65) && lastYearVrtyId != null && lastYearVrtyId.equals(119)) {
//Forage - From underseeded Alfalfa
Assert.assertEquals("ALFALFA", ifDto.getLastYearCropVarietyName());
Assert.assertEquals(119, ifDto.getLastYearCropVarietyId().intValue());
Assert.assertEquals("FORAGE", ifDto.getLastYearCropCommodityName());
Assert.assertEquals("FORAGE not correct acres", (Double)14.4, ifDto.getAcresToBeSeeded());
Assert.assertFalse("IsGrainUnseededDefaultInd", ifDto.getIsGrainUnseededDefaultInd());
+ } else if (lastYearCmdtyId.equals(65) && lastYearVrtyId != null && lastYearVrtyId.equals(220)) {
+ //Underseeded forage seeded with CLOVER/GRASS
+ Assert.assertEquals("CLOVER/GRASS", ifDto.getLastYearCropVarietyName());
+ Assert.assertEquals(220, ifDto.getLastYearCropVarietyId().intValue());
+ Assert.assertEquals("FORAGE", ifDto.getLastYearCropCommodityName());
+ Assert.assertEquals("FORAGE CLOVER/GRASS not correct acres", (Double)100.0, ifDto.getAcresToBeSeeded());
+ Assert.assertFalse("IsGrainUnseededDefaultInd", ifDto.getIsGrainUnseededDefaultInd());
+ } else if (lastYearCmdtyId.equals(1010893)) {
+ //FORAGE SEED - Brome
+ Assert.assertEquals("FORAGE SEED", ifDto.getLastYearCropCommodityName());
+ Assert.assertEquals("BROME", ifDto.getLastYearCropVarietyName());
+ Assert.assertEquals(1010999, ifDto.getLastYearCropVarietyId().intValue());
+ Assert.assertEquals("FORAGE SEED not correct acres", (Double)28.0, ifDto.getAcresToBeSeeded());
+ Assert.assertFalse("IsGrainUnseededDefaultInd", ifDto.getIsGrainUnseededDefaultInd()); //Expected false because it's a forage commodity
}
}
- //Add third record with no seeded data.
- InventoryFieldDto invField3Dto = new InventoryFieldDto();
-
- invField3Dto.setCropYear(cropYear);
- invField3Dto.setFieldId(fieldId2);
- invField3Dto.setInsurancePlanId(insurancePlanId);
- invField3Dto.setLastYearCropCommodityId(null);
- invField3Dto.setLastYearCropCommodityName(null);
- invField3Dto.setIsHiddenOnPrintoutInd(false); // Because this is false, it will be false for the rolled-over plantings.
- invField3Dto.setPlantingNumber(3);
- invFieldDao.insert(invField3Dto, userId);
-
- String inventoryFieldGuid3 = invField3Dto.getInventoryFieldGuid();
+ //Add another record with no seeded data.
+ String inventoryFieldGuid10 = createInventoryField(cropYear, fieldId2, insurancePlanId, false, null, null, null, null, 10, userId);
//SELECT For Rollover
dtos = invFieldDao.selectForRollover(fieldId2, cropYear, insurancePlanId);
Assert.assertNotNull(dtos);
- //Expected
- //Four records
- //Oat: 15 acres
- //Canola: 10 acres
- //No Commodity: 20 acres
- //Alfalfa: 14.4 acres because it's underseeded
- Assert.assertEquals("total records", 4, dtos.size());
+ //Expected same records as above
+ Assert.assertEquals("total records", 7, dtos.size());
plantingNumber = 0;
for (InventoryFieldDto ifDto : dtos) {
plantingNumber++;
Assert.assertEquals(fieldId2, ifDto.getFieldId());
Assert.assertEquals(plantingNumber, ifDto.getPlantingNumber());
- Assert.assertFalse(ifDto.getIsHiddenOnPrintoutInd()); // Rolled-over as false because of the third planting.
+ Assert.assertFalse(ifDto.getIsHiddenOnPrintoutInd()); // Rolled-over as false because of the eighth planting.
Integer lastYearCmdtyId = ifDto.getLastYearCropCommodityId();
//Check if commodity is oat or canola
- Assert.assertTrue("commodity id not 24 or 18 or 65 or none", lastYearCmdtyId == null || lastYearCmdtyId.equals(24) || lastYearCmdtyId.equals(18) || lastYearCmdtyId.equals(65));
- //Check acres according to commodity
- if(lastYearCmdtyId == null) {
- //No Commodity
- Assert.assertNull(ifDto.getLastYearCropCommodityName());
- Assert.assertEquals("No Commodity not correct acres", (Double)20.0, ifDto.getAcresToBeSeeded());
- } else if (lastYearCmdtyId.equals(24)) {
- //Oat
- Assert.assertEquals("OAT", ifDto.getLastYearCropCommodityName());
- Assert.assertEquals("Oat not correct acres", (Double)15.0, ifDto.getAcresToBeSeeded());
- } else if (lastYearCmdtyId.equals(18)) {
- //Canola
- Assert.assertEquals("CANOLA", ifDto.getLastYearCropCommodityName());
- Assert.assertEquals("Canola not correct acres", (Double)10.0, ifDto.getAcresToBeSeeded());
- } else if (lastYearCmdtyId.equals(65)) {
- //Forage - From underseeded Alfalfa
- Assert.assertEquals("ALFALFA", ifDto.getLastYearCropVarietyName());
- Assert.assertEquals(119, ifDto.getLastYearCropVarietyId().intValue());
- Assert.assertEquals("FORAGE", ifDto.getLastYearCropCommodityName());
- Assert.assertEquals("FORAGE not correct acres", (Double)14.4, ifDto.getAcresToBeSeeded());
- }
+ Assert.assertTrue("commodity id has to be in this list or none", lastYearCmdtyId == null
+ || lastYearCmdtyId.equals(24) || lastYearCmdtyId.equals(18)
+ || lastYearCmdtyId.equals(65) || lastYearCmdtyId.equals(26)
+ || lastYearCmdtyId.equals(1010893));
}
- //Delete all unseeded records for field
+ //Delete all seeded records for field
InventorySeededGrainDao invSeededGrainDao = persistenceSpringConfig.inventorySeededGrainDao();
invSeededGrainDao.deleteForField(fieldId2);
- List seededGrainDtos = invSeededGrainDao.select(inventoryFieldGuid1);
- Assert.assertTrue("seeded records not deleted", seededGrainDtos == null || seededGrainDtos.size() == 0);
+ checkDeletedSeededGrain(inventoryFieldGuid1, invSeededGrainDao);
+ checkDeletedSeededGrain(inventoryFieldGuid2, invSeededGrainDao);
+ checkDeletedSeededGrain(inventoryFieldGuid3, invSeededGrainDao);
+ checkDeletedSeededGrain(inventoryFieldGuid4, invSeededGrainDao);
+ checkDeletedSeededGrain(inventoryFieldGuid5, invSeededGrainDao);
+ checkDeletedSeededGrain(inventoryFieldGuid6, invSeededGrainDao);
+ checkDeletedSeededGrain(inventoryFieldGuid7, invSeededGrainDao);
+ checkDeletedSeededGrain(inventoryFieldGuid8, invSeededGrainDao);
+ checkDeletedSeededGrain(inventoryFieldGuid9, invSeededGrainDao);
//Remove underseeded information
- InventoryFieldDto ifUpdDto = invFieldDao.fetch(inventoryFieldGuid1);
- ifUpdDto.setUnderseededAcres(null);
- ifUpdDto.setUnderseededCropVarietyId(null);
- invFieldDao.update(ifUpdDto, userId);
+ removeUnderseededData(userId, invFieldDao, inventoryFieldGuid1);
+ removeUnderseededData(userId, invFieldDao, inventoryFieldGuid8);
+ removeUnderseededData(userId, invFieldDao, inventoryFieldGuid9);
+
//Rollover when there is no seeded data.
dtos = invFieldDao.selectForRollover(fieldId2, cropYear, insurancePlanId);
@@ -673,10 +655,12 @@ public void testSelectForRolloverGrain() throws Exception {
Assert.assertFalse(ifDto.getIsHiddenOnPrintoutInd()); // Rolled-over as false because of the third planting.
Assert.assertNull(ifDto.getLastYearCropCommodityId());
Assert.assertNull(ifDto.getLastYearCropCommodityName());
+ Assert.assertNull(ifDto.getLastYearCropVarietyId());
+ Assert.assertNull(ifDto.getLastYearCropVarietyName());
Assert.assertNull(ifDto.getAcresToBeSeeded());
- // Delete third planting.
- invFieldDao.delete(inventoryFieldGuid3);
+ // Delete additional planting.
+ invFieldDao.delete(inventoryFieldGuid10);
//Rollover when there is no seeded data.
dtos = invFieldDao.selectForRollover(fieldId2, cropYear, insurancePlanId);
@@ -706,6 +690,20 @@ public void testSelectForRolloverGrain() throws Exception {
FieldDto deletedDto = dao.fetch(fieldId2);
Assert.assertNull(deletedDto);
+ }
+
+ private void removeUnderseededData(String userId, InventoryFieldDao invFieldDao, String inventoryFieldGuid)
+ throws DaoException, NotFoundDaoException {
+ InventoryFieldDto ifUpdDto = invFieldDao.fetch(inventoryFieldGuid);
+ ifUpdDto.setUnderseededAcres(null);
+ ifUpdDto.setUnderseededCropVarietyId(null);
+ invFieldDao.update(ifUpdDto, userId);
+ }
+
+ private void checkDeletedSeededGrain(String inventoryFieldGuid, InventorySeededGrainDao invSeededGrainDao)
+ throws DaoException {
+ List seededGrainDtos = invSeededGrainDao.select(inventoryFieldGuid);
+ Assert.assertTrue("seeded records not deleted", seededGrainDtos == null || seededGrainDtos.size() == 0);
}
@Test
@@ -920,6 +918,7 @@ private String createInventoryField(
Integer cropYear,
Integer fieldId,
Integer insurancePlanId,
+ Boolean isHiddenOnPrintoutInd,
Double underseededAcres,
Integer underseededCropVarietyId,
String underseededCropVarietyName,
@@ -940,7 +939,7 @@ private String createInventoryField(
newDto.setLastYearCropCommodityName(null);
newDto.setLastYearCropVarietyId(null);
newDto.setLastYearCropVarietyName(null);
- newDto.setIsHiddenOnPrintoutInd(false);
+ newDto.setIsHiddenOnPrintoutInd(isHiddenOnPrintoutInd);
newDto.setUnderseededAcres(underseededAcres);
newDto.setUnderseededCropVarietyId(underseededCropVarietyId);
newDto.setUnderseededCropVarietyName(underseededCropVarietyName);
diff --git a/cirras-underwriting-api/cirras-underwriting-service-api/src/main/resources/subreports/CUWS_Inv_Grain_Plantings.jrxml b/cirras-underwriting-api/cirras-underwriting-service-api/src/main/resources/subreports/CUWS_Inv_Grain_Plantings.jrxml
index 9a6482e2..ed8c4395 100644
--- a/cirras-underwriting-api/cirras-underwriting-service-api/src/main/resources/subreports/CUWS_Inv_Grain_Plantings.jrxml
+++ b/cirras-underwriting-api/cirras-underwriting-service-api/src/main/resources/subreports/CUWS_Inv_Grain_Plantings.jrxml
@@ -35,10 +35,10 @@
, INITCAP(COALESCE(cv_lastYear.variety_name, cc_lastYear.commodity_name)) as last_year_commodity_variety_name
-- unseeded
, iu.acres_to_be_seeded
- , INITCAP(cc_unseeded.commodity_name) as unseeded_commodity_name
+ , INITCAP(COALESCE(cv_unseeded.variety_name, cc_unseeded.commodity_name)) as unseeded_commodity_variety_name
, iu.is_unseeded_insurable_ind
-- seeded
- , INITCAP(cc_seeded.commodity_name) as seeded_commodity_name
+ , INITCAP(cc_seeded.commodity_name) as seeded_commodity_name
, INITCAP(cv.variety_name) as seeded_variety_name
, isg.seeded_acres
, isg.seeding_date
@@ -58,6 +58,7 @@ left join crop_variety cv_lastYear on cv_lastYear.crop_variety_id = ifd.last_yea
left join crop_variety cv_underseeded on cv_underseeded.crop_variety_id = ifd.underseeded_crop_variety_id
left join inventory_unseeded iu on iu.inventory_field_guid = ifd.inventory_field_guid
left join crop_commodity cc_unseeded on cc_unseeded.crop_commodity_id = iu.crop_commodity_id
+left join crop_variety cv_unseeded on cv_unseeded.crop_variety_id = iu.crop_variety_id
left join inventory_seeded_grain isg on isg.inventory_field_guid = ifd.inventory_field_guid
left join crop_commodity cc_seeded on cc_seeded.crop_commodity_id = isg.crop_commodity_id
left join crop_variety cv on cv.crop_variety_id = isg.crop_variety_id
@@ -134,9 +135,9 @@ offset $P{p_record_offset}]]>
-
-
-
+
+
+
@@ -792,7 +793,7 @@ offset $P{p_record_offset}]]>
-
+
@@ -851,4 +852,4 @@ $F{underseeded_variety_name}.substring( $F{underseeded_variety_name}.indexOf( "/
-
\ No newline at end of file
+