Calculation of Demurrage in TSW Need heeeellllpppp

I want to calculate Demurrage value upon actualization of discharge line in nomination in an FOB OP/DX scenario.System calculates the:
a) Potentuial Latime
b) Allowable Laytime but NOT the demurrage value
Following are the config settings I have done.
In TD-->Ship Costs-->Pricing-->Pr Control I have created Pricing proced: PricingProc   FSCM01 and maintained DM10 as an access sequence
Defined Demurrage Rate DM10 as:
Cond class: Prices
Cond Typ: daily pr
Cond Category: Freight
Defined Demurrage Factor DMFC as:
Cond class: Discount/Surcharge
Cond Typ: percentage
Cond Category: Freight
In TSW--> Laytime and Demurrage I have defined
Laytime term defaults
Assign Laytime filter to relevance type
All the BADI's for TSW LayT and Demurrage are activated
In Freight Contract: In TSW Details Laytime tab: Defined demurrage as
Demurrage rate  DM10
Despatch rate   DM10
Calcul. factor  DMFC
Defined Laytime as:
Window per. ev. E4   Load start
Timebar start   E4   Load start
Total laytime    72  HR/70.000 TO
Discharge layt.  72
Min. laytime     24  HR
I want to specify the demurrage rates and input the demurrage factor as 100%. Am I missing any config for the system to calculate the demurrage value.
Request HELP.

Hi, James.
Make a CKF3 (CKF3 =KF1)
Do your % calcuilations on CKF3.
Hide CKF3
Udo

Similar Messages

  • Progress calculation in LMS ... need help

    I would really appreciate the help!!
    I have a breeze 5.1 file with 10 slides that published as
    SCORM for LMS. I want to track the progress for this file. When I
    open the course from an LMS and visit 5 slides and close the course
    the progress shows 100% instead 50%. I am able to track the
    progress in Breeze 4. But it’s not working in Breeze 5 and
    5.1.
    Please help me.

    AT  wrote:
    Hi friend
    Can we do the calculation in some other way is it possible to find the %
    by without calculating like this method
    User entered cost =110
    std item cost = 100
    i have used my mathemathical logic ((110-100)/100)* 100
    Is there any other logic to bring the same resultThe response you were given IS using that logic, providing that the divisor is non-zero.
    What other logic do you want it to do? You have to handle the case of a zero divisor in some way, as you can't force Oracle to attempt to divide by zero without it getting an error. The only thing to do is, as in the solution given, test for a zero divisor and handle it, such as by making the result 0.

  • Calculator 's functions. Difficult. need some help.

    I did do for my own calculator,but i got problem with animation and sound for the calculator. Like :
    Pressing a wrong combination of keys may generate a warning sound. Moreover an animated icon
    should be used to indicate when:
    + the calculator is idle and free to be used
    + the calculator is busy ( being used )
    This is my own program, anybody can show me how to add the warning sound and animation icon according above requirement ???? Or any online tutorial about this one. This program is working on the right way, but i don't know how to add some more feature like animation icon, and warning sound.Pleaseeeeeeeeeeeee help me, it is urgent.
    import java.awt.event.*;
    import java.awt.*;
    public class Calculator extends Frame implements ActionListener
    TextField name;
    Label aHeader;
    Button b[];
    String expression;
    // Calculator Constructor
    // This operator constructor ( as with all constructors ) is executed when the new object
    // is created. In this case we create all the buttons ( and the panels that contain them )
    // then reset the calculator
    public Calculator()
    super("DUY 'S CALCULATOR");     
    setLayout(new BorderLayout());     
    Panel p1 = new Panel();
    p1.setBackground(new Color(18,70,1));
    p1.setLayout(new FlowLayout());
    aHeader = new Label("DUY'S CALCULATOR");
    aHeader.setFont(new Font("Times New Roman",Font.BOLD,24));
    aHeader.setForeground(new Color(255,0,0));
    p1.add(aHeader);
    // Question: what does 'North' mean here ?
    // The applet places a GridLayout on the 'North' side
    add("North",p1);
    Panel p2 = new Panel();
    p2.setBackground(new Color(27,183,100));
    p2.setLayout(new GridLayout(0,1));
    // When you create p2 GridLayout you specify 'new GridLayout(0,1) 'which means create a new GridLayout with 1 column .( no row)
    name = new TextField(20); // Var for Text field max of 20 characters
    p2.add(name);
    add("Center",p2);
    Panel p3 = new Panel();
    p3.setLayout(new GridLayout(0,6));
    // When you create p3 GridLayout you specify 'new GridLayout(0,1) 'which means create a new GridLayout with 6 columns .( no row)
    b = new Button[25];
    b[0] = new Button("MC");     // Create Button MC
    b[0].addActionListener(this);
    b[1] = new Button("7");     // Create Button Seven
    b[1].addActionListener(this);
    b[2] = new Button("8");     // Create Button Eight
    b[2].addActionListener(this);
    b[3] = new Button("9");     // Create Button Nine
    b[3].addActionListener(this);
    b[4] = new Button("/");     // Create Button Div
    b[4].addActionListener(this);
    b[5] = new Button("sqrt");     // Create Button SQRT
    b[5].addActionListener(this);
    b[6] = new Button("CE");     // Create Button CE
    b[6].addActionListener(this);
    b[7] = new Button("4");     // Create Button Four
    b[7].addActionListener(this);
    b[8] = new Button("5");     // Create Button Five     
    b[8].addActionListener(this);
    b[9] = new Button("6");     // Create Button Six
    b[9].addActionListener(this);
    b[10] = new Button("*");     // Create Button Multi
    b[10].addActionListener(this);
    b[11] = new Button("%");     // Create Button Percent
    b[11].addActionListener(this);
    b[12] = new Button("MS");     // Create Button MS
    b[12].addActionListener(this);
    b[13] = new Button("1");     // Create Button One
    b[13].addActionListener(this);
    b[14] = new Button("2");     // Create Button Two
    b[14].addActionListener(this);
    b[15] = new Button("3");     // Create Button Three
    b[15].addActionListener(this);
    b[16] = new Button("-");     // Create Button Minus
    b[16].addActionListener(this);
    b[17] = new Button("1/x");     // Create Button Calculates the multiplicative inverse
    b[17].addActionListener(this);
    b[18] = new Button("M+");     // Create Button M+
    b[18].addActionListener(this);
    b[19] = new Button("0");     // Create Button Zero     
    b[19].addActionListener(this);
    b[20] = new Button("+/-");     // Create Button +/-
    b[20].addActionListener(this);
    b[21] = new Button(".");     // Create Button point
    b[21].addActionListener(this);
    b[22] = new Button("+");     // Create Button Plus
    b[22].addActionListener(this);
    b[23] = new Button("=");     // Create Button Equal     
    b[23].addActionListener(this);
    b[24] =new Button("exit");     // Create Button Exit
    b[24].addActionListener(this);
    // clearAll sets the attributes of the Calculator object to initial values ( this is
    // the operation that is called when the user click on the "CE" button.
    for(int i=0;i<=24;i++)
    {      p3.add(b[i]);
    add("South",p3);
    // Question : what does 'South' mean here ? The applet places a GridLayout on the
    // 'South' side
    super.addWindowListener(new WindowAdapter(){
    public void windowClosing(WindowEvent e)
    {System.exit(0);}});
    // Window Closing
    // This operation is called in response to a window closing event. It should simply
    // exit the program
    setLocation(200,100);
    pack();
    setVisible(true);
    // End of constructor
    //* actionPerformed:: This operation is call whenever the user click a button .All
    // this operation does is pass on the text on the button to ' evt '
    public void actionPerformed(ActionEvent evt)
    String command = evt.getActionCommand();
    StringBuffer tmp, first, second;
    int value, size, k;
    char ch, op = ' ';
    first = new StringBuffer();
    second = new StringBuffer();
    //* processButton:This operation takes action according to the user's input. It is called
    // from two other operation :actionPerformed ( when user click a button ) andkeypressed
    // ( when user press a key on the keyboard ). This operation examines the text on the button
    // by ( the parameter 'command') and calls the appropriate operation to process it
    if ("CE".equals(command))
    name.setText("");
    else if("7".equals(command))
    expression = name.getText();
    name.setText(expression+"7");
    else if ("8".equals(command))
    expression = name.getText();
    name.setText(expression+"8");
    else if ("9".equals(command))
    expression = name.getText();
    name.setText(expression+"9");
    else if("4".equals(command))
    expression = name.getText();
    name.setText(expression+"4");
    else if("5".equals(command))
    expression = name.getText();
    name.setText(expression+"5");
    else if("6".equals(command))
    expression = name.getText();
    name.setText(expression+"6");
    else if("1".equals(command))
    expression = name.getText();
    name.setText(expression+"1");
    else if("2".equals(command))
    expression = name.getText();
    name.setText(expression+"2");
    else if("3".equals(command))
    expression = name.getText();
    name.setText(expression+"3");
    else if("0".equals(command))
    expression = name.getText();
    name.setText(expression+"0");
    else if("+".equals(command))
    expression = name.getText();
    name.setText(expression+"+");
    else if("-".equals(command))
    expression = name.getText();
    name.setText(expression+"-");
    else if("*".equals(command))
    expression = name.getText();
    name.setText(expression+"*");
    else if("/".equals(command))
    expression = name.getText();
    name.setText(expression+"/");
    //processEquals : Deal with the user clicking the '=' button. This operation finishes
    // the most recent calculator
    else if("=".equals(command))
    expression = name.getText();
    size = expression.length();
    tmp = new StringBuffer( expression );
    for(int i = 0;i<size;i++)
    ch = tmp.charAt(i);
    if(ch != '+' && ch != '*' && ch != '-' && ch != '/')
    first . insert(i, ch);
    else
    op = ch;
    k = 0;
    for(int j = i+1; j< size ; j++)
    ch = tmp.charAt(j);
    second.insert(k,ch);
    k++;
    break;
    switch(op)
    //* processLastOperator : Carries out the arithmetic operation specified by the last
    // operator, the last number and the number in the display.If the operator causes an
    // error condition ( ex : the user tries to devide something by zero), this operation an
    // exception     
    // Question : if the user click on the button '2' , '+', '3' what values will found ?
    case '+' : value = Integer.parseInt(new String(first)) +
    Integer.parseInt(new String(second));
    name.setText(new Integer(value).toString());
    break;      // plus button
    case '-' : value = Integer.parseInt(new String(first)) -
    Integer.parseInt(new String(second));
    name.setText(new Integer(value).toString());
    break;
    case '*' : value = Integer.parseInt(new String(first)) *
    Integer.parseInt(new String(second));
    name.setText(new Integer(value).toString());
    break;
    case '/' : value = Integer.parseInt(new String(first)) /
    Integer.parseInt(new String(second));
    name.setText(new Integer(value).toString());
    break;
    } //end of actionPerformed
    /**main method to invoke from JVM.*/
    public static void main(String args[])
    new Calculator(); // Create a new instance of the Calculator object

    Here's your code fixed up the enw way. It works the same, except it is half the size
    package jExplorer;
    import java.awt.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    public class Calculator extends Frame implements ActionListener
      final static String[] bNames = {"7", "8", "9", "/", "sqrt", "CE", "4", "5", "6", "*", "%", "MS", "1", "2", "3", "-", "1/x", "M+", "0", "+/-", ".", "+", "=", "exit"};
      final static int NUM_BUTTONS = bNames.length;
      private TextField name;
    * Calculator Constructor
    * This operator constructor ( as with all constructors ) is executed when the new object
    * is created. In this case we create all the buttons ( and the panels that contain them )
    * then reset the calculator
      public Calculator()
        super( "DUSTPANTS CALCULATOR" );
        setLayout( new BorderLayout() );
        Panel p1 = new Panel();
        p1.setBackground( new Color( 18, 70, 1 ) );
        p1.setLayout( new FlowLayout() );
        Label aHeader;
        aHeader = new Label( "DUSTPANTS CALCULATOR" );
        aHeader.setFont( new Font( "Times New Roman", Font.BOLD, 24 ) );
        aHeader.setForeground( new Color( 255, 0, 0 ) );
        p1.add( aHeader );
    // Question: what does 'North' mean here ?
    // The applet places a GridLayout on the 'North' side
        add( "North", p1 );
        Panel p2 = new Panel();
        p2.setBackground( new Color( 27, 183, 100 ) );
        p2.setLayout( new GridLayout( 0, 1 ) );
        name = new TextField( 20 ); // Var for Text field max of 20 characters
        p2.add( name );
        add( "Center", p2 );
        Panel p3 = new Panel();
        p3.setLayout( new GridLayout( 0, 6 ) );
    // Create buttons & their ActionListeners, and add them to the panel
        Button b[];
        b = new Button[NUM_BUTTONS];
        for( int x = 0; x < NUM_BUTTONS; x++ )
          b[x] = new Button( bNames[x] );
          b[x].addActionListener( this );
          p3.add( b[x] );
        add( "South", p3 );
        super.addWindowListener( new WindowAdapter()
          public void windowClosing( WindowEvent e )
            System.exit( 0 );
        setLocation( 200, 100 );
        pack();
        setVisible( true );
    * actionPerformed:: This operation is call whenever the user click a button .All
    * this operation does is pass on the text on the button to ' evt '
      public void actionPerformed( ActionEvent evt )
        String command = evt.getActionCommand();
        String expression;
        int value, size, k;
        char ch, op = ' ';
        StringBuffer tmp;
        StringBuffer first = new StringBuffer();
        StringBuffer second = new StringBuffer();
        if( "CE".equals( command ) )
          name.setText( "" );
        else if( "=".equals( command ) )
          expression = name.getText();
          tmp = new StringBuffer( expression );
          size = tmp.length();
          for( int i = 0; i < size; i++ )
            ch = tmp.charAt( i );
            if( ch != '+' && ch != '*' && ch != '-' && ch != '/' )
            { first.insert( i, ch ); }
            else
              op = ch;
              k = 0;
              for( int j = i + 1; j < size; j++ )
                ch = tmp.charAt( j );
                second.insert( k, ch );
                k++;
              break;
        else if( validButton( command ) )
          expression = name.getText();
          name.setText( expression + command );
        else
          Toolkit.getDefaultToolkit().beep();
       * processLastOperator : Carries out the arithmetic operation specified by the last
       * operator, the last number and the number in the display.If the operator causes an
       * error condition ( ex : the user tries to devide something by zero), this operation an
       * exception
       * Question : if the user click on the button '2' , '+', '3' what values will found ?
        switch( op )
          case '+':
            value = Integer.parseInt( new String( first ) ) +
              Integer.parseInt( new String( second ) );
            name.setText( new Integer( value ).toString() );
            break; // plus button
          case '-':
            value = Integer.parseInt( new String( first ) ) -
              Integer.parseInt( new String( second ) );
            name.setText( new Integer( value ).toString() );
            break;
          case '*':
            value = Integer.parseInt( new String( first ) ) *
              Integer.parseInt( new String( second ) );
            name.setText( new Integer( value ).toString() );
            break;
          case '/':
            value = Integer.parseInt( new String( first ) ) /
              Integer.parseInt( new String( second ) );
            name.setText( new Integer( value ).toString() );
            break;
      private static final boolean validButton( String command )
        for( int x = 0; x < NUM_BUTTONS; x++ )
          if( bNames[x].equals( command ) ) ;
            return true;
        return false;
      /** main method to invoke from JVM. */
      public static void main( String args[] )
        new Calculator(); // Create a new instance of the Calculator object
    }

  • Calculating Login and Logout Times - need help

    Hi everyone. I have the first part of this code and can't seem to figure out the time calculation part. What it is - create a code that asks for a user name or social security number, then the person enters up to 6 login and logout times for the day. They also have the option to enter personal time or sick time (neither of which can be over 8 hours). I have all of that complete, but I can't figure out how to get the in and out times and the leave times to calculate. I have 3 pieces of code - here they are:
    Hours:
    import java.util.*;
    public class Hours
         //define states of Hours
         int regularhoursInt = 0;
         int regularminutesInt = 0;
         int overtimehoursInt = 0;
         int overtimeminutesInt = 0;          
         //set hours worked
         public void setHours(int timein, int timeout)
              int temphoursin = timein/100;
              int tempminutesin = timein - timein/100;
              int temphoursout = timeout/100;
              int tempminutesout = timeout - timeout/100;
              GregorianCalendar time1 = new GregorianCalendar(2003, 8, 1, temphoursin, tempminutesin, 0);
              GregorianCalendar time2 = new GregorianCalendar(2003, 8, 1, temphoursout, tempminutesout, 0);
              //store to date
              Date d1 = time1.getTime();
              Date d2 = time2.getTime();
              //store time to long
              long t1 = d1.getTime();
              long t2 = d2.getTime();
              //subtract and convert to seconds
              long time = (t2 - t1)/1000;
              long tempregularLong = 0;
              long tempovertimeLong = 0;
              //see if regular hours are over 8 hours (28800 seconds)
              tempregularLong = time;
              if (tempregularLong > 28800)
                   tempovertimeLong = tempregularLong - 28800;
                   tempregularLong = tempregularLong - tempovertimeLong;
              //convert to hours and minutes
              regularhoursInt = regularhoursInt + (Integer.parseInt(Long.toString(tempregularLong)) / 3600);
              regularminutesInt = regularminutesInt + (Integer.parseInt(Long.toString(tempregularLong)) / (3600 * regularhoursInt));
              overtimehoursInt = overtimehoursInt + (Integer.parseInt(Long.toString(tempovertimeLong)) / 3600);
              overtimeminutesInt = overtimeminutesInt + (Integer.parseInt(Long.toString(tempovertimeLong)) / (3600 * regularhoursInt));     }
         // get regular hours worked
         public int getRegularHours()
              return regularhoursInt;
         // get regular minutes worked
         public int getRegularMinutes()
              return regularminutesInt;
         //get overtime hours worked
         public int getOvertimeHours()
              return overtimehoursInt;
         // get overtime minutes worked
         public int getOvertimeMinutes()
              return overtimeminutesInt;
    Employee:
    public class Employee
         //define states of employee
         String nameString = "";
         String ssnString = "";
         double payrateDouble = 0;
         double hoursworkedDouble = 0;
         double overtimehoursDouble = 0;
         double sickleaveDouble = 0;
         double personalleaveDouble = 0;
         double totalpayDouble = 0;
         //set and get employee name
         public void setName(String name)
              nameString = name;
         public String getName()
              return nameString;
         //set and get employee ssn
         public void setSsn(String ssn)
              ssnString = ssn;
         public String getSsn()
              return ssnString;
         //set and get employee payrate
         public void setPayRate(double payrate)
              payrateDouble = payrate;
         public double getPayRate()
              return payrateDouble;
         //set and get employee hours worked
         public void setHoursWorked(double hoursworked)
              hoursworkedDouble = hoursworked;
         public double getHoursWorked()
              return hoursworkedDouble;
         //set and get employee overtimehours
         public void setOverTime(double overtime)
              overtimehoursDouble = overtime;
         public double getOverTime()
              return overtimehoursDouble;
         //set and get employee sick leave hours
         public void setSickLeave(double sickleave)
              sickleaveDouble = sickleave;
         public double getSickLeave()
              return sickleaveDouble;
         //set and get employee sick leave hours
         public void setPersonalLeave(double personalleave)
              personalleaveDouble = personalleave;
         public double getPersonalLeave()
              return personalleaveDouble;
         //get employees total pay
         public double getTotalPay()
              //calculate regular pay
              totalpayDouble = payrateDouble * hoursworkedDouble;
              //add in any over time pay
              totalpayDouble = totalpayDouble + payrateDouble * 1.5 * overtimehoursDouble;
              //add in any sick time pay
              totalpayDouble = totalpayDouble + payrateDouble * sickleaveDouble;
              //add in any personal leave time pay
              totalpayDouble = totalpayDouble + payrateDouble * personalleaveDouble;
              return totalpayDouble;
    Entry Screen:
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.Applet;
    import javax.swing.*;
    import java.util.*;
    import java.text.*;
    //create entryscreen class as a java applet
    public class EntryScreen extends Applet implements ActionListener
         //declare all variables, labels, textfields, and buttons
    //store pay rate to variable payrateDouble
         double payrateDouble = 10.00;
         //store ssn and names to ssnString
         String[][] ssnString ={{"123121234", "234232345", "345343456", "456454567",
              "567565678", "678676789"},{"Jane Doe", "John Doe", "Sam Smith", "Tom Thumb", "Sara Jane", "Cindy Thompson"}};
         //set date format to MM/dd/yy and store in variable formatter
         SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yy");
         //store current date to variable date
         Date date = new Date();
         //using variable formatter store current date to dateString
         String dateString = formatter.format(date);
         //declare all label, Textfields and buttons use in the applet
         JLabel titleLabel;
    JLabel dateLabel;
    JTextField dateTextField;
    JLabel ssnLabel;
    JTextField ssnTextField;
    JLabel timeLabel;
    JLabel inLabel;
    JLabel outLabel;
    JTextField in1TextField;
    JTextField in2TextField;
    JTextField in3TextField;
         JTextField in4TextField;
         JTextField in5TextField;
    JTextField in6TextField;
    JTextField out1TextField;
    JTextField out2TextField;
    JTextField out3TextField;
    JTextField out4TextField;
    JTextField out5TextField;
    JTextField out6TextField;
    JLabel sickLabel;
    JTextField sickTextField;
    JTextField personalTextField;
    JLabel personalLabel;
    JButton okButton;
    JButton clearButton;
    JLabel day1Label;
    JLabel day2Label;
    JLabel day3Label;
    JLabel day4Label;
    JLabel day5Label;
    JLabel day6Label;
         //initialize the applet screen
    public void init()
              //create a custom layout object based on the EntryScreenLayout class
              EntryScreenLayout customLayout = new EntryScreenLayout();
              //set the font for the screen
    setFont(new Font("Helvetica", Font.PLAIN, 12));
    setLayout(customLayout);
         //populate the applet with the labels, textfields, and buttons
              titleLabel = new JLabel("Employee Payroll System");
    add(titleLabel);
    dateLabel = new JLabel("Date (MM/DD/YY):");
    add(dateLabel);
    dateTextField = new JTextField("");
    add(dateTextField);
              //set text in field to current date
              dateTextField.setText(dateString);
    ssnLabel = new JLabel("SSN (Numbers Only):");
    add(ssnLabel);
    ssnTextField = new JTextField("");
    add(ssnTextField);
    timeLabel = new JLabel("Hours Worked (hhmm)");
    add(timeLabel);
    inLabel = new JLabel("In:");
    add(inLabel);
    outLabel = new JLabel("Out");
    add(outLabel);
    in1TextField = new JTextField("");
    add(in1TextField);
    in2TextField = new JTextField("");
    add(in2TextField);
    in3TextField = new JTextField("");
    add(in3TextField);
    in4TextField = new JTextField("");
    add(in4TextField);
    in5TextField = new JTextField("");
    add(in5TextField);
    in6TextField = new JTextField("");
    add(in6TextField);
    out1TextField = new JTextField("");
    add(out1TextField);
    out2TextField = new JTextField("");
    add(out2TextField);
    out3TextField = new JTextField("");
    add(out3TextField);
    out4TextField = new JTextField("");
    add(out4TextField);
    out5TextField = new JTextField("");
    add(out5TextField);
    out6TextField = new JTextField("");
    add(out6TextField);
    sickLabel = new JLabel("Sick Leave Used:");
    add(sickLabel);
    sickTextField = new JTextField("");
    add(sickTextField);
    personalTextField = new JTextField("");
    add(personalTextField);
    personalLabel = new JLabel("Personal Leave Used:");
    add(personalLabel);
         okButton = new JButton("Ok");
         add(okButton);
              okButton.addActionListener(this);
         clearButton = new JButton("Clear");
         add(clearButton);
              clearButton.addActionListener(this);
         day1Label = new JLabel("Day 1:");
         add(day1Label);
         day2Label = new JLabel("Day 2:");
         add(day2Label);
    day3Label = new JLabel("Day 3:");
    add(day3Label);
    day4Label = new JLabel("Day 4:");
    add(day4Label);
    day5Label = new JLabel("Day 5:");
    add(day5Label);
    day6Label = new JLabel("Day 6:");
              add(day6Label);
              //set the size of the applet window as listed in the EntryScreenLayout class
              setSize(getPreferredSize());
         public void actionPerformed(ActionEvent e)
              //get the source object
              Object source = e.getSource();
              //perform if OK button was presses      
              if(source == okButton)
                   int[][] inouttimes = new int[1][5];
                   boolean matchBoolean = false;
                   boolean timeError = false;
                   int locationInt = 0;
                   double[] leavehours = new double[1];
                   String messageString = "";
                   //get the text from the ssnTextField and store to inputString
                   String inputString = ssnTextField.getText();
                   //check to see if inputString matches ssnString array
                   for(int i = 0; i < 6; ++i)
                        //if a match assign variables
                        if (inputString.equals(ssnString[0]))
                             matchBoolean = true;
                             locationInt = i;
                             break;
                        //if not a match
                        else
                             matchBoolean = false;
                   }//end for i
                   //if a SSN match is true than display the name, SSN, total hours, overtime hours, and total pay for hours worked.
                   if (matchBoolean == true)
                        //get the check in/out times, if blank assign a zero
                        Employee temp = new Employee();
                        temp.setName(ssnString[1][locationInt]);
                        temp.setSsn(ssnString[0][locationInt]);
                        temp.setPayRate(payrateDouble);
                        temp.setSickLeave(Double.parseDouble(sickTextField.getText()));
                        temp.setPersonalLeave(Double.parseDouble(personalTextField.getText()));
                        /*inouttimes[0][0] = Integer.parseInt(in1TextField.getText());
                        inouttimes[1][0] = Integer.parseInt(out1TextField.getText();
                        inouttimes[0][1] = Integer.parseInt(in2TextField.getText();
                        inouttimes[1][1] = Integer.parseInt(out2TextField.getText();
                        inouttimes[0][2] = Integer.parseInt(in3TextField.getText();
                        inouttimes[1][2] = Integer.parseInt(out3TextField.getText();
                        inouttimes[0][3] = Integer.parseInt(in4TextField.getText();
                        inouttimes[1][3] = out4TextField.getText();
                        inouttimes[0][4] = in5TextField.getText();
                        inouttimes[1][4] = out5TextField.getText();
                        inouttimes[0][5] = in6TextField.getText();
                        inouttimes[1][5] = out6TextField.getText();
                        for (int x = 0; x < 2; ++x)
                             for (int y = 0; y < 2; ++y)
                                  String temp = String.valueOf(inouttimes[x][y]);
                                  if (temp.equals(""))
                                       inouttimes[x][y] = 0;
                                  if (inouttimes[x][y] < 0 && inouttimes[x][y] > 2400)
                                       timeError = true;          
                                       break;
                             if (timeError = true)
                                  break;
                        messageString = temp.getName() + "\n" + temp.getSsn() + "\n" + temp.getTotalPay();
                   JOptionPane.showMessageDialog(null, messageString);
                   }//if (matchBoolean == true)
                   //if SSN match is false then display error message
                   else
                        JOptionPane.showMessageDialog(null, "There is no listing under that Social Security Number.\n" +
                             "Please verify and re-enter.");                    
              }//end if(source == okButton)
              //perform if the Clear button was pressed
              if(source == clearButton)
                   //clear all the textfields
                   dateTextField.setText("");
                   ssnTextField.setText("");
                   in1TextField.setText("");
                   out1TextField.setText("");
                   in2TextField.setText("");
                   out2TextField.setText("");
                   in3TextField.setText("");
                   out3TextField.setText("");
                   in4TextField.setText("");
                   out4TextField.setText("");
                   in5TextField.setText("");
                   out5TextField.setText("");
                   in6TextField.setText("");
                   out6TextField.setText("");
                   sickTextField.setText("");
                   personalTextField.setText("");
                   //set text in field to current date
                   dateTextField.setText(dateString);
         public static void main(String args[])
              //create new entryscreen object called applet
              EntryScreen applet = new EntryScreen();
         //create new frame for applet called window
              Frame window = new Frame("EntryScreen");
         window.addWindowListener(new WindowAdapter()
                   public void windowClosing(WindowEvent e)
                   //close the applet           
                        System.exit(0);
              //initiate the applet
              applet.init();
    window.add("Center", applet);
    window.pack();
    window.setVisible(true);
    //create entryscreenlayout custom class to position controls on applet screen
    class EntryScreenLayout implements LayoutManager {
    public EntryScreenLayout() {
    public void addLayoutComponent(String name, Component comp) {
    public void removeLayoutComponent(Component comp) {
    public Dimension preferredLayoutSize(Container parent) {
    Dimension dim = new Dimension(0, 0);
    Insets insets = parent.getInsets();
    dim.width = 360 + insets.left + insets.right;
    dim.height = 487 + insets.top + insets.bottom;
    return dim;
    public Dimension minimumLayoutSize(Container parent) {
    Dimension dim = new Dimension(0, 0);
    return dim;
    public void layoutContainer(Container parent) {
    Insets insets = parent.getInsets();
    Component c;
    c = parent.getComponent(0);
    if (c.isVisible()) {c.setBounds(insets.left+88,insets.top+8,192,24);}
    c = parent.getComponent(1);
    if (c.isVisible()) {c.setBounds(insets.left+24,insets.top+48,152,24);}
    c = parent.getComponent(2);
    if (c.isVisible()) {c.setBounds(insets.left+184,insets.top+48,152,24);}
    c = parent.getComponent(3);
    if (c.isVisible()) {c.setBounds(insets.left+24,insets.top+80,152,24);}
    c = parent.getComponent(4);
    if (c.isVisible()) {c.setBounds(insets.left+184,insets.top+80,152,24);}
    c = parent.getComponent(5);
    if (c.isVisible()) {c.setBounds(insets.left+104,insets.top+112,152,24);}
    c = parent.getComponent(6);
    if (c.isVisible()) {c.setBounds(insets.left+104,insets.top+144,72,24);}
    c = parent.getComponent(7);
    if (c.isVisible()) {c.setBounds(insets.left+184,insets.top+144,72,24);}
    c = parent.getComponent(8);
    if (c.isVisible()) {c.setBounds(insets.left+104,insets.top+176,72,24);}
    c = parent.getComponent(9);
    if (c.isVisible()) {c.setBounds(insets.left+104,insets.top+208,72,24);}
    c = parent.getComponent(10);
    if (c.isVisible()) {c.setBounds(insets.left+104,insets.top+240,72,24);}
    c = parent.getComponent(11);
    if (c.isVisible()) {c.setBounds(insets.left+104,insets.top+272,72,24);}
    c = parent.getComponent(12);
    if (c.isVisible()) {c.setBounds(insets.left+104,insets.top+304,72,24);}
    c = parent.getComponent(13);
    if (c.isVisible()) {c.setBounds(insets.left+104,insets.top+336,72,24);}
    c = parent.getComponent(14);
    if (c.isVisible()) {c.setBounds(insets.left+184,insets.top+176,72,24);}
    c = parent.getComponent(15);
    if (c.isVisible()) {c.setBounds(insets.left+184,insets.top+208,72,24);}
    c = parent.getComponent(16);
    if (c.isVisible()) {c.setBounds(insets.left+184,insets.top+240,72,24);}
    c = parent.getComponent(17);
    if (c.isVisible()) {c.setBounds(insets.left+184,insets.top+272,72,24);}
    c = parent.getComponent(18);
    if (c.isVisible()) {c.setBounds(insets.left+184,insets.top+304,72,24);}
    c = parent.getComponent(19);
    if (c.isVisible()) {c.setBounds(insets.left+184,insets.top+336,72,24);}
    c = parent.getComponent(20);
    if (c.isVisible()) {c.setBounds(insets.left+24,insets.top+368,152,24);}
    c = parent.getComponent(21);
    if (c.isVisible()) {c.setBounds(insets.left+184,insets.top+368,72,24);}
    c = parent.getComponent(22);
    if (c.isVisible()) {c.setBounds(insets.left+184,insets.top+400,72,24);}
    c = parent.getComponent(23);
    if (c.isVisible()) {c.setBounds(insets.left+24,insets.top+400,152,24);}
    c = parent.getComponent(24);
    if (c.isVisible()) {c.setBounds(insets.left+104,insets.top+440,72,24);}
    c = parent.getComponent(25);
    if (c.isVisible()) {c.setBounds(insets.left+184,insets.top+440,72,24);}
    c = parent.getComponent(26);
    if (c.isVisible()) {c.setBounds(insets.left+24,insets.top+176,72,24);}
    c = parent.getComponent(27);
    if (c.isVisible()) {c.setBounds(insets.left+24,insets.top+208,72,24);}
    c = parent.getComponent(28);
    if (c.isVisible()) {c.setBounds(insets.left+24,insets.top+240,72,24);}
    c = parent.getComponent(29);
    if (c.isVisible()) {c.setBounds(insets.left+24,insets.top+272,72,24);}
    c = parent.getComponent(30);
    if (c.isVisible()) {c.setBounds(insets.left+24,insets.top+304,72,24);}
    c = parent.getComponent(31);
    if (c.isVisible()) {c.setBounds(insets.left+24,insets.top+336,72,24);}
    I know it is a lot of code, but I am just starting and couldn't think of an easier way to do this.
    Thank you for any help - it is greatly appreciated. You can email me with any code help - [email protected].
    Steph

    My 2 cents, I dunno what it'll be worth.
    I think you should never convert anything until the final moment that you are at actually getting the int or float number of hours.
    Why are you doing all this Gregorian and conversion gymnastics throughout your calculations?
    To get the current time in milliseconds, use either
    java.util.Date d = new java.util.Date();
    or
    long d = System.currentTimeMillis();
    Use this long number for all your calculations, and only at the end convert it. To convert, you can use java.text.SimpleDateFormat, which I find very straightforward to use. I honestly think you should never convert your dates before doing any calculations, only after doing them, otherwise you'll loose precision and make errors for sure.

  • I have a calculation in a5 and need the answer rounding up to the next whole number

    I have a calculation in cell a5 and need the answer rounding up to the next whole number

    Hi,
    I am using numbers
    A1 x A2 = A3       A4 is A3 divided by 2.88.  Indeed to round up the answer in A4 to the next whole number
    Eg 4.5 x 3.7 = 16.6 sq meters as an area , divided by 2.88 ( area of 1 board) = 5.78 boards so I need to buy 6 and quote for 6
    Cheers

  • Calculation of Tax Amount in FB60

    Hi Guru's,
    Here Tax Procedure is TAXINN in which I have maintain Tax Code V9 as 14.42% (EXCISE+CESS) + 12.5% (VAT) in FV11. So while doing MIRO I select V9 Tax code then automatically Tax amount is calculated.
    My question is can same can done in FB60. Means can Tax amount can automatically calculated in FB60 when I selecting V9 as Tax Code which was calculated in MIRO.
    I needed for transaction without Purchase Order.
    Right answer will be rewarded.
    Regards
    Amit

    Thnks for reply.
    I have already done the customization in OB40 but when i do invoice posting in FB60 then error shows "Tax Code V9 does not exist in TAXINN".
    But since in MIRO same Tax code get posted with same vendor.
    Pls help me.
    Regards

  • [Forum FAQ] How do I create calculated measure using AMO in SQL Server Analysis Services?

    Introduction
    In SQL Server Analysis Services (SSAS), you can create a calculated measure in SQL Server Data Tool (SSDT)/Boniness Integrated Development Studio (BIDS). Sometimes you may need to create calculated measure by using AMO in a C# or VB project.
    In this article, I will demonstrate so how to create calculated measure using AMO in SSAS?
    Prerequisites
    Before create calculated measure using AMO, you need to ensure that the following components were installed in your server.
    The multidimensional database AdventureWorks Multidimensional Model 2012
    A SQL Server with SSIS and SSAS installed
    The AMO libraries installed:
    X86 Package (SQL_AS_AMO.msi)
    X64 Package (SQL_AS_AMO.msi)
    Solution
    Here is the detail steps to create calculated measure using AMO in SSAS.
    Open SSDT and create a new SSIS project.
    Drag Script Task to the design surface.
    Click SSIS-> Variables to open the Variables window and add two variables that used to connect to the server and database.
    Create a connection to connect to SSAS server.
    Rename the connection name to ssas.
    Double click the Script Task to open Script Task Editor.
    Add Connection and Database variables to ReadWriteVariables textbox and then click Edit Script button.
    Add AMO reference in the Solution Explore window.
    Copy the script below and paste it into the script.
    Dim objServer As Server
    Dim objDatabase As Database
    Dim strDataBaseID As String
    Dim objCube As Cube
    Dim objMdxScript As MdxScript
    Dim objCommand As Command
    Dim strCommand As String
    objServer = New Server
    objServer.Connect("localhost")
    objDatabase = objServer.Databases("AdventureWorksDW2012Multidimensional-EE2")
    strDataBaseID = objDatabase.ID
    If objDatabase.Cubes.Count > 0 Then
    objCube = objDatabase.Cubes("Adventure Works")
    If objCube.MdxScripts.Count > 0 Then
    objMdxScript = objCube.MdxScripts("MdxScript")
    objMdxScript = objCube.MdxScripts(0)
    Else
    objCube.MdxScripts.Add("MdxScript", "MdxScript")
    objMdxScript = objCube.MdxScripts("MdxScript")
    End If
    objCommand = New Command
    strCommand = "CREATE MEMBER CURRENTCUBE.[Measures].[Multipy Measures By 3]"
    strCommand = strCommand & " AS [Measures].[Internet Sales Amount] * 3, "
    strCommand = strCommand & " VISIBLE = 1 ; "
    objCommand.Text = strCommand
    objMdxScript.Commands.Add(objCommand)
    objMdxScript.Update()
    objCube.Update()
    End If
    objServer.Disconnect()
    Then you can run this SSIS package to create the calculated measure.
    Applies to
    Microsoft SQL Server 2005
    Microsoft SQL Server 2008
    Microsoft SQL Server 2008 R2
    Microsoft SQL Server 2012
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    Thanks,
    Is this a supported scenario, or does it use unsupported features?
    For example, can we call exec [ReportServer].dbo.AddEvent @EventType='TimedSubscription', @EventData='b64ce7ec-d598-45cd-bbc2-ea202e0c129d'
    in a supported way?
    Thanks! Josh

  • Discoverer need a long time to open a workbook

    Hi,
    we have 2 workbooks with over 60 calculations/workbook
    and the discoverer need over 2 min to open the parameter window.
    looks that the discoverer check all calculations if they are valid or not before display the parameter window.
    we had no problems with this 2 workbooks until our DBA's move our DB-Server to a other destination. (time for open 25 sec/workbook)
    now, the network to the new destination is not so fast like the old one.
    a trace gave us the follow information.
    the discoverer send round 50,000 small packages to the DB
    to the old Destination: 1ms/package
    to the new Destination: 10ms/package
    is there a way to disable the check function (Registry?) or know anyone what do the discoverer between "open workbook" and display the parameter window?
    This 2 Workbooks are our most used query's in the company.
    I would greatly appreciate any suggestion you may have which can help in addressing this issue.
    Thanks,
    Maurice

    Maurice,
    Have you discussed this issue with your network administrator? Another place is to check with the DBA if the new DB lacation's storage and memory. To tune the discoverer report itself, you may try to create a materilized view, or have a custom folder for each workbook.

  • How to change the column value which is coming from DO by a calculated field?

    Hi all,
    I want to change a column value based on my calculated field value. I have a column which is coming from DO which is based on External Data Source. I have a calculated field in my report. When there is any change in the calculated field then the column which is coming from DO needs to be changed. It means the DO needs to get updated when there is a change in the calculated field. Or like if the calculated field meets some condition then I need to change/update the same in the DO. This has to be done on the fly. the report should not submitted for this. when there is a change in the calculated column the DO column needs to get updated.
    Thanks,
    Venky.

    Ok, I've been a customer for very many years, I'm on a fixed retirement
    income.  I need to reduce my bills, my contract ends in  Dec. I will be
    pursuing other options unless I can get some concessions from Verizon.  My
    future son-in-law was given this loyalty plan, so I know this is a
    reasonable request.  My phone number is (removed)  acct number
    (removed)
    >> Personal information removed to comply with the Verizon Wireless Terms of Service <<
    Edited by:  Verizon Moderator

  • Calculation of Fed and State Taxes for one time payment wage type in US Payroll

    Hi SAP Py Gurus,
    I'm new to US taxes.
    Configured a Tuition Reimb WT 1245 for IT 15, need to Test it now to check how and Fed Tax,State Tax is calculated on this Wage type,
    need to check where this can be located in payroll log in simulation run.
    Can you please explain the calculation step by step.
    Thanks,
    Diya

    Just came back from vacation and saw your thread (which should have been posted in the HRP HCM Payroll North America forum).  We applied SAPKE60061 in late November and the Canadian YE Note in mid-December and didn't come across that problem, but then again we don't have any Quebec employees.
    What version are you on ?
    What HRSP did you apply ?

  • Need help fine tuning my code

    This program im making is eventualy going to end up as an attack calculator; the thing is i need help finetuning my program so that a) when it is run it will start at the very top of the window ancestory. b) the 2 windows are locked onto the same ancestory (ancestory is the position of the window relitive to the others: ie the window that is on top of another is higher on the ancestory). this code runs and should easily cut and paste.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class AttackCalculator implements ActionListener{
         * Create the GUI and show it.  For thread safety,
         * this method should be invoked from the
         * event-dispatching thread.
         "Use the legend below for the correct government number. ",
          "Legend: Democracy = 1, Communism = 2, Autocracy = 3, Fascism = 4, ",
          "Monarchy = 5, Pacifism = 6, Technocracy = 7, Theocracy = 8, ",
          "Anarchy = 9, Corpocracy = 10, Ochlocracy = 11, Physiocracy = 12 ",
           public static void createAndShowGUI(){
           String[] labels = {
          "Enter how many troops you have: ", "Enter how many tanks you have: ",
          "Enter how many jets you have: ", "Enter how many ships you have: ",
          "Enter your government type (1-12 refer above): ","Enter your health(%)",
          "Enter your stage number (1-4): ", "Enter how many troops your enemy has: ",
          "Enter how many tanks your enemy has: ", "Enter how many jets your enemy has: ",
          "Enter how many ships your enemy has: ", "Enter your enemy's government type (1-12 refer above): ",
          "Enter your enemy's stage number (1-4): ", "Enter your enemy health: "};
            int numPairs = labels.length;
           JTextField[] textField = {
           new JTextField( 10 ), new JTextField( 1 ), new JTextField( 1 ), new JTextField( 1 ), new JTextField( 1 ),
           new JTextField( 1 ), new JTextField( 10 ), new JTextField( 1 ), new JTextField( 1 ), new JTextField( 1 ),
           new JTextField( 1 ), new JTextField( 1 ), new JTextField( 1 ), new JTextField( 1 )};
            //Create and populate the panel.
            JPanel p = new JPanel(new SpringLayout());
            for (int i = 0; i < numPairs; i++) {
                JLabel l = new JLabel(labels, JLabel.TRAILING);
    p.add(l);
    l.setLabelFor(textField[i]);
    p.add(textField[i]);
    JLabel l = new JLabel("Your union has 2+ members", JLabel.TRAILING);
    p.add(l);
    JCheckBox checkBox = new JCheckBox("", false);
    l.setLabelFor( checkBox );
    p.add(checkBox );
    JLabel la = new JLabel("Enemy's union 2+ members", JLabel.TRAILING);
    p.add(la);
    JCheckBox jcheckBox = new JCheckBox("", false);
    la.setLabelFor( jcheckBox );
    p.add(jcheckBox);
    JButton calculate = new JButton("Calculate");
    p.add(calculate);
    //Lay out the panel.
    SpringUtilities.makeCompactGrid(p,
    16, 2, //rows, cols
    6, 6, //initX, initY
    6, 6); //xPad, yPad
    JFrame contentPane = new JFrame();
    contentPane.setSize(420, 105);
    JLabel title1 = new JLabel("Use the legend below for the correct government number. \n");
    JLabel title2 = new JLabel("Legend: Democracy = 1, Communism = 2, Autocracy = 3, Fascism = 4, \n");
    JLabel title3 = new JLabel("Monarchy = 5, Pacifism = 6, Technocracy = 7, Theocracy = 8, \n");
    JLabel title4 = new JLabel("Anarchy = 9, Corpocracy = 10, Ochlocracy = 11, Physiocracy = 12 " );
    contentPane.add( title1 );
    contentPane.add( title2 );
    contentPane.add( title3 );
    contentPane.add( title4 );
    SpringLayout layout = new SpringLayout();
    contentPane.setLayout(layout);
    //Adjust constraints for the label so it's at (5,5).
    layout.putConstraint(SpringLayout.WEST, title1,
    5,
    SpringLayout.WEST, contentPane);
    layout.putConstraint(SpringLayout.NORTH, title1,
    5,
    SpringLayout.NORTH, contentPane);
    //Adjust constraints for the label so it's at (5,5).
    layout.putConstraint(SpringLayout.WEST, title2,
    5,
    SpringLayout.WEST, contentPane);
    layout.putConstraint(SpringLayout.NORTH, title2,
    20,
    SpringLayout.NORTH, contentPane);
    //Adjust constraints for the label so it's at (5,5).
    layout.putConstraint(SpringLayout.WEST, title3,
    5,
    SpringLayout.WEST, contentPane);
    layout.putConstraint(SpringLayout.NORTH, title3,
    35,
    SpringLayout.NORTH, contentPane);
    //Adjust constraints for the label so it's at (5,5).
    layout.putConstraint(SpringLayout.WEST, title4,
    5,
    SpringLayout.WEST, contentPane);
    layout.putConstraint(SpringLayout.NORTH, title4,
    50,
    SpringLayout.NORTH, contentPane);
    //Create and set up the window.
    JFrame frame1 = new JFrame("Endless Revolution Attack Calculator");
    frame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    //Make sure we have nice window decorations.
    JFrame.setDefaultLookAndFeelDecorated(true);
    //Set up the content pane.
    p.setOpaque(true); //content panes must be opaque
    frame1.setContentPane(p);
    //Display the window.
    frame1.pack();
    frame1.setLocationRelativeTo( null );
    frame1.setVisible(true);
    contentPane.setLocationRelativeTo( null );
    contentPane.setVisible(true);
    public void actionPerformed( ActionEvent evt){
    public static void main(String[] args) {
    //Schedule a job for the event-dispatching thread:
    //creating and showing this application's GUI.
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    createAndShowGUI();
    here is the second class needed to run
    import javax.swing.*;
    import javax.swing.SpringLayout;
    import java.awt.*;
    * A 1.4 file that provides utility methods for
    * creating form- or grid-style layouts with SpringLayout.
    * These utilities are used by several programs, such as
    * SpringBox and SpringCompactGrid.
    public class SpringUtilities {
         * A debugging utility that prints to stdout the component's
         * minimum, preferred, and maximum sizes.
        public static void printSizes(Component c) {
            System.out.println("minimumSize = " + c.getMinimumSize());
            System.out.println("preferredSize = " + c.getPreferredSize());
            System.out.println("maximumSize = " + c.getMaximumSize());
         * Aligns the first <code>rows</code> * <code>cols</code>
         * components of <code>parent</code> in
         * a grid. Each component is as big as the maximum
         * preferred width and height of the components.
         * The parent is made just big enough to fit them all.
         * @param rows number of rows
         * @param cols number of columns
         * @param initialX x location to start the grid at
         * @param initialY y location to start the grid at
         * @param xPad x padding between cells
         * @param yPad y padding between cells
        public static void makeGrid(Container parent,
                                    int rows, int cols,
                                    int initialX, int initialY,
                                    int xPad, int yPad) {
            SpringLayout layout;
            try {
                layout = (SpringLayout)parent.getLayout();
            } catch (ClassCastException exc) {
                System.err.println("The first argument to makeGrid must use SpringLayout.");
                return;
            Spring xPadSpring = Spring.constant(xPad);
            Spring yPadSpring = Spring.constant(yPad);
            Spring initialXSpring = Spring.constant(initialX);
            Spring initialYSpring = Spring.constant(initialY);
            int max = rows * cols;
            //Calculate Springs that are the max of the width/height so that all
            //cells have the same size.
            Spring maxWidthSpring = layout.getConstraints(parent.getComponent(0)).
                                        getWidth();
            Spring maxHeightSpring = layout.getConstraints(parent.getComponent(0)).
                                        getWidth();
            for (int i = 1; i < max; i++) {
                SpringLayout.Constraints cons = layout.getConstraints(
                                                parent.getComponent(i));
                maxWidthSpring = Spring.max(maxWidthSpring, cons.getWidth());
                maxHeightSpring = Spring.max(maxHeightSpring, cons.getHeight());
            //Apply the new width/height Spring. This forces all the
            //components to have the same size.
            for (int i = 0; i < max; i++) {
                SpringLayout.Constraints cons = layout.getConstraints(
                                                parent.getComponent(i));
                cons.setWidth(maxWidthSpring);
                cons.setHeight(maxHeightSpring);
            //Then adjust the x/y constraints of all the cells so that they
            //are aligned in a grid.
            SpringLayout.Constraints lastCons = null;
            SpringLayout.Constraints lastRowCons = null;
            for (int i = 0; i < max; i++) {
                SpringLayout.Constraints cons = layout.getConstraints(
                                                     parent.getComponent(i));
                if (i % cols == 0) { //start of new row
                    lastRowCons = lastCons;
                    cons.setX(initialXSpring);
                } else { //x position depends on previous component
                    cons.setX(Spring.sum(lastCons.getConstraint(SpringLayout.EAST),
                                         xPadSpring));
                if (i / cols == 0) { //first row
                    cons.setY(initialYSpring);
                } else { //y position depends on previous row
                    cons.setY(Spring.sum(lastRowCons.getConstraint(SpringLayout.SOUTH),
                                         yPadSpring));
                lastCons = cons;
            //Set the parent's size.
            SpringLayout.Constraints pCons = layout.getConstraints(parent);
            pCons.setConstraint(SpringLayout.SOUTH,
                                Spring.sum(
                                    Spring.constant(yPad),
                                    lastCons.getConstraint(SpringLayout.SOUTH)));
            pCons.setConstraint(SpringLayout.EAST,
                                Spring.sum(
                                    Spring.constant(xPad),
                                    lastCons.getConstraint(SpringLayout.EAST)));
        /* Used by makeCompactGrid. */
        private static SpringLayout.Constraints getConstraintsForCell(
                                                    int row, int col,
                                                    Container parent,
                                                    int cols) {
            SpringLayout layout = (SpringLayout) parent.getLayout();
            Component c = parent.getComponent(row * cols + col);
            return layout.getConstraints(c);
         * Aligns the first <code>rows</code> * <code>cols</code>
         * components of <code>parent</code> in
         * a grid. Each component in a column is as wide as the maximum
         * preferred width of the components in that column;
         * height is similarly determined for each row.
         * The parent is made just big enough to fit them all.
         * @param rows number of rows
         * @param cols number of columns
         * @param initialX x location to start the grid at
         * @param initialY y location to start the grid at
         * @param xPad x padding between cells
         * @param yPad y padding between cells
        public static void makeCompactGrid(Container parent,
                                           int rows, int cols,
                                           int initialX, int initialY,
                                           int xPad, int yPad) {
            SpringLayout layout;
            try {
                layout = (SpringLayout)parent.getLayout();
            } catch (ClassCastException exc) {
                System.err.println("The first argument to makeCompactGrid must use SpringLayout.");
                return;
            //Align all cells in each column and make them the same width.
            Spring x = Spring.constant(initialX);
            for (int c = 0; c < cols; c++) {
                Spring width = Spring.constant(0);
                for (int r = 0; r < rows; r++) {
                    width = Spring.max(width,
                                       getConstraintsForCell(r, c, parent, cols).
                                           getWidth());
                for (int r = 0; r < rows; r++) {
                    SpringLayout.Constraints constraints =
                            getConstraintsForCell(r, c, parent, cols);
                    constraints.setX(x);
                    constraints.setWidth(width);
                x = Spring.sum(x, Spring.sum(width, Spring.constant(xPad)));
            //Align all cells in each row and make them the same height.
            Spring y = Spring.constant(initialY);
            for (int r = 0; r < rows; r++) {
                Spring height = Spring.constant(0);
                for (int c = 0; c < cols; c++) {
                    height = Spring.max(height,
                                        getConstraintsForCell(r, c, parent, cols).
                                            getHeight());
                for (int c = 0; c < cols; c++) {
                    SpringLayout.Constraints constraints =
                            getConstraintsForCell(r, c, parent, cols);
                    constraints.setY(y);
                    constraints.setHeight(height);
                y = Spring.sum(y, Spring.sum(height, Spring.constant(yPad)));
            //Set the parent's size.
            SpringLayout.Constraints pCons = layout.getConstraints(parent);
            pCons.setConstraint(SpringLayout.SOUTH, y);
            pCons.setConstraint(SpringLayout.EAST, x);
    }I know this is a lot but when I have tried to put out the portion where I belived the problem to be, didnt work, people couldent help, so here it is all of it.

    it wouldn't run for me, until I changed these lines
    contentPane.add( title1 );
    contentPane.add( title2 );
    contentPane.add( title3 );
    contentPane.add( title4 );
    SpringLayout layout = new SpringLayout();
    contentPane.setLayout(layout);
    to these
    contentPane.getContentPane().add( title1 );
    contentPane.getContentPane().add( title2 );
    contentPane.getContentPane().add( title3 );
    contentPane.getContentPane().add( title4 );
    SpringLayout layout = new SpringLayout();
    contentPane.getContentPane().setLayout(layout);
    then it worked OK, smaller frame on top (the one with the info), larger frame behind.
    both above all other windows
    made it into a .jar file (in case IDE influenced above) and ran the same way

  • Date and Time calculation in the Service Module

    Dear all,
    I have quite of a challenge here and i need serious guidance from your side.
    My client is in services industry and requires to calculate the date and time when the service call as to be closed. Not only it depends on the contract type the service is linked to but as well on the priority.
    The priority in Business One is unique, therefore we created a UDT (User Defined Table) to store the different 'response time' per contract/per priority. Example: a Platinum contract is always 24/7. But a gold contract priority 1 has to be closed in 240 minutes (4 workable hours) while a gold contract priority 2 has to be closed in 480 minutes (8 workable hours).
    I created 7 user defined fields on the Service Contract header that calculates the workable minutes per day. So if my coverage for Monday is from 8 AM to 4 PM, my UDF called DiffMon will show 480. For Tuesday, they start a bit later, and the coverage is 8:30 untill 16:00, therefore my UDF called DiffTue = 450.If the check box before the day in the Service Contract window is not ticked, then the UDF shows zero.
    I succeeded to calculate the expected closing time by using CASE WHEN statements as following, (all calculated in minutes):
         First, I need to check which day the Service call is created: A Monday or Thursday or... since my time coverage can change every day! I use SET DATEFIRST = 1 and compare today's date accordingly with my UDF DiffMon, DiffTue, etc.
         Then, When end of coverage time today Monday (4PM) minus the create time on the Service Call (1PM) is less then the time stored in my user defined table for that contract and that priority (i.e.480), then just add that to the create time and the create date (DateAdd(mi,...,...) ).
        When end of coverage time Monday (4PM) - Create time (1PM) + DiffTue(450) is bigger than 480, then I know I have enough time to solve my service call tomorrow Tuesday and I take the start time of Tuesday (8:30) + remaining time from yesterday (480-180 -> 180 = 3hours from 1PM to 4PM) and add that to the Create date + 1 so the end result will show Tuesday date and a time of 13:30
       Etc. untill I cover all possibilities based on which day is the service call created.
    NOW, I need to include the holiday table !!!!!!!!!!  And I can't foresee how the hell I am going to do that.
    The maximum coverage can go up to 60 hours, that means more than a working week! What happens if I have more than one bank holiday in that week period? What happens when my holiday table tells me that  date is a bank holiday but it is actually a Sunday and my contract is only running from Monday to Friday?
    Am I going straight to a big mess up?
    I will highly appreciate your comments,
    Regards,
    Frederic

    Hi,
    it is possible in query designer,
    u do the two things for getting the days between to dates
    1) in CMOD write the code for sy-datum create a customer exit variable in query as on caldate like eg zcedate
    when 'zcedate'.
    clear l_s_range.
    l_s_range-sign = 'i'.
    l_s_range-opt = 'eq'.
    l_s_range-low = sy-datum.
    append l_s_range to e_t_range.
    u write this code exit_saplrrso_001.
    it givs the sydatum
    2) then u create one more variable on zdate limit with replacement path
    then u go forto create the formula variable then it display ascreen there u select both customer exit variable and replacement path variable
    zcedate-replacementpathvariable
    it gives days i worked on this and succedded.
    like the same way fortime also u can do but here at the time of creating the customer exit varible u go for option as range here
    l_s_range-low = '20012009'
    l_s_range-high = '29012009'
    l_s_range-sign ='i'.
    l_s_range-opt = 'bt'.
    please try with the above one.
    Thanks & rEgards,
    k.sathish

  • Need help - I2C write/read with TAOS TCS3414 light sensor using USB-8451

    Hello, I'm new to labview and need help setting up a vi that will allow me to communicate with a digital light sensor (TAOS TCS3414) using a USB-8451. I need to use the sensor to measure light from a light source that I designed and built as part of a project im working on. I've tried looking at several labview I2C exampled but find them to be very confusing. I've used an arduino to interface with the sensor successfully but need to use labview and dont understand how to write the program. The actions are simple; I need initialize the sensor with a simple command and then request data from 8 data registers and then read that data. The data will then be used in further calculations. The portion i need help with is writing and reading from the sensor. I've attached the datasheet for the sensor as a guide. I can also provide the arduino code that i use to read data from the sensor if that would help. 
    Pleae keep in mind that i am completely new to labVIEW. I really do want to learn from this but need quick results so the more help the better. It would greately appreciate any help or explaination. 
    Attachments:
    TCS3414_Datasheet_EN_v1.pdf ‏1806 KB

    Hi Aaron,
    Here you go, this is made with a USB-8452.
    When you run the code tick the power en dac enable box on.
    Maybe you can help me with my problem, I want to use a fiber to sense light from a led.
    Do you use any fiber hardware with the TCS3414?
    gr,
    Attachments:
    TCS3414.vi ‏63 KB

  • How do I add a Message Box if calculations don't match?

    I am developing a form where the user inputs an amount on field Amt, then distributes that amount into up to six "funds" fields (Budget1, Budget2, Budget3...), which determine where the money will come from. I created a screen-only verification field (AmtVerif) that allows the user to see if the divided funds add up to the total shown on Amt.
    I want AmtVerif to:
    1. add up the amounts on fields Budget 1-6 (which I managed to do using FormCalc)
    2. match the total with the entered value on Amt
    3. pop-up an error message that says "You went over the total", or "Please verify the allocation of funds" in case totals don't match.
    I tried using "if" expressions with FormCalc in the Validate and Exit Events, and although they seem to be correct, they do not show the error message. What am I doing wrong? Please help!
    Debora

    Hi Raghu,
    Thank you for responding!  I just re-created my fields in the same form you attached, so now you can see exactly what I did.
    The last field (AmtVerify) contains the calculation piece, but now I need to match that total with the amount on the first field, and enable the error messages in case it goes above or below the original amount.
    Debora.

  • How do you get a fillable pdf to perform a new calculation if data is changed on form

    I have created a form to calculate payment terms. The forms work great however if you make a mistake inputting or change data after calculation has been preformed i need the new data to be calculated. Is there a way to do this?
    thanks

    Hi Gilad,
    Thank you for the information. Unfortunately the form that I built does not provide the correct number if any data is changed.
    Is there something that I am missing?
    I am using the form to complete and installment loan contract
    Thanks again

Maybe you are looking for