How to move one tab to another tab using button Click? When I click accept button, it moves to next tab menu.
Can anyone tell me how to do this?
frmSubscription = new Form();
String[] subscriptionList = {"15 Days - $12.5", "30 Days - $25", "45 Days - $37.5", "60 Days - $50", "90 Days - $75"};
cmdBack = new Command((String)locale.get("BACK"));
cmdExit = new Command((String)locale.get("EXIT"));
lblLeague = new Label("Premier League");
lblSubscription = new Label("Subscription");
lblCurrentPlan = new Label("Current Plan");
comboSubscription = new ComboBox(subscriptionList);
deviceWidth = Display.getInstance().getDisplayWidth();
btnAccept = new Button("Accept");
btnAccept.setAlignment(Component.CENTER);
btnAccept.setPreferredW(deviceWidth);
btnSubscription = new Button("Unsubscription");
btnCancel = new Button("Cancel");
flowLayout = new FlowLayout();
frmSubscription.setLayout(flowLayout);
btnTermsCond = new Button((String) locale.get("TERM&COND"));
btnSubscribe = new Button("Subscribe");
// Terms & conditions container
txtTermsCondt = new TextArea((String) locale.get("TERMS & CONDITIONS"));
txtTermsCondt.setEditable(false);
termsContainer = new Container(new BoxLayout(BoxLayout.Y_AXIS));
termsContainer.addComponent(txtTermsCondt);
termsContainer.addComponent(btnAccept);
// Subscription container
subContainer = new Container(new BoxLayout(BoxLayout.Y_AXIS));
subContainer.addComponent(lblCurrentPlan);
subContainer.addComponent(comboSubscription);
acceptContainer = new Container(new BoxLayout(BoxLayout.X_AXIS));
acceptContainer.addComponent(btnSubscription);
acceptContainer.addComponent(btnCancel);
subContainer.addComponent(acceptContainer);
container = new Container();
GridLayout gridLayout = new GridLayout(1, 2);
container.setLayout(gridLayout);
container.addComponent(lblLeague);
container.addComponent(lblSubscription);
tabSubscription = new TabbedPane();
tabSubscription.addTab("Terms and Conditions", termsContainer );
tabSubscription.addTab("Unsubscribe", subContainer );
frmSubscription.addComponent(container);
frmSubscription.addComponent(tabSubscription);
btnAccept.addActionListener(this);
frmSubscription.addCommand(cmdBack);
frmSubscription.addCommand(cmdExit);
if tabSubscription.getSelectedIndex() == 0
tabSubscription.setSelectedIndex(1);
else
tabSubscription.setSelectedIndex(0);
frmSubscription.repaint();
Related
I am attempting to create open purchase orders in Netsuite during a system migration using Netsuite's PHP Toolkit for 2019_2. I am able to create the purchase order and line items without a problem, but I cannot figure out how to change the item cost on the line item. Setting the line item extended total works, but setting the rate field does not. Can anyone shed any light on why the price is not being set?
I've tried both $poi->item->rate = "5.00"; and $poi->item->rate = 5.00; with no success. The documentation says that this field is a string.
https://www.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2019_2/schema/other/purchaseorderitem.html
$service = new NetSuiteService();
$po = new PurchaseOrder();
$po->tranId = 'PO111111';
$po->tranDate = '2019-03-27T00:00:00';
$po->approvalStatus = new RecordRef();
$po->approvalStatus->internalId = 2;
$po->entity = new RecordRef();
$po->entity->externalId = 'VENDORNAME';
// Create PO Item
$poi = new PurchaseOrderItem();
$poi->item = new RecordRef();
$poi->item->externalId = 'ITEMNUMBER';
$poi->item->rate = "5.00";
$poi->quantity = 10;
$po->itemList = new PurchaseOrderItemList();
$po->itemList->item = array($poi);
$request = new AddRequest();
$request->record = $po;
$addResponse = $service->add($request);
if (!$addResponse->writeResponse->status->isSuccess) {
echo "ADD ERROR";
print_r($addResponse);
} else {
echo "ADD SUCCESS, id " . $addResponse->writeResponse->baseRef->internalId;
}
Set the rate on the purchase order line instead of trying to do it on the item record.
$poi->rate = "5.00";
Hello how do I add a new customer with a default contact in my process in code behind.
So far I have this but I need to create a contact object link the two somehow.
PX.Objects.AR.Customer m = new PX.Objects.AR.Customer();
m.AcctCD = "Test1";
m.AcctName = "Joe Bloggs";
m.Type = "CU";
Customers.Insert(m);
Persist();
CustomerMaint graph = PXGraph.CreateInstance<CustomerMaint>();
Customer cust = new Customer();
cust.AcctName = "Company Name";
cust = (Customer)graph.CurrentCustomer.Insert(cust);
Address addr = (Address)graph.Addresses.Current;
addr.AddressLine1 = "Address 1";
addr.AddressLine2 = "Address 2";
addr.City = "City";
addr.State = "State";
addr.PostalCode = "Zip";
addr.CountryID = "Country";
graph.Addresses.Update(addr);
Contact contact = (Contact)graph.DefContact.Current;
contact.ContactType = ContactTypesAttribute.BAccountProperty;
contact.FirstName = "FirstName";
contact.LastName = "Last Name";
contact.EMail = "emaiL#email.com";
contact.WebSite = "www.website.com";
contact.Phone1 = "1234567890";
contact.Fax = "1234567890";
graph.DefContact.Update(contact);
graph.Actions.PressSave();
This what I did seems to work good. Got instance of the customermaint graph. Insert new Customer into currentcustomer and edit current def contact.
PX.Objects.AR.CustomerMaint graph = PXGraph.CreateInstance<PX.Objects.AR.CustomerMaint>();
PX.Objects.AR.Customer m = new PX.Objects.AR.Customer();
m.AcctCD = "Test4";
m.AcctName = "Jo Bloggs";
m.Type = "CU";
graph.CurrentCustomer.Insert(m);
PX.Objects.CR.Contact c = graph.DefContact.Current;
c.ContactType = "AP";
c.FullName = "Joe Bloggs";
c.EMail = "joe#Bloggs.com";
graph.Actions.PressSave();
I tried to read the existing excel file and copied to another path, and then i tried to insert data to the file i cloned. But I can' insert data. I don't know where I made mistake. But Here I've given my code.
Error occured in the line sheetData.InsertAt<Row>(row,++rowIndex);. Please help me out.
Package spreadsheetPackage = Package.Open(destinationFile, FileMode.Open, FileAccess.ReadWrite);
using (var document = SpreadsheetDocument.Open(spreadsheetPackage))
{
foreach (System.Data.DataTable table in ds.Tables)
{
var workbookPart = document.WorkbookPart;
var workbook = workbookPart.Workbook;
var sheet = workbookPart.Workbook.Descendants<Sheet>().FirstOrDefault();
Worksheet ws = ((WorksheetPart)(workbookPart.GetPartById(sheet.Id))).Worksheet;
SheetData sheetData = ws.GetFirstChild<SheetData>();
//Sheet sheet = sheets.FirstOrDefault();
if(sheet==null)
throw new Exception("No sheed found in the template file. Please add the sheet");
int rowIndex = 10, colIndex = 0;
bool flag = false;
var worksheetPart = (WorksheetPart)workbookPart.GetPartById(sheet.Id);
var sharedStringPart = workbookPart.SharedStringTablePart;
var values = sharedStringPart.SharedStringTable.Elements<SharedStringItem>().ToArray();
var rows = worksheetPart.Worksheet.Descendants<Row>();
List<String> columns = new List<string>();
foreach (System.Data.DataColumn column in table.Columns)
{
columns.Add(column.ColumnName);
}
foreach (System.Data.DataRow dsrow in table.Rows)
{
Row row = new Row();
foreach (String col in columns)
{
DocumentFormat.OpenXml.Spreadsheet.Cell cell = new Cell();
cell.DataType = DocumentFormat.OpenXml.Spreadsheet.CellValues.String;
cell.CellValue = new DocumentFormat.OpenXml.Spreadsheet.CellValue(dsrow[col].ToString());
row.AppendChild<Cell>(cell);
}
sheetData.InsertAt<Row>(row,++rowIndex);
}
}
Before you append Row, you should mentioned the row index to the instance...
row.RowIndex = (UInt32)rowIndex++;
I am using 2 datagridview to see the data in a windows form application.
The first DGV show the products according to the ids passed to them.
On click of VIEW as of my one column in DGV1, it passes the product id to and fetch the complete records from database and show the records to the other DGV2.
this is my code:
if (dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value == (Object)"View")
{
if (con.State == ConnectionState.Closed)
{
con.Open();
}
int prod_id = Convert.ToInt16(dataGridView1.Rows[e.RowIndex].Cells[0].Value);
dataGridView2.DataSource = null;
dataGridView2.Rows.Clear();
retFindProducts = new MySqlCommand("SELECT DISTINCT tf_history.thefind_id, tf_product.product_id, tf_product.`name`, tf_product.product_url, tf_product.image_tpm, tf_product.image_thefind, tf_product.image_accuracy, (SELECT MIN(tf_h.price) FROM tf_history AS tf_h WHERE tf_h.thefind_id = tf_history.thefind_id) as price, oc_product.price AS priceTPM FROM tf_product LEFT JOIN tf_history ON tf_product.product_id = tf_history.product_id AND tf_product.thefind_id = tf_history.thefind_id LEFT JOIN oc_product ON tf_product.product_id = oc_product.product_id WHERE tf_product.product_id = #product_id", con);
historyData = new MySqlCommand("SELECT price, date from tf_history WHERE thefind_id = #thefind_id", con);
retFindProducts.CommandTimeout = 300;
historyData.CommandTimeout = 300;
retFindProducts.Parameters.AddWithValue("#product_id", prod_id);
dr = retFindProducts.ExecuteReader();
retFindProducts.Parameters.Clear();
while (dr.Read())
{
dataGridView2.Rows.Add();
long fI = Convert.ToInt64(dr["thefind_id"]);
//if (!findId.Exists(p => p.Item1 == fI))
findId.Add(new Tuple<long>(fI));
decimal findPrice = Convert.ToDecimal(dr["price"]);
decimal tpmPrice = Convert.ToDecimal(dr["priceTPM"]);
if (findPrice > tpmPrice)
{
dataGridView2.Rows[cnt].Cells[4].Style.ForeColor = Color.Green;
dataGridView2.Rows[cnt].Cells[4].Style.Font = new Font(dataGridView2.DefaultCellStyle.Font.FontFamily, 9, FontStyle.Regular);
}
else if (findPrice < tpmPrice)
{
dataGridView2.Rows[cnt].Cells[4].Style.ForeColor = Color.Red;
dataGridView2.Rows[cnt].Cells[4].Style.Font = new Font(dataGridView2.DefaultCellStyle.Font.FontFamily, 10, FontStyle.Bold);
}
dataGridView2.Rows[cnt].Cells[0].Value = Image.FromFile(dr["image_tpm"].ToString());
dataGridView2.Rows[cnt].Cells[1].Value = Image.FromFile(dr["image_thefind"].ToString());
dataGridView2.Rows[cnt].Cells[2].Value = dr["name"].ToString();
dataGridView2.Rows[cnt].Cells[3].Value = dr["product_url"].ToString();
dataGridView2.Rows[cnt].Cells[4].Value = dr["price"].ToString();
dataGridView2.Rows[cnt].Cells[5].Value = dr["image_accuracy"].ToString();
cnt++;
}
foreach (DataGridViewRow row in dataGridView2.Rows)
{
row.Height = 60;
}
dr.Close();
}
Now, the outofexception does not comes on first time of the click, but it comes after 5-8 clicks on the VIEW column of DGV1.
How can i clear up the memory?
Try to dispose and create datagridview manually. The Code can be like this:
dgv.Dispose();
dgv = new DataGridView();
DataGridViewColumn col1 = new DataGridViewTextBoxColumn();
DataGridViewColumn col2 = new DataGridViewTextBoxColumn();
DataGridViewColumn col3 = new DataGridViewTextBoxColumn();
DataGridViewColumn col4 = new DataGridViewTextBoxColumn();
DataGridViewColumn col5 = new DataGridViewTextBoxColumn();
col1.HeaderText = "COl1";
col2.HeaderText = "COl2";
col3.HeaderText = "COl3";
col4.HeaderText = "COl4";
col5.HeaderText = "COl5";
dgv = new System.Windows.Forms.DataGridView();
dgv.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dgv.Location = new System.Drawing.Point(59, 101);
dgv.Name = "dataGridView1";
dgv.Size = new System.Drawing.Size(240, 150);
dgv.TabIndex = 2;
dgv.Columns.Add(col1);
dgv.Columns.Add(col2);
dgv.Columns.Add(col3);
dgv.Columns.Add(col4);
dgv.Columns.Add(col5);
this.Controls.Add(dgv);
dgv.ColumnCount = 5;
dgv.Visible = true;
I am working in .Net Charts. I am trying to generate a Column chart. I am having two rows in my dataset. Here is my code.
DataTable DT1 = new DataTable();
DT1 = chartViewSummaryList;
DataView DV = DT1.DefaultView;
DV.ToTable(false, new string[] { "REVENUE_TOTAL", "WEEK_END_DATE" });
DataSet ds = new DataSet();
ds.Tables.Add(DT1.Copy());
ds.Tables[0].Rows[0]["MARGIN"] = "0";
ds.Tables[0].Rows[0]["REVENUE_TOTAL"] = "3776169.61";
ds.Tables[0].Rows[0]["MARGIN_PCT"] = "0";
ds.Tables[0].Rows[0]["VISIT_REVENUE_AVG"] = "29.28";
ds.Tables[0].Rows[0]["VISIT_COUNT"] = "614041";
ds.Tables[0].Rows[0]["REVENUE_SALE"] = "1840387.18";
ds.Tables[0].Rows[0]["REVENUE_REGULAR"] = "1935782.43";
ds.Tables[0].Rows[0]["WEEK_END_DATE"] = "1/1/2012 12:00:00 AM";
ds.Tables[0].Rows.Add();
ds.Tables[0].Rows[1]["MARGIN"] = "1";
ds.Tables[0].Rows[1]["REVENUE_TOTAL"] = "5776169.61";
ds.Tables[0].Rows[1]["MARGIN_PCT"] = "0";
ds.Tables[0].Rows[1]["VISIT_REVENUE_AVG"] = "49.28";
ds.Tables[0].Rows[1]["VISIT_COUNT"] = "814041";
ds.Tables[0].Rows[1]["REVENUE_SALE"] = "3840387.18";
ds.Tables[0].Rows[1]["REVENUE_REGULAR"] = "3935782.43";
ds.Tables[0].Rows[1]["WEEK_END_DATE"] = "1/1/2012 12:00:00 AM";
Chart1.DataSource = ds;
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
Chart1.Titles.Add(storeLevelCaption).Font = new System.Drawing.Font("Verdana", 11, FontStyle.Bold);
Chart1.ChartAreas["ChartArea1"].AxisX.Title = "Weeks";
Chart1.ChartAreas["ChartArea1"].AxisX.TitleFont = new System.Drawing.Font("Verdana", 10, FontStyle.Bold);
Chart1.ChartAreas["ChartArea1"].AxisX.LabelStyle.Font = new Font(new FontFamily("Verdana"), 7.25F, FontStyle.Bold);
string series = "Series" + i;
Chart1.Series.Add(series);
Chart1.Series[series].ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Column;
Chart1.Series[series].XValueMember = "WEEK_END_DATE";
Chart1.ChartAreas["ChartArea1"].AxisX.MajorGrid.Enabled = false;
Color color = System.Drawing.ColorTranslator.FromHtml("#B93B8F");
Chart1.Series[series].Color = color;
Chart1.ChartAreas["ChartArea1"].AxisY.Title = "Total Revenue";
Chart1.ChartAreas["ChartArea1"].AxisY.TitleFont = new System.Drawing.Font("Verdana", 10, FontStyle.Bold);
Chart1.ChartAreas["ChartArea1"].AxisY.LabelStyle.Font = new Font(new FontFamily("Verdana"), 7.25F, FontStyle.Bold);
Chart1.Series[series].YValueMembers = "REVENUE_TOTAL";
Chart1.ChartAreas["ChartArea1"].AxisY.MajorGrid.Enabled = false;
Chart1.Series[series].ToolTip = "Total Revenue ($) , " + ds.Tables[0].Rows[i]["WEEK_END_DATE"].ToString() + " , " + ds.Tables[0].Rows[i]["REVENUE_TOTAL"].ToString();
Chart1.Series[series].Font = new Font(new FontFamily("Verdana"), 7.25F, FontStyle.Bold);
//Chart1.Series[series].Name = "Total Revenue";
}
Chart1.ChartAreas[0].AxisY.Interval = 1;
Chart1.DataBind();
I am getting the chart, where two column combined together and displayed as one column. Where i had gone wrong...
I can't reproduce your problem using the WinForm charting assemblies. However you may want to try using distinct dates since they are bound to your X values.
ds.Tables[0].Rows[0]["WEEK_END_DATE"] = "1/1/2012 12:00:00 AM";
ds.Tables[0].Rows[1]["WEEK_END_DATE"] = "8/1/2012 12:00:00 AM"; // a different date
FYI, I changed your code minimaly
// DT1 = chartViewSummaryList;
// replace unknown object with this code
DT1.Columns.Add(new DataColumn("MARGIN"));
DT1.Columns.Add(new DataColumn("REVENUE_TOTAL"));
DT1.Columns.Add(new DataColumn("MARGIN_PCT"));
DT1.Columns.Add(new DataColumn("VISIT_REVENUE_AVG"));
DT1.Columns.Add(new DataColumn("VISIT_COUNT"));
DT1.Columns.Add(new DataColumn("REVENUE_SALE"));
DT1.Columns.Add(new DataColumn("REVENUE_REGULAR"));
DT1.Columns.Add(new DataColumn("WEEK_END_DATE"));
and also added a row manually
ds.Tables.Add(DT1.Copy());
ds.Tables[0].Rows.Add(); // Added this
and got two columns from your plotting code.