Addition of row in Item Details

PHOTO EMBED

Tue Jan 07 2025 14:26:02 GMT+0000 (Coordinated Universal Time)

Saved by @Pooja

i = 0;
for each  rec_sn in input.Item_Details
{
	i = i + 1;
	row.S_No=i;
}
//item details part no should be loaded from customer pricing master based on customer selected as per user requirement-7/3/2023,if not in master then load asusal
clear row.Part_No;
clear row.Part_Description;
if(input.Sales_Type != "Tooling" && input.Sales_Type != "Research & Development Charges")
{
	getcust = Customer_Pricing_Master[Customer_Name == input.Customer_Name && Status == "Active"];
	if(getcust.count() > 0)
	{
		//Remove the Part No available in Regular Item master for contract- User Requirement - MR.Senthil - 14/03/2024 - will open after production 
		//if input.Sales_Type == "Contract"
		//{
		//regularitem = Regular_Item_Master[ID != 0].Part_No.getAll();
		//get_active = Customer_Pricing_subform[Customer_Pricing_Master_Recid == getcust.ID && sf_Status == "Active" && Part_No != regularitem].Part_No.getAll();
		//}
		//else 
		//  {
		get_active = Customer_Pricing_subform[Customer_Pricing_Master_Recid == getcust.ID && sf_Status == "Active"].Part_No.getAll();
		//   }
		//info get_active;
		row.Part_No:ui.add(get_active);
		//To restrict choosing same items
		clear row.Part_Description;
		//Remove the Part No available in Regular Item master for contract- User Requirement - MR.Senthil - 14/03/2024 - will open after production 
		//if input.Sales_Type == "Contract"
		//{
		//regularitem = Regular_Item_Master[ID != 0].Part_No.getAll();
		//get_active = Customer_Pricing_subform[Customer_Pricing_Master_Recid == getcust.ID && sf_Status == "Active" && Part_No != regularitem].Part_No.getAll();
		//}
		//else 
		//  {
		prdcts = Customer_Pricing_subform[ID == getcust.ID && sf_Status == "Active"].Part_No.getAll();
		//	}
		addproduct = List();
		addproduct.addAll(prdcts);
		remproduct = List();
		for each  prd in input.Item_Details
		{
			if(prd.Part_No != 0)
			{
				toadd = Materials[ID == prd.Part_Description].ID;
				remproduct.add(toadd);
			}
		}
		addproduct.removeAll(remproduct);
		row.Part_Description:ui.add(addproduct);
		clear row.Part_No;
		//Remove the Part No available in Regular Item master for contract- User Requirement - MR.Senthil - 14/03/2024 - will open after production 
		//if input.Sales_Type == "Contract"
		//{
		//regularitem = Regular_Item_Master[ID != 0].Part_No.getAll();
		//get_active = Customer_Pricing_subform[Customer_Pricing_Master_Recid == getcust.ID && sf_Status == "Active" && Part_No != regularitem].Part_No.getAll();
		//}
		//else 
		//  {
		prdcts = Customer_Pricing_subform[Customer_Pricing_Master_Recid == getcust.ID && sf_Status == "Active"].Part_No.getAll();
		//}
		addproduct = List();
		addproduct.addAll(prdcts);
		remproduct = List();
		for each  prd in input.Item_Details
		{
			if(prd.Part_No != 0)
			{
				toadd = Materials[ID == prd.Part_No].ID;
				remproduct.add(toadd);
			}
		}
		addproduct.removeAll(remproduct);
		row.Part_No:ui.add(addproduct);
	}
}
else
{
	//New Sale type Research & Development Charges - Mail Dated 29/11/2023 -Parthasarathy
	if(input.Sales_Type == "Tooling")
	{
		prdcts = Materials[Category.Category == "Tooling" && Status == "Active"].ID.getAll();
	}
	else if(input.Sales_Type == "Research & Development Charges")
	{
		prdcts = Materials[Category.Category == "R&D" && Status == "Active"].ID.getAll();
	}
	addproduct = List();
	addproduct.addAll(prdcts);
	remproduct = List();
	for each  prd in input.Item_Details
	{
		if(prd.Part_Description != 0)
		{
			toadd = Materials[ID == prd.Part_Description].ID;
			remproduct.add(toadd);
		}
	}
	addproduct.removeAll(remproduct);
	row.Part_Description:ui.add(addproduct);
	clear row.Part_No;
	if(input.Sales_Type == "Tooling")
	{
		prdcts = Materials[Category.Category == "Tooling" && Status == "Active"].ID.getAll();
	}
	else if(input.Sales_Type == "Research & Development Charges")
	{
		prdcts = Materials[Category.Category == "R&D" && Status == "Active"].ID.getAll();
	}
	addproduct = List();
	addproduct.addAll(prdcts);
	remproduct = List();
	for each  prd in input.Item_Details
	{
		if(prd.Part_No != 0)
		{
			toadd = Materials[ID == prd.Part_No].ID;
			remproduct.add(toadd);
		}
	}
	addproduct.removeAll(remproduct);
	row.Part_No:ui.add(addproduct);
}
//below code is blocked as per user request - 01/04/2023
/*if(getcust.count() == 0)
{
	clear row.Part_No;
	clear row.Part_Description;
	prdcts = Materials[ID != 0 && Material_Item_Type.Material_Type == "CWPL Products" && CRM_Sync == "Yes"].ID.getAll();
	addproduct = List();
	addproduct.addAll(prdcts);
	remproduct = List();
	for each  prd in input.Item_Details
	{
		if(prd.Part_Description != 0)
		{
			toadd = Materials[ID == prd.Part_Description].ID;
			remproduct.add(toadd);
		}
	}
	addproduct.removeAll(remproduct);
	row.Part_Description:ui.add(addproduct);
	clear row.Part_No;
	prdcts = Materials[ID != 0 && Material_Item_Type.Material_Type == "CWPL Products" && CRM_Sync == "Yes"].ID.getAll();
	addproduct = List();
	addproduct.addAll(prdcts);
	remproduct = List();
	for each  prd in input.Item_Details
	{
		if(prd.Part_No != 0)
		{
			toadd = Materials[ID == prd.Part_No].ID;
			remproduct.add(toadd);
		}
	}
	addproduct.removeAll(remproduct);
	row.Part_No:ui.add(addproduct);
}*/
content_copyCOPY