Skip to content

Instantly share code, notes, and snippets.

@miguelcperez
Created April 19, 2019 02:36
Show Gist options
  • Save miguelcperez/2b2693d49fdde88436a2031b5a16b0a9 to your computer and use it in GitHub Desktop.
Save miguelcperez/2b2693d49fdde88436a2031b5a16b0a9 to your computer and use it in GitHub Desktop.
double tab container logic
// Create FlavorTab by flavor and country (Bottler)
newFlavorTab = new sap.m.TabContainerItem('flavorTab_' + countryItemKey + '_' + flavor.FlavorCode, {
name: flavor.FlavorDescription,
modified: false,
content: [
new sap.m.Table('flavorTable_'+ countryItemKey + '_' + flavor.FlavorCode ,{
columns: [
new sap.m.Column({
header: new sap.m.Label({
text: resourceBundle.getText("Bottler.ColumnTitleDescription")
})
}),
new sap.m.Column({
header: new sap.m.Label({
text: resourceBundle.getText("Bottler.ColumnTitleLocalCurrency")
})
}),
new sap.m.Column({
header: new sap.m.Label({
text: resourceBundle.getText("Bottler.ColumnTitleUSD")
})
})
],
items:[
new sap.m.ColumnListItem({
cells:[
new sap.m.Label({text: resourceBundle.getText("Bottler.ChangeType_CountrySale1")}),
new sap.m.Input( "input_CTCS1" + countryItemKey + '_' + flavor.FlavorCode, { enabled: true, value: "", visible: false }),
new sap.m.Input( "input_CTCS1" + countryItemKey + '_' + flavor.FlavorCode + '_calc',{ type: sap.m.InputType.Text, enabled: CBCCountryFlag, value: "1.5" })
]
}),
new sap.m.ColumnListItem({
cells:[
new sap.m.Label({text: resourceBundle.getText("Bottler.UnitPTC"), required: true}),
new sap.m.Input("input_UPTC"+ countryItemKey + '_' + flavor.FlavorCode,{ type: sap.m.InputType.Text, enabled: true, value: "", liveChange: function(evt){ gfAutocalculateField(country.CountryCode, flavor.FlavorCode); } }),
new sap.m.Input("input_UPTC" + countryItemKey + '_' + flavor.FlavorCode + '_calc',{ type: sap.m.InputType.Text, enabled: false, value: "" })
]
}),
new sap.m.ColumnListItem({
cells:[
new sap.m.Label({text: resourceBundle.getText("Bottler.BoxPTR"), required: true}),
new sap.m.Input("input_BPTR"+ countryItemKey + '_' + flavor.FlavorCode,{ type: sap.m.InputType.Text, enabled: true, value: "", liveChange: function(evt){ gfAutocalculateField(country.CountryCode, flavor.FlavorCode); } }),
new sap.m.Input("input_BPTR" + countryItemKey + '_' + flavor.FlavorCode + '_calc',{ type: sap.m.InputType.Text, enabled: false, value: "" })
]
}),
new sap.m.ColumnListItem({
cells:[
new sap.m.Label({text: resourceBundle.getText("Bottler.BoxNWSP"), required: true, design: "Bold"}),
new sap.m.Input("input_BNWSP"+ countryItemKey + '_' + flavor.FlavorCode,{ type: sap.m.InputType.Text, enabled: true, value: "", liveChange: function(evt){ gfAutocalculateField(country.CountryCode, flavor.FlavorCode); } }),
new sap.m.Input("input_BNWSP" + countryItemKey + '_' + flavor.FlavorCode + '_calc',{ type: sap.m.InputType.Text, enabled: false, value: "" })
]
}),
new sap.m.ColumnListItem({
cells:[
new sap.m.Label({text: resourceBundle.getText("Bottler.ChangeType_CountryProd"), required: true}),
new sap.m.Input("input_CTCP"+ countryItemKey + '_' + flavor.FlavorCode,{ type: sap.m.InputType.Text, enabled: true, value: "", visible: false }),
new sap.m.Input("input_CTCP" + countryItemKey + '_' + flavor.FlavorCode + '_calc',{ type: sap.m.InputType.Text, enabled: CBCCountryFlag, value: "2" })
]
}),
new sap.m.ColumnListItem({
cells:[
new sap.m.Label({text: resourceBundle.getText("Bottler.Concentred"), required: true}),
new sap.m.Input("input_Conc"+ countryItemKey + '_' + flavor.FlavorCode,{ type: sap.m.InputType.Text, enabled: true, value: "", liveChange: function(evt){ gfAutocalculateField(country.CountryCode, flavor.FlavorCode); } }),
new sap.m.Input("input_Conc" + countryItemKey + '_' + flavor.FlavorCode + '_calc',{ type: sap.m.InputType.Text, enabled: false, value: "" })
]
}),
new sap.m.ColumnListItem({
cells:[
new sap.m.Label({text: resourceBundle.getText("Bottler.OtherMaterial"), required: true}),
new sap.m.Input("input_OtMa"+ countryItemKey + '_' + flavor.FlavorCode,{ type: sap.m.InputType.Text, enabled: true, value: "", liveChange: function(evt){ gfAutocalculateField(country.CountryCode, flavor.FlavorCode); } }),
new sap.m.Input("input_OtMa" + countryItemKey + '_' + flavor.FlavorCode + '_calc',{ type: sap.m.InputType.Text, enabled: false, value: "" })
]
}),
new sap.m.ColumnListItem({
cells:[
new sap.m.Label({text: resourceBundle.getText("Bottler.TransformationCost"), required: true}),
new sap.m.Input("input_TrCo"+ countryItemKey + '_' + flavor.FlavorCode,{ type: sap.m.InputType.Text, enabled: true, value: "", liveChange: function(evt){ gfAutocalculateField(country.CountryCode, flavor.FlavorCode); } }),
new sap.m.Input("input_TrCo" + countryItemKey + '_' + flavor.FlavorCode + '_calc',{ type: sap.m.InputType.Text, enabled: false, value: "" })
]
}),
new sap.m.ColumnListItem({
cells:[
new sap.m.Label({text: resourceBundle.getText("Bottler.ProductTotalCost"), required: true, design: "Bold"}),
new sap.m.Input("input_PrTC"+ countryItemKey + '_' + flavor.FlavorCode,{ type: sap.m.InputType.Text, enabled: false, value: "" }),
new sap.m.Input("input_PrTC" + countryItemKey + '_' + flavor.FlavorCode + '_calc',{ type: sap.m.InputType.Text, enabled: false, value: "" })
]
}),
new sap.m.ColumnListItem({
cells:[
new sap.m.Label({text: resourceBundle.getText("Bottler.ChangeType_CountrySale2"), required: true}),
new sap.m.Input("input_CTCS2"+ countryItemKey + '_' + flavor.FlavorCode,{ type: sap.m.InputType.Text, enabled: true, value: "", visible: false }),
new sap.m.Input("input_CTCS2" + countryItemKey + '_' + flavor.FlavorCode + '_calc',{ type: sap.m.InputType.Text, enabled: false, value: "3" })
]
}),
new sap.m.ColumnListItem({
cells:[
new sap.m.Label({text: resourceBundle.getText("Bottler.ImpLogisticCost"), required: true}),
new sap.m.Input("input_ImLC"+ countryItemKey + '_' + flavor.FlavorCode,{ type: sap.m.InputType.Text, enabled: true, value: "", liveChange: function(evt){ gfAutocalculateField(country.CountryCode, flavor.FlavorCode); } }),
new sap.m.Input("input_ImLC" + countryItemKey + '_' + flavor.FlavorCode + '_calc',{ type: sap.m.InputType.Text, enabled: false, value: "" })
]
}),
new sap.m.ColumnListItem({
cells:[
new sap.m.Label({text: resourceBundle.getText("Bottler.Duty"), required: true}),
new sap.m.Input("input_Duty"+ countryItemKey + '_' + flavor.FlavorCode,{ type: sap.m.InputType.Text, enabled: true, value: "", liveChange: function(evt){ gfAutocalculateField(country.CountryCode, flavor.FlavorCode); } }),
new sap.m.Input("input_Duty" + countryItemKey + '_' + flavor.FlavorCode + '_calc',{ type: sap.m.InputType.Text, enabled: false, value: "" })
]
}),
new sap.m.ColumnListItem({
cells:[
new sap.m.Label({text: resourceBundle.getText("Bottler.OtherCostDist"), required: true}),
new sap.m.Input("input_OCD"+ countryItemKey + '_' + flavor.FlavorCode,{ type: sap.m.InputType.Text, enabled: true, value: "", liveChange: function(evt){ gfAutocalculateField(country.CountryCode, flavor.FlavorCode); } }),
new sap.m.Input("input_OCD" + countryItemKey + '_' + flavor.FlavorCode + '_calc',{ type: sap.m.InputType.Text, enabled: false, value: "" })
]
}),
new sap.m.ColumnListItem({
cells:[
new sap.m.Label({text: resourceBundle.getText("Bottler.TotalLogisticCost"), required: true, design: "Bold" }),
new sap.m.Input("input_TLC"+ countryItemKey + '_' + flavor.FlavorCode,{ type: sap.m.InputType.Text, enabled: false, value: "" }),
new sap.m.Input("input_TLC" + countryItemKey + '_' + flavor.FlavorCode + '_calc',{ type: sap.m.InputType.Text, enabled: false, value: "" })
]
}),
new sap.m.ColumnListItem({
cells:[
new sap.m.Label({text: resourceBundle.getText("Bottler.ChangeType_CountrySale3"), required: true}),
new sap.m.Input("input_CTCS3"+ countryItemKey + '_' + flavor.FlavorCode,{ type: sap.m.InputType.Text, enabled: true, value: "", visible: false }),
new sap.m.Input("input_CTCS3" + countryItemKey + '_' + flavor.FlavorCode + '_calc',{ type: sap.m.InputType.Text, enabled: false, value: "4" })
]
}),
new sap.m.ColumnListItem({
cells:[
new sap.m.Label({text: resourceBundle.getText("Bottler.CDExport"), required: true}),
new sap.m.Input("input_CDEx"+ countryItemKey + '_' + flavor.FlavorCode,{ type: sap.m.InputType.Text, enabled: true, value: "", liveChange: function(evt){ gfAutocalculateField(country.CountryCode, flavor.FlavorCode); } }),
new sap.m.Input("input_CDEx" + countryItemKey + '_' + flavor.FlavorCode + '_calc',{ type: sap.m.InputType.Text, enabled: false, value: "" })
]
}),
new sap.m.ColumnListItem({
cells:[
new sap.m.Label({text: resourceBundle.getText("Bottler.Depreciation"), required: true}),
new sap.m.Input("input_Depr"+ countryItemKey + '_' + flavor.FlavorCode,{ type: sap.m.InputType.Text, enabled: true, value: "", liveChange: function(evt){ gfAutocalculateField(country.CountryCode, flavor.FlavorCode); } }),
new sap.m.Input("input_Depr" + countryItemKey + '_' + flavor.FlavorCode + '_calc',{ type: sap.m.InputType.Text, enabled: false, value: "" })
]
}),
new sap.m.ColumnListItem({
cells:[
new sap.m.Label({text: resourceBundle.getText("Bottler.OtherCostsTotal"), required: true, design: "Bold" }),
new sap.m.Input("input_OCT"+ countryItemKey + '_' + flavor.FlavorCode,{ type: sap.m.InputType.Text, enabled: false, value: "" }),
new sap.m.Input("input_OCT" + countryItemKey + '_' + flavor.FlavorCode + '_calc',{ type: sap.m.InputType.Text, enabled: false, value: "" })
]
}),
new sap.m.ColumnListItem({
cells:[
new sap.m.Label({text: resourceBundle.getText("Bottler.SystemMargin"), visible: false }),
new sap.m.Label({text: resourceBundle.getText("Bottler.SystemMargin") }),
new sap.m.Input("input_Marg"+ countryItemKey + '_' + flavor.FlavorCode, { enabled: false, value: "" }),
]
}),
new sap.m.ColumnListItem({
cells:[
new sap.m.Label({text: resourceBundle.getText("Bottler.Margin") }),
new sap.m.Label({text: resourceBundle.getText("Bottler.Operator") }),
new sap.m.Input("input_MaOp"+ countryItemKey + '_' + flavor.FlavorCode, { enabled: false, value: "10" }),
]
}),
new sap.m.ColumnListItem({
cells:[
new sap.m.Label({text: resourceBundle.getText("Bottler.Margin") }),
new sap.m.Label({text: resourceBundle.getText("Bottler.Franchise") }),
new sap.m.Input("input_MaFr"+ countryItemKey + '_' + flavor.FlavorCode, { enabled: true, value: "" }),
]
}),
new sap.m.ColumnListItem({
cells:[
new sap.m.Label({text: resourceBundle.getText("Bottler.Margin") }),
new sap.m.Label({text: resourceBundle.getText("Bottler.Plant") }),
new sap.m.Input("input_MaPl"+ countryItemKey + '_' + flavor.FlavorCode, { enabled: true, value: "" }),
]
}),
new sap.m.ColumnListItem({
cells:[
new sap.m.Label({text: resourceBundle.getText("Bottler.Margin") }),
new sap.m.Label({text: resourceBundle.getText("Bottler.HubSale") }),
new sap.m.Input("input_MaHS"+ countryItemKey + '_' + flavor.FlavorCode,{ enabled: true, value: "" }),
]
}),
new sap.m.ColumnListItem({
cells:[
new sap.m.Label({text: resourceBundle.getText("Bottler.TransferencePrice") }),
new sap.m.Label({text: resourceBundle.getText("Bottler.FromPlantToBeliv") }),
new sap.m.Input("input_TPFPTB"+ countryItemKey + '_' + flavor.FlavorCode,{ enabled: true, value: "" }),
]
}),
new sap.m.ColumnListItem({
cells:[
new sap.m.Label({text: resourceBundle.getText("Bottler.TransferencePrice") }),
new sap.m.Label({text: resourceBundle.getText("Bottler.FromPlantToOperation") }),
new sap.m.Input("input_TPFPTO"+ countryItemKey + '_' + flavor.FlavorCode,{ enabled: true, value: "" }),
]
}),
new sap.m.ColumnListItem({
cells:[
new sap.m.Label({text: resourceBundle.getText("Bottler.TransferencePrice") }),
new sap.m.Label({text: resourceBundle.getText("Bottler.FromBelivToOperation") }),
new sap.m.Input("input_TPFBTO"+ countryItemKey + '_' + flavor.FlavorCode,{ enabled: true, value: "" }),
]
})
]
}).setKeyboardMode(sap.m.ListKeyboardMode.Edit)
]
});
tabFlavorCountry.addItem(newFlavorTab);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment