text
stringlengths
10
2.72M
package com.sanjaychawla.android.sensorapplication.callback; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; public interface MapChangeOnDataFetchCallback { void onDataFetchCallback(MapboxMap mapboxMap, GeoJsonSource source); }
/* * Created on 15-feb-2005 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */ package es.ucm.fdi.si.controlador; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import es.ucm.fdi.si.ICase; /** * @author usuario * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class IntroducirNombre extends JPanel { private int contador; /** Es Diseño o Contenido y nos sirve para ponerlo en el nombre */ private String tipo; private JLabel etiquetaNombre; private JTextField entradaNombre; /** Nos dice si se pulsó aceptar (true) o cancelar (false) al salir */ private boolean salida; public IntroducirNombre(String tipo, ICase fachada){ JButton botonOk, botonCancel; etiquetaNombre = new JLabel("Nombre"); if (tipo.equals("Diseño")){ entradaNombre = new JTextField("elemento_" + fachada.getNumElementosDiseño()); }else if (tipo.equals("Contenido")){ entradaNombre = new JTextField("elemento_" + fachada.getNumElementosContenido()); } this.tipo=tipo; contador = 0; salida=false; GridLayout celda = new GridLayout(2,2); setLayout(celda); add(etiquetaNombre); add(entradaNombre); setSize(200, 100); } public void mostrar() { this.setVisible(true); entradaNombre.setText("Elemento "+tipo+" "+contador); } public String getNombre() { return entradaNombre.getText(); } public boolean getSalida(){ return salida; } private class ControladorAceptar implements ActionListener { IntroducirNombre dialogo; public ControladorAceptar(IntroducirNombre dialogo) { this.dialogo=dialogo; } /* (non-Javadoc) * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) */ public void actionPerformed(ActionEvent arg0) { dialogo.setVisible(false); dialogo.salida=true; contador++; } } private class ControladorCancelar implements ActionListener { IntroducirNombre dialogo; public ControladorCancelar(IntroducirNombre dialogo) { this.dialogo=dialogo; } /* (non-Javadoc) * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) */ public void actionPerformed(ActionEvent arg0) { dialogo.setVisible(false); dialogo.salida=false; } } }
/* * Copyright © 2019 The GWT Project Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.gwtproject.dom.builder.shared; import org.gwtproject.dom.builder.client.DomBuilderFactory; /** * Factory for creating element builders. * * <p>Use {@link ElementBuilderFactory#get()} to fetch the builder factory optimized for the browser * platform. * * <p>If you are using the builder on a server, use {@link HtmlBuilderFactory#get()} instead. {@link * HtmlBuilderFactory} can construct a {@link org.gwtproject.safehtml.shared.SafeHtml} string and * will work on the server. Other implementations may only work on a browser client. * * <p>Element builder methods can be chained together as with a traditional builder: * * <pre> * // * // Create a builder for the outermost element. The initial state of the * // builder is a started element ready for attributes (eg. "&lt;div"). * // * DivBuilder divBuilder = ElementBuilderFactory.get().createDivBuilder(); * * // * // Build the element. * // * // First, we set the element's id to "myId", then set its title to * // "This is a div". Next, we set the background-color style property to * // "red". Finally, we set some inner text to "Hello World!". When we are * // finished, we end the div. * // * // When building elements, the order of methods matters. Attributes and * // style properties must be added before setting inner html/text or * // appending children. This is because the string implementation cannot * // concatenate an attribute after child content has been added. * // * // Note that endStyle() takes the builder type that we want to return, which * // must be the "parent" builder. endDiv() does not need the optional * // argument because we are finished building the element. * // * divBuilder.id("myId").title("This is a div"); * divBuilder.style().trustedBackgroundColor("red").endStyle(); * divBuilder.text("Hello World!").endDiv(); * * // Get the element out of the builder. * Element div = divBuilder.finish(); * * // Attach the element to the page. * Document.get().getBody().appendChild(div); * </pre> * * <p>Alternatively, builders can be used as separate objects and operated on individually. This may * be the preferred method if you are creating a complex or dynamic element. The code below produces * the same output as the code above. * * <pre> * // * // Create a builder for the outermost element. The initial state of the * // builder is a started element ready for attributes (eg. "&lt;div"). * // * DivBuilder divBuilder = ElementBuilderFactory.get().createDivBuilder(); * * // Add attributes to the div. * divBuilder.id("myId"); * divBuilder.title("This is a div"); * * // Add style properties to the div. * StylesBuilder divStyle = divBuilder.style(); * divStyle.trustedBackgroundColor("red"); * divStyle.endStyle(); * * // Append a child select element to the div. * SelectBuilder selectBuilder = divBuilder.startSelect(); * * // Append three options to the select element. * for (int i = 0; i &lt; 3; i++) { * OptionBuilder optionBuilder = selectBuilder.startOption(); * optionBuilder.value("value" + i); * optionBuilder.text("Option " + i); * optionBuilder.endOption(); * } * * // * // End the select and div elements. Note that ending the remaining elements * // before calling asElement() below is optional, but a good practice. If we * // did not call endOption() above, we would append each option element to * // the preceding option element, which is not what we want. * // * // In general, you must pay close attention to ensure that you close * // elements correctly. * // * selectBuilder.endSelect(); * divBuilder.endDiv(); * * // Get the element out of the builder. * Element div = divBuilder.finish(); * * // Attach the element to the page. * Document.get().getBody().appendChild(div); * </pre> * * <p>You can also mix chaining and non-chaining methods when appropriate. For example, you can add * attributes to an element by chaining methods, but use a separate builder object for each separate * element. * * <p>NOTE: Builders always operate on the current element. For example, in the code below, we * create two divBuilders, one a child of the other. However, they are actually the same builder * instance! Implementations of ElementBuilderFactory use a single instance of each builder type to * improve performance. The implication is that all element builders operate on the current element, * so the call to <code>divBuilder0.id("div1")</code> will set the "id" of the child div, and is * functionally equivalent to <code>divBuilder1.id("div1")</code>. Its important to always call * end() before resuming work on the previous element builder. * * <pre> * DivBuilder divBuilder0 = ElementBuilderFactory.get().createDivBuilder(); * DivBuilder divBuilder1 = divBuilder0.startDiv(); * divBuilder0.id("div1"); // Operates on the first element! * </pre> */ public abstract class ElementBuilderFactory { private static ElementBuilderFactory instance; /** * Get the instance of the {@link ElementBuilderFactory}. * * @return the {@link ElementBuilderFactory} */ public static ElementBuilderFactory get() { if (instance == null) { if ("safari".equals(System.getProperty("user.agent"))) { // The old GWT module was configured to only allow "safari" user agent to manipulate the dom // directly instance = DomBuilderFactory.get(); } else { // All other browsers (and the JVM itself) get the string-based implementation instance = HtmlBuilderFactory.get(); } } return instance; } /** Created from static factory method. */ protected ElementBuilderFactory() {} public abstract AnchorBuilder createAnchorBuilder(); public abstract AreaBuilder createAreaBuilder(); public abstract AudioBuilder createAudioBuilder(); public abstract BaseBuilder createBaseBuilder(); public abstract QuoteBuilder createBlockQuoteBuilder(); public abstract BodyBuilder createBodyBuilder(); public abstract BRBuilder createBRBuilder(); public abstract InputBuilder createButtonInputBuilder(); public abstract CanvasBuilder createCanvasBuilder(); public abstract InputBuilder createCheckboxInputBuilder(); public abstract TableColBuilder createColBuilder(); public abstract TableColBuilder createColGroupBuilder(); public abstract DivBuilder createDivBuilder(); public abstract DListBuilder createDListBuilder(); public abstract FieldSetBuilder createFieldSetBuilder(); public abstract InputBuilder createFileInputBuilder(); public abstract FormBuilder createFormBuilder(); public abstract FrameBuilder createFrameBuilder(); public abstract FrameSetBuilder createFrameSetBuilder(); public abstract HeadingBuilder createH1Builder(); public abstract HeadingBuilder createH2Builder(); public abstract HeadingBuilder createH3Builder(); public abstract HeadingBuilder createH4Builder(); public abstract HeadingBuilder createH5Builder(); public abstract HeadingBuilder createH6Builder(); public abstract HeadBuilder createHeadBuilder(); public abstract InputBuilder createHiddenInputBuilder(); public abstract HRBuilder createHRBuilder(); public abstract IFrameBuilder createIFrameBuilder(); public abstract ImageBuilder createImageBuilder(); public abstract InputBuilder createImageInputBuilder(); public abstract LabelBuilder createLabelBuilder(); public abstract LegendBuilder createLegendBuilder(); public abstract LIBuilder createLIBuilder(); public abstract LinkBuilder createLinkBuilder(); public abstract MapBuilder createMapBuilder(); public abstract MetaBuilder createMetaBuilder(); public abstract OListBuilder createOListBuilder(); public abstract OptGroupBuilder createOptGroupBuilder(); public abstract OptionBuilder createOptionBuilder(); public abstract ParagraphBuilder createParagraphBuilder(); public abstract ParamBuilder createParamBuilder(); public abstract InputBuilder createPasswordInputBuilder(); public abstract PreBuilder createPreBuilder(); public abstract ButtonBuilder createPushButtonBuilder(); public abstract QuoteBuilder createQuoteBuilder(); /** * Create a builder for an &lt;input type='radio'&gt; element. * * @param name name the name of the radio input (used for grouping) * @return the builder for the new element */ public abstract InputBuilder createRadioInputBuilder(String name); public abstract ButtonBuilder createResetButtonBuilder(); public abstract InputBuilder createResetInputBuilder(); public abstract ScriptBuilder createScriptBuilder(); public abstract SelectBuilder createSelectBuilder(); public abstract SourceBuilder createSourceBuilder(); public abstract SpanBuilder createSpanBuilder(); public abstract StyleBuilder createStyleBuilder(); public abstract ButtonBuilder createSubmitButtonBuilder(); public abstract InputBuilder createSubmitInputBuilder(); public abstract TableBuilder createTableBuilder(); public abstract TableCaptionBuilder createTableCaptionBuilder(); public abstract TableSectionBuilder createTBodyBuilder(); public abstract TableCellBuilder createTDBuilder(); public abstract TextAreaBuilder createTextAreaBuilder(); public abstract InputBuilder createTextInputBuilder(); public abstract TableSectionBuilder createTFootBuilder(); public abstract TableCellBuilder createTHBuilder(); public abstract TableSectionBuilder createTHeadBuilder(); public abstract TableRowBuilder createTRBuilder(); public abstract UListBuilder createUListBuilder(); public abstract VideoBuilder createVideoBuilder(); /** * Create an {@link ElementBuilder} for an arbitrary tag name. The tag name will will not be * checked or escaped. The calling code should be carefully reviewed to ensure that the provided * tag name will not cause a security issue if including in an HTML document. In general, this * means limiting the code to HTML tagName constants supported by the HTML specification. * * @param tagName the tag name of the new element * @return an {@link ElementBuilder} used to build the element */ public abstract ElementBuilder trustedCreate(String tagName); }
public class Mutex { private static boolean available = true; // resource current availability public void acquire(){ while(!available){} available = false; } public void release(){ available = true; } }
package org.wso2.beam; import org.apache.beam.runners.flink.FlinkRunner; import org.apache.beam.sdk.Pipeline; import org.apache.beam.sdk.io.TextIO; import org.apache.beam.sdk.options.Default; import org.apache.beam.sdk.options.Description; import org.apache.beam.sdk.options.PipelineOptions; import org.apache.beam.sdk.options.PipelineOptionsFactory; import org.apache.beam.sdk.options.StreamingOptions; import org.apache.beam.sdk.transforms.Create; import org.apache.beam.sdk.transforms.DoFn; import org.apache.beam.sdk.transforms.GroupByKey; import org.apache.beam.sdk.transforms.MapElements; import org.apache.beam.sdk.transforms.ParDo; import org.apache.beam.sdk.transforms.SimpleFunction; import org.apache.beam.sdk.transforms.windowing.AfterPane; import org.apache.beam.sdk.transforms.windowing.AfterProcessingTime; import org.apache.beam.sdk.transforms.windowing.AfterWatermark; import org.apache.beam.sdk.transforms.windowing.FixedWindows; import org.apache.beam.sdk.transforms.windowing.Repeatedly; import org.apache.beam.sdk.transforms.windowing.Window; import org.apache.beam.sdk.values.KV; import org.apache.beam.sdk.values.PCollection; import org.joda.time.Duration; import org.joda.time.Instant; import java.util.Iterator; public class Trigger { private interface DefaultOptions extends PipelineOptions, StreamingOptions { @Description("Set input target") @Default.String("") String getInputFile(); void setInputFile(String value); @Description("Set output target") @Default.String("") String getOutput(); void setOutput(String value); } private static class AddTimestampFn extends DoFn<String, KV<String, String>> { private Instant minTimestamp; AddTimestampFn(Instant minTimestamp) { this.minTimestamp = minTimestamp; } @DoFn.ProcessElement public void processElement(@Element String element, OutputReceiver<KV<String, String>> receiver) { Instant randomTimestamp = minTimestamp.plus(Duration.standardSeconds(10)); this.minTimestamp = randomTimestamp; receiver.outputWithTimestamp(KV.of("key", element), new Instant(randomTimestamp)); } } private static class JoinString extends SimpleFunction<KV<String, Iterable<String>>, String> { @Override public String apply(KV<String, Iterable<String>> input) { Iterator<String> iter = input.getValue().iterator(); StringBuilder join = new StringBuilder(">"); while (iter.hasNext()) { join.append(iter.next()); } return join.toString(); } } private static void runTriggerDemo(PipelineOptions options) { Instant timestamp = new Instant(); Pipeline pipe = Pipeline.create(options); PCollection<KV<String, String>> collection = pipe.apply(Create.of("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M")) .apply(ParDo.of(new AddTimestampFn(timestamp))); collection.apply(Window.<KV<String, String>>into(FixedWindows.of(Duration.standardSeconds(65))) .triggering(AfterWatermark.pastEndOfWindow().withEarlyFirings(AfterPane.elementCountAtLeast(5))) .withAllowedLateness(Duration.standardSeconds(0)) .discardingFiredPanes()) // .apply(Window.<KV<String, String>>into(FixedWindows.of(Duration.standardSeconds(6))) // .triggering(AfterWatermark.pastEndOfWindow() // .withEarlyFirings(AfterProcessingTime.pastFirstElementInPane() // .plusDelayOf(Duration.standardSeconds(2)))).accumulatingFiredPanes() // .withAllowedLateness(Duration.standardSeconds(0))) .apply(GroupByKey.create()) .apply(MapElements.via(new JoinString())) .apply(TextIO.write().to("/home/tuan/WSO2/outputs/trigger")); // pipe.run(); collection.apply(Window.<KV<String, String>>into(FixedWindows.of(Duration.standardSeconds(65)))) .apply(GroupByKey.create()) .apply(MapElements.via(new JoinString())) .apply(TextIO.write().to("/home/tuan/WSO2/outputs/window")); pipe.run(); } public static void main( String[] args ) { DefaultOptions options = PipelineOptionsFactory.fromArgs(args).as(DefaultOptions.class); options.setRunner(FlinkRunner.class); options.setStreaming(true); runTriggerDemo(options); } }
package com.example.keokimassad.testparcheesi; import android.util.Log; import java.util.Random; import game.GameComputerPlayer; import game.infoMsg.GameInfo; /** * Created by AvayaBhattarai on 12/6/16. * Will find out which move will cause the pawn to move the furthest and wil move that pawn * Also will eat other player's pawns if possible */ public class ParComputerPlayerH extends GameComputerPlayer { ParLocalGame parLocalGame = new ParLocalGame(); // May need to change to actual player numbers //int playerNumber = playerNum; int playerNumber; private int[] location = new int[4]; ParRollAction rollAction; ParSelectAction selectAction; ParUseDieAction useDieAction; ParMoveAction moveAction; ParCheckLegalMoveAction checkLegalMoveAction; ParState parState; // the booleans tell the code if a smart move was found for that type of action boolean smartMoveStartingZone = false; boolean smartMoveSafeZone = false; boolean smartMoveEating = false; boolean smartMove = false; // the instance variables that hold the important information about the smart move, // if one was found int smartPawn = -1; String smartDieValue = null; int smartDieValueIndex = -1; int smartDieValueNumber = -1; //locations of pawns private int[] player0LocationsX = new int[4]; private int[] player1LocationsX = new int[4]; private int[] player2LocationsX = new int[4]; private int[] player3LocationsX = new int[4]; private int[] player0LocationsY = new int[4]; private int[] player1LocationsY = new int[4]; private int[] player2LocationsY = new int[4]; private int[] player3LocationsY = new int[4]; private int[] player0Rect = new int[4]; private int[] player1Rect = new int[4]; private int[] player2Rect = new int[4]; private int[] player3Rect = new int[4]; public ParComputerPlayerH(String name) { super(name); } @Override protected void receiveInfo(GameInfo info) { // May need to change to actual player numbers // updating which computer player's move it is for (int i = 0; i < allPlayerNames.length; i++) { if (allPlayerNames[i].equals(name)) { playerNumber = i; } } if (!(info instanceof ParState)) return; ParState parState = (ParState) info; if (parState.getPlayerTurn() == playerNumber) { //roll dice if (parState.getCheckLegalMoveActionMade() == true) { if (parState.getCurrentSubstage() == parState.Roll) { rollAction = new ParRollAction(this); sleep(500); game.sendAction(rollAction); sleep(2000); } //find out if a pawn needs to be moved else if (parState.getCurrentSubstage() == parState.Begin_Move || parState.getCurrentSubstage() == parState.Mid_Move) { // ToDo: implement a way to determine if there is a pawn on the location just outside of the starting location... we want to move it so that the next time a pawn is able to come out of the home base, we can take that pawn out instead of it being blocked by its own pawn when we could have moved it an avoided the situation if (smartMove == false) { //find each original pawn location for (int i = 0; i < 4; i++) { player0LocationsX[i] = parState.getPawnLocationsXForPlayer(0, i); player1LocationsX[i] = parState.getPawnLocationsXForPlayer(1, i); player2LocationsX[i] = parState.getPawnLocationsXForPlayer(2, i); player3LocationsX[i] = parState.getPawnLocationsXForPlayer(3, i); player0LocationsY[i] = parState.getPawnLocationsYForPlayer(0, i); player1LocationsY[i] = parState.getPawnLocationsYForPlayer(1, i); player2LocationsY[i] = parState.getPawnLocationsYForPlayer(2, i); player3LocationsY[i] = parState.getPawnLocationsYForPlayer(3, i); } // get the original rectangle of all of the pawns // if the rectangle is -1... then it is in the starting locations for (int j = 0; j < 4; j++) { player0Rect[j] = parState.getRect(player0LocationsX[j], player0LocationsY[j]); player1Rect[j] = parState.getRect(player1LocationsX[j], player1LocationsY[j]); player2Rect[j] = parState.getRect(player2LocationsX[j], player2LocationsY[j]); player3Rect[j] = parState.getRect(player3LocationsX[j], player3LocationsY[j]); } // check for a smart move, iterated over all of the pawns for the player that can move StartingZoneLoop: for (int i = 0; i < 4; i++) { // check if the player is able to take their pawn out of the starting zone switch (parState.getPlayerTurn()) { case 0: if (parState.getLegalMoves("dieValue1", i) == 0) { smartMoveStartingZone = true; smartPawn = i; smartDieValue = "dieValue1"; break StartingZoneLoop; } else if (parState.getLegalMoves("dieValue2", i) == 0) { smartMoveStartingZone = true; smartPawn = i; smartDieValue = "dieValue2"; break StartingZoneLoop; } else if (parState.getLegalMoves("dieValueTotal", i) == 0) { smartMoveStartingZone = true; smartPawn = i; smartDieValue = "dieValueTotal"; break StartingZoneLoop; } break; case 1: if (parState.getLegalMoves("dieValue1", i) == 51) { smartMoveStartingZone = true; smartPawn = i; smartDieValue = "dieValue1"; break StartingZoneLoop; } else if (parState.getLegalMoves("dieValue2", i) == 51) { smartMoveStartingZone = true; smartPawn = i; smartDieValue = "dieValue2"; break StartingZoneLoop; } else if (parState.getLegalMoves("dieValueTotal", i) == 51) { smartMoveStartingZone = true; smartPawn = i; smartDieValue = "dieValueTotal"; break StartingZoneLoop; } break; case 2: if (parState.getLegalMoves("dieValue1", i) == 34) { smartMoveStartingZone = true; smartPawn = i; smartDieValue = "dieValue1"; break StartingZoneLoop; } else if (parState.getLegalMoves("dieValue2", i) == 34) { smartMoveStartingZone = true; smartPawn = i; smartDieValue = "dieValue2"; break StartingZoneLoop; } else if (parState.getLegalMoves("dieValueTotal", i) == 34) { smartMoveStartingZone = true; smartPawn = i; smartDieValue = "dieValueTotal"; break StartingZoneLoop; } break; case 3: if (parState.getLegalMoves("dieValue1", i) == 17) { smartMoveStartingZone = true; smartPawn = i; smartDieValue = "dieValue1"; break StartingZoneLoop; } else if (parState.getLegalMoves("dieValue2", i) == 17) { smartMoveStartingZone = true; smartPawn = i; smartDieValue = "dieValue2"; break StartingZoneLoop; } else if (parState.getLegalMoves("dieValueTotal", i) == 17) { smartMoveStartingZone = true; smartPawn = i; smartDieValue = "dieValueTotal"; break StartingZoneLoop; } break; } } if (smartMoveStartingZone == false) { SafeZoneLoop: for (int i = 0; i < 4; i++) { // check if the player is able to move into their safe zone/home base switch (parState.getPlayerTurn()) { case 0: if (parState.getLegalMoves("dieValue1", i) >= 68 && (parState.getLegalMoves("dieValue1", i) <= 75 || (parState.getLegalMoves("dieValue1", i) >= 116 && parState.getLegalMoves("dieValue1", i) <= 119))) { if (smartMoveSafeZone == false) { // if there is no smartMoveSafeZone, then set it to be so smartMoveSafeZone = true; smartPawn = i; smartDieValue = "dieValue1"; } else if (parState.getLegalMoves(smartDieValue, smartPawn) < parState.getLegalMoves("dieValue1", i)) { // if there is and the new value is further along in // the safe zone than the previously determined legal // move that moves into the safe zone, set the values // to the new, greater value smartPawn = i; smartDieValue = "dieValue1"; } } if (parState.getLegalMoves("dieValue2", i) >= 68 && (parState.getLegalMoves("dieValue2", i) <= 75 || (parState.getLegalMoves("dieValue2", i) >= 116 && parState.getLegalMoves("dieValue2", i) <= 119))) { if (smartMoveSafeZone == false) { smartMoveSafeZone = true; smartPawn = i; smartDieValue = "dieValue2"; } else if (parState.getLegalMoves(smartDieValue, smartPawn) < parState.getLegalMoves("dieValue2", i)) { smartPawn = i; smartDieValue = "dieValue2"; } } if (parState.getLegalMoves("dieValueTotal", i) >= 68 && (parState.getLegalMoves("dieValueTotal", i) <= 75 || (parState.getLegalMoves("dieValueTotal", i) >= 116 && parState.getLegalMoves("dieValueTotal", i) <= 119))) { if (smartMoveSafeZone == false) { smartMoveSafeZone = true; smartPawn = i; smartDieValue = "dieValueTotal"; } else if (parState.getLegalMoves(smartDieValue, smartPawn) < parState.getLegalMoves("dieValueTotal", i)) { smartMoveSafeZone = true; smartPawn = i; smartDieValue = "dieValueTotal"; } } break; case 1: if (parState.getLegalMoves("dieValue1", i) >= 76 && (parState.getLegalMoves("dieValue1", i) <= 83 || (parState.getLegalMoves("dieValue1", i) >= 120 && parState.getLegalMoves("dieValue1", i) <= 123))) { // check if the new value is further along in the safezone than the previously determined legal move that moves into the safe zone if (smartMoveSafeZone == false) { smartMoveSafeZone = true; smartPawn = i; smartDieValue = "dieValue1"; } else if (parState.getLegalMoves(smartDieValue, smartPawn) < parState.getLegalMoves("dieValue1", i)) { smartPawn = i; smartDieValue = "dieValue1"; } } if (parState.getLegalMoves("dieValue2", i) >= 76 && (parState.getLegalMoves("dieValue2", i) <= 83 || (parState.getLegalMoves("dieValue2", i) >= 120 && parState.getLegalMoves("dieValue2", i) <= 123))) { if (smartMoveSafeZone == false) { smartMoveSafeZone = true; smartPawn = i; smartDieValue = "dieValue2"; } else if (parState.getLegalMoves(smartDieValue, smartPawn) < parState.getLegalMoves("dieValue2", i)) { smartPawn = i; smartDieValue = "dieValue2"; } } if (parState.getLegalMoves("dieValueTotal", i) >= 76 && (parState.getLegalMoves("dieValueTotal", i) <= 83 || (parState.getLegalMoves("dieValueTotal", i) >= 120 && parState.getLegalMoves("dieValueTotal", i) <= 123))) { if (smartMoveSafeZone == false) { smartMoveSafeZone = true; smartPawn = i; smartDieValue = "dieValueTotal"; } else if (parState.getLegalMoves(smartDieValue, smartPawn) < parState.getLegalMoves("dieValueTotal", i)) { smartPawn = i; smartDieValue = "dieValueTotal"; } } break; case 2: if (parState.getLegalMoves("dieValue1", i) >= 84 && (parState.getLegalMoves("dieValue1", i) <= 91 || (parState.getLegalMoves("dieValue1", i) >= 124 && parState.getLegalMoves("dieValue1", i) <= 127))) { // check if the new value is further along in the safezone than the previously determined legal move that moves into the safe zone if (smartMoveSafeZone == false) { smartMoveSafeZone = true; smartPawn = i; smartDieValue = "dieValue1"; } else if (parState.getLegalMoves(smartDieValue, smartPawn) < parState.getLegalMoves("dieValue1", i)) { smartPawn = i; smartDieValue = "dieValue1"; } } if (parState.getLegalMoves("dieValue2", i) >= 84 && (parState.getLegalMoves("dieValue2", i) <= 91 || (parState.getLegalMoves("dieValue2", i) >= 124 && parState.getLegalMoves("dieValue2", i) <= 127))) { if (smartMoveSafeZone == false) { smartMoveSafeZone = true; smartPawn = i; smartDieValue = "dieValue2"; } else if (parState.getLegalMoves(smartDieValue, smartPawn) < parState.getLegalMoves("dieValue2", i)) { smartPawn = i; smartDieValue = "dieValue2"; } } if (parState.getLegalMoves("dieValueTotal", i) >= 84 && (parState.getLegalMoves("dieValueTotal", i) <= 91 || (parState.getLegalMoves("dieValueTotal", i) >= 124 && parState.getLegalMoves("dieValueTotal", i) <= 127))) { if (smartMoveSafeZone == false) { smartMoveSafeZone = true; smartPawn = i; smartDieValue = "dieValueTotal"; } else if (parState.getLegalMoves(smartDieValue, smartPawn) < parState.getLegalMoves("dieValueTotal", i)) { smartPawn = i; smartDieValue = "dieValueTotal"; } } break; case 3: if (parState.getLegalMoves("dieValue1", i) >= 92 && (parState.getLegalMoves("dieValue1", i) <= 99 || (parState.getLegalMoves("dieValue1", i) >= 128 && parState.getLegalMoves("dieValue1", i) <= 131))) { // check if the new value is further along in the safezone than the previously determined legal move that moves into the safe zone if (smartMoveSafeZone == false) { smartMoveSafeZone = true; smartPawn = i; smartDieValue = "dieValue1"; } else if (parState.getLegalMoves(smartDieValue, smartPawn) < parState.getLegalMoves("dieValue1", i)) { smartPawn = i; smartDieValue = "dieValue1"; } } if (parState.getLegalMoves("dieValue2", i) >= 92 && (parState.getLegalMoves("dieValue2", i) <= 99 || (parState.getLegalMoves("dieValue2", i) >= 128 && parState.getLegalMoves("dieValue2", i) <= 131))) { if (smartMoveSafeZone == false) { smartMoveSafeZone = true; smartPawn = i; smartDieValue = "dieValue2"; } else if (parState.getLegalMoves(smartDieValue, smartPawn) < parState.getLegalMoves("dieValue2", i)) { smartPawn = i; smartDieValue = "dieValue2"; } } if (parState.getLegalMoves("dieValueTotal", i) >= 92 && (parState.getLegalMoves("dieValueTotal", i) <= 99 || (parState.getLegalMoves("dieValueTotal", i) >= 128 && parState.getLegalMoves("dieValueTotal", i) <= 131))) { if (smartMoveSafeZone == false) { smartMoveSafeZone = true; smartPawn = i; smartDieValue = "dieValueTotal"; } else if (parState.getLegalMoves(smartDieValue, smartPawn) < parState.getLegalMoves("dieValueTotal", i)) { smartPawn = i; smartDieValue = "dieValueTotal"; } } break; } } if (smartMoveSafeZone == false) { // iterate over all of the pawns for the player that can move for (int i = 0; i < 4; i++) { // check if the player who is moving has a legal move that allows // them to eat another players pawn switch (parState.getPlayerTurn()) { case 0: // iterate over the other players pawns for (int j = 0; j < 4; j++) { // check the legal moves against player 1 if (parState.getLegalMoves("dieValue1", i) == player1Rect[j] && parState.getLegalMoves("dieValue1", i) != -1) { if (smartMoveEating == false) { smartMoveEating = true; smartPawn = i; smartDieValue = "dieValue1"; } else if (parState.getLegalMoves("dieValue1", i) >= 0 && parState.getLegalMoves("dieValue1", i) <= 63 && parState.getLegalMoves("dieValue1", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValue1"; } } if (parState.getLegalMoves("dieValue2", i) == player1Rect[j] && parState.getLegalMoves("dieValue2", i) != -1) { if (smartMoveEating == false) { smartMoveEating = true; smartPawn = i; smartDieValue = "dieValue2"; } else if (parState.getLegalMoves("dieValue2", i) >= 0 && parState.getLegalMoves("dieValue2", i) <= 63 && parState.getLegalMoves("dieValue2", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValue2"; } } if (parState.getLegalMoves("dieValueTotal", i) == player1Rect[j] && parState.getLegalMoves("dieValueTotal", i) != -1) { if (smartMoveEating == false) { smartMoveEating = true; smartPawn = i; smartDieValue = "dieValueTotal"; } else if (parState.getLegalMoves("dieValueTotal", i) >= 0 && parState.getLegalMoves("dieValueTotal", i) <= 63 && parState.getLegalMoves("dieValueTotal", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValueTotal"; } } // check the legal moves against player 2 if (parState.getLegalMoves("dieValue1", i) == player2Rect[j] && parState.getLegalMoves("dieValue1", i) != -1) { if (smartMoveEating == false) { smartMoveEating = true; smartPawn = i; smartDieValue = "dieValue1"; } else if (parState.getLegalMoves("dieValue1", i) >= 0 && parState.getLegalMoves("dieValue1", i) <= 63 && parState.getLegalMoves("dieValue1", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValue1"; } } if (parState.getLegalMoves("dieValue2", i) == player2Rect[j] && parState.getLegalMoves("dieValue2", i) != -1) { if (smartMoveEating == false) { smartMoveEating = true; smartPawn = i; smartDieValue = "dieValue2"; } else if (parState.getLegalMoves("dieValue2", i) >= 0 && parState.getLegalMoves("dieValue2", i) <= 63 && parState.getLegalMoves("dieValue2", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValue2"; } } if (parState.getLegalMoves("dieValueTotal", i) == player2Rect[j] && parState.getLegalMoves("dieValueTotal", i) != -1) { if (smartMoveEating == false) { smartMoveEating = true; smartPawn = i; smartDieValue = "dieValueTotal"; } else if (parState.getLegalMoves("dieValueTotal", i) >= 0 && parState.getLegalMoves("dieValueTotal", i) <= 63 && parState.getLegalMoves("dieValueTotal", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValueTotal"; } } // check the legal moves against player 3 if (parState.getLegalMoves("dieValue1", i) == player3Rect[j] && parState.getLegalMoves("dieValue1", i) != -1) { if (smartMoveEating == false) { smartMoveEating = true; smartPawn = i; smartDieValue = "dieValue1"; } else if (parState.getLegalMoves("dieValue1", i) >= 0 && parState.getLegalMoves("dieValue1", i) <= 63 && parState.getLegalMoves("dieValue1", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValue1"; } } if (parState.getLegalMoves("dieValue2", i) == player3Rect[j] && parState.getLegalMoves("dieValue2", i) != -1) { if (smartMoveEating == false) { smartMoveEating = true; smartPawn = i; smartDieValue = "dieValue2"; } else if (parState.getLegalMoves("dieValue2", i) >= 0 && parState.getLegalMoves("dieValue2", i) <= 63 && parState.getLegalMoves("dieValue2", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValue2"; } } if (parState.getLegalMoves("dieValueTotal", i) == player3Rect[j] && parState.getLegalMoves("dieValueTotal", i) != -1) { if (smartMoveEating == false) { smartMoveEating = true; smartPawn = i; smartDieValue = "dieValueTotal"; } else if (parState.getLegalMoves("dieValueTotal", i) >= 0 && parState.getLegalMoves("dieValueTotal", i) <= 63 && parState.getLegalMoves("dieValueTotal", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValueTotal"; } } } break; case 1: // iterate over the other players pawns for (int j = 0; j < 4; j++) { // check the legal moves against player 0 if (parState.getLegalMoves("dieValue1", i) == player0Rect[j] && parState.getLegalMoves("dieValue1", i) != -1) { if (smartMoveEating == false) { smartMoveEating = true; smartPawn = i; smartDieValue = "dieValue1"; } else if (parState.getLegalMoves("dieValue1", i) >= 0 && parState.getLegalMoves("dieValue1", i) <= 46 && parState.getLegalMoves(smartDieValue, smartPawn) >= 51 && parState.getLegalMoves(smartDieValue, smartPawn) <= 67) { smartPawn = i; smartDieValue = "dieValue1"; } else if (parState.getLegalMoves("dieValue1", i) >= 0 && parState.getLegalMoves("dieValue1", i) <= 46 && parState.getLegalMoves("dieValue1", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValue1"; } else if (parState.getLegalMoves("dieValue1", i) >= 51 && parState.getLegalMoves("dieValue1", i) <= 67 && parState.getLegalMoves("dieValue1", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValue1"; } } if (parState.getLegalMoves("dieValue2", i) == player0Rect[j] && parState.getLegalMoves("dieValue2", i) != -1) { if (smartMoveEating == false) { smartMoveEating = true; smartPawn = i; smartDieValue = "dieValue2"; } else if (parState.getLegalMoves("dieValue2", i) >= 0 && parState.getLegalMoves("dieValue2", i) <= 46 && parState.getLegalMoves(smartDieValue, smartPawn) >= 51 && parState.getLegalMoves(smartDieValue, smartPawn) <= 67) { smartPawn = i; smartDieValue = "dieValue2"; } else if (parState.getLegalMoves("dieValue2", i) >= 0 && parState.getLegalMoves("dieValue2", i) <= 46 && parState.getLegalMoves("dieValue2", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValue2"; } else if (parState.getLegalMoves("dieValue2", i) >= 51 && parState.getLegalMoves("dieValue2", i) <= 67 && parState.getLegalMoves("dieValue2", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValue2"; } } if (parState.getLegalMoves("dieValueTotal", i) == player0Rect[j] && parState.getLegalMoves("dieValueTotal", i) != -1) { if (smartMoveEating == false) { smartMoveEating = true; smartPawn = i; smartDieValue = "dieValueTotal"; } else if (parState.getLegalMoves("dieValueTotal", i) >= 0 && parState.getLegalMoves("dieValueTotal", i) <= 46 && parState.getLegalMoves(smartDieValue, smartPawn) >= 51 && parState.getLegalMoves(smartDieValue, smartPawn) <= 67) { smartPawn = i; smartDieValue = "dieValueTotal"; } else if (parState.getLegalMoves("dieValueTotal", i) >= 0 && parState.getLegalMoves("dieValueTotal", i) <= 46 && parState.getLegalMoves("dieValueTotal", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValueTotal"; } else if (parState.getLegalMoves("dieValueTotal", i) >= 51 && parState.getLegalMoves("dieValueTotal", i) <= 67 && parState.getLegalMoves("dieValueTotal", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValueTotal"; } } // check the legal moves against player 2 if (parState.getLegalMoves("dieValue1", i) == player2Rect[j] && parState.getLegalMoves("dieValue1", i) != -1) { if (smartMoveEating == false) { smartMoveEating = true; smartPawn = i; smartDieValue = "dieValue1"; } else if (parState.getLegalMoves("dieValue1", i) >= 0 && parState.getLegalMoves("dieValue1", i) <= 46 && parState.getLegalMoves(smartDieValue, smartPawn) >= 51 && parState.getLegalMoves(smartDieValue, smartPawn) <= 67) { smartPawn = i; smartDieValue = "dieValue1"; } else if (parState.getLegalMoves("dieValue1", i) >= 0 && parState.getLegalMoves("dieValue1", i) <= 46 && parState.getLegalMoves("dieValue1", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValue1"; } else if (parState.getLegalMoves("dieValue1", i) >= 51 && parState.getLegalMoves("dieValue1", i) <= 67 && parState.getLegalMoves("dieValue1", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValue1"; } } if (parState.getLegalMoves("dieValue2", i) == player2Rect[j] && parState.getLegalMoves("dieValue2", i) != -1) { if (smartMoveEating == false) { smartMoveEating = true; smartPawn = i; smartDieValue = "dieValue2"; } else if (parState.getLegalMoves("dieValue2", i) >= 0 && parState.getLegalMoves("dieValue2", i) <= 46 && parState.getLegalMoves(smartDieValue, smartPawn) >= 51 && parState.getLegalMoves(smartDieValue, smartPawn) <= 67) { smartPawn = i; smartDieValue = "dieValue2"; } else if (parState.getLegalMoves("dieValue2", i) >= 0 && parState.getLegalMoves("dieValue2", i) <= 46 && parState.getLegalMoves("dieValue2", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValue2"; } else if (parState.getLegalMoves("dieValue2", i) >= 51 && parState.getLegalMoves("dieValue2", i) <= 67 && parState.getLegalMoves("dieValue2", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValue2"; } } if (parState.getLegalMoves("dieValueTotal", i) == player2Rect[j] && parState.getLegalMoves("dieValueTotal", i) != -1) { if (smartMoveEating == false) { smartMoveEating = true; smartPawn = i; smartDieValue = "dieValueTotal"; } else if (parState.getLegalMoves("dieValueTotal", i) >= 0 && parState.getLegalMoves("dieValueTotal", i) <= 46 && parState.getLegalMoves(smartDieValue, smartPawn) >= 51 && parState.getLegalMoves(smartDieValue, smartPawn) <= 67) { smartPawn = i; smartDieValue = "dieValueTotal"; } else if (parState.getLegalMoves("dieValueTotal", i) >= 0 && parState.getLegalMoves("dieValueTotal", i) <= 46 && parState.getLegalMoves("dieValueTotal", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValueTotal"; } else if (parState.getLegalMoves("dieValueTotal", i) >= 51 && parState.getLegalMoves("dieValueTotal", i) <= 67 && parState.getLegalMoves("dieValueTotal", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValueTotal"; } } // check the legal moves against player 3 if (parState.getLegalMoves("dieValue1", i) == player3Rect[j] && parState.getLegalMoves("dieValue1", i) != -1) { if (smartMoveEating == false) { smartMoveEating = true; smartPawn = i; smartDieValue = "dieValue1"; } else if (parState.getLegalMoves("dieValue1", i) >= 0 && parState.getLegalMoves("dieValue1", i) <= 46 && parState.getLegalMoves(smartDieValue, smartPawn) >= 51 && parState.getLegalMoves(smartDieValue, smartPawn) <= 67) { smartPawn = i; smartDieValue = "dieValue1"; } else if (parState.getLegalMoves("dieValue1", i) >= 0 && parState.getLegalMoves("dieValue1", i) <= 46 && parState.getLegalMoves("dieValue1", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValue1"; } else if (parState.getLegalMoves("dieValue1", i) >= 51 && parState.getLegalMoves("dieValue1", i) <= 67 && parState.getLegalMoves("dieValue1", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValue1"; } } if (parState.getLegalMoves("dieValue2", i) == player3Rect[j] && parState.getLegalMoves("dieValue2", i) != -1) { if (smartMoveEating == false) { smartMoveEating = true; smartPawn = i; smartDieValue = "dieValue2"; } else if (parState.getLegalMoves("dieValue2", i) >= 0 && parState.getLegalMoves("dieValue2", i) <= 46 && parState.getLegalMoves(smartDieValue, smartPawn) >= 51 && parState.getLegalMoves(smartDieValue, smartPawn) <= 67) { smartPawn = i; smartDieValue = "dieValue2"; } else if (parState.getLegalMoves("dieValue2", i) >= 0 && parState.getLegalMoves("dieValue2", i) <= 46 && parState.getLegalMoves("dieValue2", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValue2"; } else if (parState.getLegalMoves("dieValue2", i) >= 51 && parState.getLegalMoves("dieValue2", i) <= 67 && parState.getLegalMoves("dieValue2", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValue2"; } } if (parState.getLegalMoves("dieValueTotal", i) == player3Rect[j] && parState.getLegalMoves("dieValueTotal", i) != -1) { if (smartMoveEating == false) { smartMoveEating = true; smartPawn = i; smartDieValue = "dieValueTotal"; } else if (parState.getLegalMoves("dieValueTotal", i) >= 0 && parState.getLegalMoves("dieValueTotal", i) <= 46 && parState.getLegalMoves(smartDieValue, smartPawn) >= 51 && parState.getLegalMoves(smartDieValue, smartPawn) <= 67) { smartPawn = i; smartDieValue = "dieValueTotal"; } else if (parState.getLegalMoves("dieValueTotal", i) >= 0 && parState.getLegalMoves("dieValueTotal", i) <= 46 && parState.getLegalMoves("dieValueTotal", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValueTotal"; } else if (parState.getLegalMoves("dieValueTotal", i) >= 51 && parState.getLegalMoves("dieValueTotal", i) <= 67 && parState.getLegalMoves("dieValueTotal", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValueTotal"; } } } break; case 2: // iterate over the other players pawns for (int j = 0; j < 4; j++) { // check the legal moves against player 0 if (parState.getLegalMoves("dieValue1", i) == player0Rect[j] && parState.getLegalMoves("dieValue1", i) != -1) { if (smartMoveEating == false) { smartMoveEating = true; smartPawn = i; smartDieValue = "dieValue1"; } else if (parState.getLegalMoves("dieValue1", i) >= 0 && parState.getLegalMoves("dieValue1", i) <= 29 && parState.getLegalMoves(smartDieValue, smartPawn) >= 34 && parState.getLegalMoves(smartDieValue, smartPawn) <= 67) { smartPawn = i; smartDieValue = "dieValue1"; } else if (parState.getLegalMoves("dieValue1", i) >= 0 && parState.getLegalMoves("dieValue1", i) <= 29 && parState.getLegalMoves("dieValue1", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValue1"; } else if (parState.getLegalMoves("dieValue1", i) >= 34 && parState.getLegalMoves("dieValue1", i) <= 67 && parState.getLegalMoves("dieValue1", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValue1"; } } if (parState.getLegalMoves("dieValue2", i) == player0Rect[j] && parState.getLegalMoves("dieValue2", i) != -1) { if (smartMoveEating == false) { smartMoveEating = true; smartPawn = i; smartDieValue = "dieValue2"; } else if (parState.getLegalMoves("dieValue2", i) >= 0 && parState.getLegalMoves("dieValue2", i) <= 29 && parState.getLegalMoves(smartDieValue, smartPawn) >= 34 && parState.getLegalMoves(smartDieValue, smartPawn) <= 67) { smartPawn = i; smartDieValue = "dieValue2"; } else if (parState.getLegalMoves("dieValue2", i) >= 0 && parState.getLegalMoves("dieValue2", i) <= 29 && parState.getLegalMoves("dieValue2", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValue2"; } else if (parState.getLegalMoves("dieValue2", i) >= 34 && parState.getLegalMoves("dieValue2", i) <= 67 && parState.getLegalMoves("dieValue2", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValue2"; } } if (parState.getLegalMoves("dieValueTotal", i) == player0Rect[j] && parState.getLegalMoves("dieValueTotal", i) != -1) { if (smartMoveEating == false) { smartMoveEating = true; smartPawn = i; smartDieValue = "dieValueTotal"; } else if (parState.getLegalMoves("dieValueTotal", i) >= 0 && parState.getLegalMoves("dieValueTotal", i) <= 29 && parState.getLegalMoves(smartDieValue, smartPawn) >= 34 && parState.getLegalMoves(smartDieValue, smartPawn) <= 67) { smartPawn = i; smartDieValue = "dieValueTotal"; } else if (parState.getLegalMoves("dieValueTotal", i) >= 0 && parState.getLegalMoves("dieValueTotal", i) <= 29 && parState.getLegalMoves("dieValueTotal", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValueTotal"; } else if (parState.getLegalMoves("dieValueTotal", i) >= 34 && parState.getLegalMoves("dieValueTotal", i) <= 67 && parState.getLegalMoves("dieValueTotal", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValueTotal"; } } // check the legal moves against player 1 if (parState.getLegalMoves("dieValue1", i) == player1Rect[j] && parState.getLegalMoves("dieValue1", i) != -1) { if (smartMoveEating == false) { smartMoveEating = true; smartPawn = i; smartDieValue = "dieValue1"; } else if (parState.getLegalMoves("dieValue1", i) >= 0 && parState.getLegalMoves("dieValue1", i) <= 29 && parState.getLegalMoves(smartDieValue, smartPawn) >= 34 && parState.getLegalMoves(smartDieValue, smartPawn) <= 67) { smartPawn = i; smartDieValue = "dieValue1"; } else if (parState.getLegalMoves("dieValue1", i) >= 0 && parState.getLegalMoves("dieValue1", i) <= 29 && parState.getLegalMoves("dieValue1", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValue1"; } else if (parState.getLegalMoves("dieValue1", i) >= 34 && parState.getLegalMoves("dieValue1", i) <= 67 && parState.getLegalMoves("dieValue1", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValue1"; } } if (parState.getLegalMoves("dieValue2", i) == player1Rect[j] && parState.getLegalMoves("dieValue2", i) != -1) { if (smartMoveEating == false) { smartMoveEating = true; smartPawn = i; smartDieValue = "dieValue2"; } else if (parState.getLegalMoves("dieValue2", i) >= 0 && parState.getLegalMoves("dieValue2", i) <= 29 && parState.getLegalMoves(smartDieValue, smartPawn) >= 34 && parState.getLegalMoves(smartDieValue, smartPawn) <= 67) { smartPawn = i; smartDieValue = "dieValue2"; } else if (parState.getLegalMoves("dieValue2", i) >= 0 && parState.getLegalMoves("dieValue2", i) <= 29 && parState.getLegalMoves("dieValue2", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValue2"; } else if (parState.getLegalMoves("dieValue2", i) >= 34 && parState.getLegalMoves("dieValue2", i) <= 67 && parState.getLegalMoves("dieValue2", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValue2"; } } if (parState.getLegalMoves("dieValueTotal", i) == player1Rect[j] && parState.getLegalMoves("dieValueTotal", i) != -1) { if (smartMoveEating == false) { smartMoveEating = true; smartPawn = i; smartDieValue = "dieValueTotal"; } else if (parState.getLegalMoves("dieValueTotal", i) >= 0 && parState.getLegalMoves("dieValueTotal", i) <= 29 && parState.getLegalMoves(smartDieValue, smartPawn) >= 34 && parState.getLegalMoves(smartDieValue, smartPawn) <= 67) { smartPawn = i; smartDieValue = "dieValueTotal"; } else if (parState.getLegalMoves("dieValueTotal", i) >= 0 && parState.getLegalMoves("dieValueTotal", i) <= 29 && parState.getLegalMoves("dieValueTotal", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValueTotal"; } else if (parState.getLegalMoves("dieValueTotal", i) >= 34 && parState.getLegalMoves("dieValueTotal", i) <= 67 && parState.getLegalMoves("dieValueTotal", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValueTotal"; } } // check the legal moves against player 3 if (parState.getLegalMoves("dieValue1", i) == player3Rect[j] && parState.getLegalMoves("dieValue1", i) != -1) { if (smartMoveEating == false) { smartMoveEating = true; smartPawn = i; smartDieValue = "dieValue1"; } else if (parState.getLegalMoves("dieValue1", i) >= 0 && parState.getLegalMoves("dieValue1", i) <= 29 && parState.getLegalMoves(smartDieValue, smartPawn) >= 34 && parState.getLegalMoves(smartDieValue, smartPawn) <= 67) { smartPawn = i; smartDieValue = "dieValue1"; } else if (parState.getLegalMoves("dieValue1", i) >= 0 && parState.getLegalMoves("dieValue1", i) <= 29 && parState.getLegalMoves("dieValue1", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValue1"; } else if (parState.getLegalMoves("dieValue1", i) >= 34 && parState.getLegalMoves("dieValue1", i) <= 67 && parState.getLegalMoves("dieValue1", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValue1"; } } if (parState.getLegalMoves("dieValue2", i) == player3Rect[j] && parState.getLegalMoves("dieValue2", i) != -1) { if (smartMoveEating == false) { smartMoveEating = true; smartPawn = i; smartDieValue = "dieValue2"; } else if (parState.getLegalMoves("dieValue2", i) >= 0 && parState.getLegalMoves("dieValue2", i) <= 29 && parState.getLegalMoves(smartDieValue, smartPawn) >= 34 && parState.getLegalMoves(smartDieValue, smartPawn) <= 67) { smartPawn = i; smartDieValue = "dieValue2"; } else if (parState.getLegalMoves("dieValue2", i) >= 0 && parState.getLegalMoves("dieValue2", i) <= 29 && parState.getLegalMoves("dieValue2", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValue2"; } else if (parState.getLegalMoves("dieValue2", i) >= 34 && parState.getLegalMoves("dieValue2", i) <= 67 && parState.getLegalMoves("dieValue2", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValue2"; } } if (parState.getLegalMoves("dieValueTotal", i) == player3Rect[j] && parState.getLegalMoves("dieValueTotal", i) != -1) { if (smartMoveEating == false) { smartMoveEating = true; smartPawn = i; smartDieValue = "dieValueTotal"; } else if (parState.getLegalMoves("dieValueTotal", i) >= 0 && parState.getLegalMoves("dieValueTotal", i) <= 29 && parState.getLegalMoves(smartDieValue, smartPawn) >= 34 && parState.getLegalMoves(smartDieValue, smartPawn) <= 67) { smartPawn = i; smartDieValue = "dieValueTotal"; } else if (parState.getLegalMoves("dieValueTotal", i) >= 0 && parState.getLegalMoves("dieValueTotal", i) <= 29 && parState.getLegalMoves("dieValueTotal", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValueTotal"; } else if (parState.getLegalMoves("dieValueTotal", i) >= 34 && parState.getLegalMoves("dieValueTotal", i) <= 67 && parState.getLegalMoves("dieValueTotal", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValueTotal"; } } } break; case 3: // iterate over the other players pawns for (int j = 0; j < 4; j++) { // check the legal moves against player 0 if (parState.getLegalMoves("dieValue1", i) == player0Rect[j] && parState.getLegalMoves("dieValue1", i) != -1) { if (smartMoveEating == false) { smartMoveEating = true; smartPawn = i; smartDieValue = "dieValue1"; } else if (parState.getLegalMoves("dieValue1", i) >= 0 && parState.getLegalMoves("dieValue1", i) <= 12 && parState.getLegalMoves(smartDieValue, smartPawn) >= 17 && parState.getLegalMoves(smartDieValue, smartPawn) <= 67) { smartPawn = i; smartDieValue = "dieValue1"; } else if (parState.getLegalMoves("dieValue1", i) >= 0 && parState.getLegalMoves("dieValue1", i) <= 12 && parState.getLegalMoves("dieValue1", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValue1"; } else if (parState.getLegalMoves("dieValue1", i) >= 17 && parState.getLegalMoves("dieValue1", i) <= 67 && parState.getLegalMoves("dieValue1", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValue1"; } } if (parState.getLegalMoves("dieValue2", i) == player0Rect[j] && parState.getLegalMoves("dieValue2", i) != -1) { if (smartMoveEating == false) { smartMoveEating = true; smartPawn = i; smartDieValue = "dieValue2"; } else if (parState.getLegalMoves("dieValue2", i) >= 0 && parState.getLegalMoves("dieValue2", i) <= 12 && parState.getLegalMoves(smartDieValue, smartPawn) >= 17 && parState.getLegalMoves(smartDieValue, smartPawn) <= 67) { smartPawn = i; smartDieValue = "dieValue2"; } else if (parState.getLegalMoves("dieValue2", i) >= 0 && parState.getLegalMoves("dieValue2", i) <= 12 && parState.getLegalMoves("dieValue2", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValue2"; } else if (parState.getLegalMoves("dieValue2", i) >= 17 && parState.getLegalMoves("dieValue2", i) <= 67 && parState.getLegalMoves("dieValue2", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValue2"; } } if (parState.getLegalMoves("dieValueTotal", i) == player0Rect[j] && parState.getLegalMoves("dieValueTotal", i) != -1) { if (smartMoveEating == false) { smartMoveEating = true; smartPawn = i; smartDieValue = "dieValueTotal"; } else if (parState.getLegalMoves("dieValueTotal", i) >= 0 && parState.getLegalMoves("dieValueTotal", i) <= 12 && parState.getLegalMoves(smartDieValue, smartPawn) >= 17 && parState.getLegalMoves(smartDieValue, smartPawn) <= 67) { smartPawn = i; smartDieValue = "dieValueTotal"; } else if (parState.getLegalMoves("dieValueTotal", i) >= 0 && parState.getLegalMoves("dieValueTotal", i) <= 12 && parState.getLegalMoves("dieValueTotal", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValueTotal"; } else if (parState.getLegalMoves("dieValueTotal", i) >= 17 && parState.getLegalMoves("dieValueTotal", i) <= 67 && parState.getLegalMoves("dieValueTotal", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValueTotal"; } } // check the legal moves against player 1 if (parState.getLegalMoves("dieValue1", i) == player1Rect[j] && parState.getLegalMoves("dieValue1", i) != -1) { if (smartMoveEating == false) { smartMoveEating = true; smartPawn = i; smartDieValue = "dieValue1"; } else if (parState.getLegalMoves("dieValue1", i) >= 0 && parState.getLegalMoves("dieValue1", i) <= 12 && parState.getLegalMoves(smartDieValue, smartPawn) >= 17 && parState.getLegalMoves(smartDieValue, smartPawn) <= 67) { smartPawn = i; smartDieValue = "dieValue1"; } else if (parState.getLegalMoves("dieValue1", i) >= 0 && parState.getLegalMoves("dieValue1", i) <= 12 && parState.getLegalMoves("dieValue1", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValue1"; } else if (parState.getLegalMoves("dieValue1", i) >= 17 && parState.getLegalMoves("dieValue1", i) <= 67 && parState.getLegalMoves("dieValue1", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValue1"; } } if (parState.getLegalMoves("dieValue2", i) == player1Rect[j] && parState.getLegalMoves("dieValue2", i) != -1) { if (smartMoveEating == false) { smartMoveEating = true; smartPawn = i; smartDieValue = "dieValue2"; } else if (parState.getLegalMoves("dieValue2", i) >= 0 && parState.getLegalMoves("dieValue2", i) <= 12 && parState.getLegalMoves(smartDieValue, smartPawn) >= 17 && parState.getLegalMoves(smartDieValue, smartPawn) <= 67) { smartPawn = i; smartDieValue = "dieValue2"; } else if (parState.getLegalMoves("dieValue2", i) >= 0 && parState.getLegalMoves("dieValue2", i) <= 12 && parState.getLegalMoves("dieValue2", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValue2"; } else if (parState.getLegalMoves("dieValue2", i) >= 17 && parState.getLegalMoves("dieValue2", i) <= 67 && parState.getLegalMoves("dieValue2", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValue2"; } } if (parState.getLegalMoves("dieValueTotal", i) == player1Rect[j] && parState.getLegalMoves("dieValueTotal", i) != -1) { if (smartMoveEating == false) { smartMoveEating = true; smartPawn = i; smartDieValue = "dieValueTotal"; } else if (parState.getLegalMoves("dieValueTotal", i) >= 0 && parState.getLegalMoves("dieValueTotal", i) <= 12 && parState.getLegalMoves(smartDieValue, smartPawn) >= 17 && parState.getLegalMoves(smartDieValue, smartPawn) <= 67) { smartPawn = i; smartDieValue = "dieValueTotal"; } else if (parState.getLegalMoves("dieValueTotal", i) >= 0 && parState.getLegalMoves("dieValueTotal", i) <= 12 && parState.getLegalMoves("dieValueTotal", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValueTotal"; } else if (parState.getLegalMoves("dieValueTotal", i) >= 17 && parState.getLegalMoves("dieValueTotal", i) <= 67 && parState.getLegalMoves("dieValueTotal", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValueTotal"; } } // check the legal moves against player 2 if (parState.getLegalMoves("dieValue1", i) == player2Rect[j] && parState.getLegalMoves("dieValue1", i) != -1) { if (smartMoveEating == false) { smartMoveEating = true; smartPawn = i; smartDieValue = "dieValue1"; } else if (parState.getLegalMoves("dieValue1", i) >= 0 && parState.getLegalMoves("dieValue1", i) <= 12 && parState.getLegalMoves(smartDieValue, smartPawn) >= 17 && parState.getLegalMoves(smartDieValue, smartPawn) <= 67) { smartPawn = i; smartDieValue = "dieValue1"; } else if (parState.getLegalMoves("dieValue1", i) >= 0 && parState.getLegalMoves("dieValue1", i) <= 12 && parState.getLegalMoves("dieValue1", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValue1"; } else if (parState.getLegalMoves("dieValue1", i) >= 17 && parState.getLegalMoves("dieValue1", i) <= 67 && parState.getLegalMoves("dieValue1", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValue1"; } } if (parState.getLegalMoves("dieValue2", i) == player2Rect[j] && parState.getLegalMoves("dieValue2", i) != -1) { if (smartMoveEating == false) { smartMoveEating = true; smartPawn = i; smartDieValue = "dieValue2"; } else if (parState.getLegalMoves("dieValue2", i) >= 0 && parState.getLegalMoves("dieValue2", i) <= 12 && parState.getLegalMoves(smartDieValue, smartPawn) >= 17 && parState.getLegalMoves(smartDieValue, smartPawn) <= 67) { smartPawn = i; smartDieValue = "dieValue2"; } else if (parState.getLegalMoves("dieValue2", i) >= 0 && parState.getLegalMoves("dieValue2", i) <= 12 && parState.getLegalMoves("dieValue2", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValue2"; } else if (parState.getLegalMoves("dieValue2", i) >= 17 && parState.getLegalMoves("dieValue2", i) <= 67 && parState.getLegalMoves("dieValue2", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValue2"; } } if (parState.getLegalMoves("dieValueTotal", i) == player2Rect[j] && parState.getLegalMoves("dieValueTotal", i) != -1) { if (smartMoveEating == false) { smartMoveEating = true; smartPawn = i; smartDieValue = "dieValueTotal"; } else if (parState.getLegalMoves("dieValueTotal", i) >= 0 && parState.getLegalMoves("dieValueTotal", i) <= 12 && parState.getLegalMoves(smartDieValue, smartPawn) >= 17 && parState.getLegalMoves(smartDieValue, smartPawn) <= 67) { smartPawn = i; smartDieValue = "dieValueTotal"; } else if (parState.getLegalMoves("dieValueTotal", i) >= 0 && parState.getLegalMoves("dieValueTotal", i) <= 12 && parState.getLegalMoves("dieValueTotal", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValueTotal"; } else if (parState.getLegalMoves("dieValueTotal", i) >= 17 && parState.getLegalMoves("dieValueTotal", i) <= 67 && parState.getLegalMoves("dieValueTotal", i) > parState.getLegalMoves(smartDieValue, smartPawn)) { smartPawn = i; smartDieValue = "dieValueTotal"; } } } break; } } // if there was a smartMove for eating if (smartMoveEating == true) { smartMove = true; } // else, there was NO smart move for eating, moving into the safe zone // or homebase, AND moving out of the starting zone else { smartMove = false; } } // if there was a smartMove for going into the safe zone or home base else { smartMove = true; } } // if there was a smartMove for moving out of the starting zone else { smartMove = true; } } if (smartMove) { if (parState.getPawnActionMade() == false) { selectAction = new ParSelectAction(this, smartPawn); game.sendAction(selectAction); } else if (parState.getUseDieActionMade() == false) { if (smartDieValue.equals("dieValue1")) { smartDieValueIndex = 0; smartDieValueNumber = parState.getDice1Val(); } else if (smartDieValue.equals("dieValue2")) { smartDieValueIndex = 1; smartDieValueNumber = parState.getDice2Val(); } else if (smartDieValue.equals("dieValueTotal")) { smartDieValueIndex = 2; smartDieValueNumber = parState.getDice1Val() + parState.getDice2Val(); } useDieAction = new ParUseDieAction(this, smartDieValueNumber, smartDieValueIndex); game.sendAction(useDieAction); } else { moveAction = new ParMoveAction(this); game.sendAction(moveAction); smartMove = false; smartMoveStartingZone = false; smartMoveSafeZone = false; smartMoveEating = false; int smartPawn = -1; String smartDieValue = null; int smartDieValueIndex = -1; int smartDieValueNumber = -1; return; } } else { // if there is no smart move, then make a random move from the possible // legal moves available if (parState.getPawnActionMade() == false) { Log.i("selecting pawn", "" + parState.getPawnActionMade()); Random rand = new Random(); // choosing a random pawn int randSelect = rand.nextInt(4); //make action selectAction = new ParSelectAction(this, randSelect); //execute action game.sendAction(selectAction); return; } else if (parState.getUseDieActionMade() == false) { Log.i("selecting use die", "" + parState.getUseDieActionMade()); Random rand = new Random(); // choose a random die int randDie = rand.nextInt(3); switch (randDie) { //using first dice case 0: useDieAction = new ParUseDieAction(this, ((ParState) info).getDice1Val(), randDie); game.sendAction(useDieAction); break; //using second dice case 1: useDieAction = new ParUseDieAction(this, ((ParState) info).getDice2Val(), randDie); game.sendAction(useDieAction); break; //using total of die case 2: useDieAction = new ParUseDieAction(this, ((ParState) info).getDice1Val() + ((ParState) info).getDice2Val(), randDie); game.sendAction(useDieAction); break; } return; } else { moveAction = new ParMoveAction(this); game.sendAction(moveAction); return; } } } } // check if there are legal moves else { checkLegalMoveAction = new ParCheckLegalMoveAction(this); game.sendAction(checkLegalMoveAction); return; } } } }
package com.tencent.mm.pluginsdk.ui.wallet; import android.content.Context; import android.util.AttributeSet; import android.view.View.OnClickListener; import android.widget.ImageView; import com.tencent.mm.plugin.wxpay.a.e; import com.tencent.mm.plugin.wxpay.a.i; public class WalletIconImageView extends ImageView { private int jp; private int qUD; private OnClickListener qUE; public WalletIconImageView(Context context, AttributeSet attributeSet, int i) { super(context, attributeSet); this.qUD = -1; this.jp = 4; this.qUE = null; } public WalletIconImageView(Context context, AttributeSet attributeSet) { this(context, attributeSet, -1); } public void setImageResource(int i) { this.qUD = i; super.setImageResource(i); } public void setVisibility(int i) { this.jp = i; super.setVisibility(i); } public void setOnClickListener(OnClickListener onClickListener) { this.qUE = onClickListener; } public void setToClearState(OnClickListener onClickListener) { super.setVisibility(0); super.setImageResource(e.list_clear); super.setContentDescription(getContext().getString(i.clear_btn)); super.setOnClickListener(onClickListener); } public final void cfD() { super.setVisibility(this.jp); super.setImageResource(this.qUD); super.setOnClickListener(this.qUE); } }
package ar.com.corpico.appcorpico.orders.presentation; import android.content.Context; import android.graphics.Color; import android.view.LayoutInflater; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; import java.util.List; import ar.com.corpico.appcorpico.R; import ar.com.corpico.appcorpico.orders.domain.entity.Tipo_Cuadrilla; import ar.com.corpico.appcorpico.orders.domain.entity.Tipo_Trabajo; public class TipoCuadrillaAdapter extends ArrayAdapter<Tipo_Cuadrilla> { public TipoCuadrillaAdapter(Context context, List<Tipo_Cuadrilla> objects) { super(context, 0, objects); } @Override public android.view.View getView(final int position, android.view.View convertView, ViewGroup parent) { /* Obtener el objeto procesado actualmente */ Tipo_Cuadrilla tipoCuadrilla; /* Obtener LayoutInflater de la actividad */ LayoutInflater inflater = (LayoutInflater) parent.getContext(). getSystemService(Context.LAYOUT_INFLATER_SERVICE); /* Evitar inflar de nuevo un elemento previamente inflado */ if (convertView == null) { convertView = inflater.inflate( R.layout.custom_spinner_item, parent, false); } /* Instancias del Texto y el Icono */ TextView name = (TextView) convertView.findViewById(R.id.tipo_cuadrilla); name.setTextColor(Color.parseColor("#000000")); //Texto color Negro // Tipo_Trabajo actual.. tipoCuadrilla = getItem(position); /* Asignar valores */ name.setText(tipoCuadrilla.getTipo_cuadrilla()); return convertView; } @Override public android.view.View getDropDownView(int position, android.view.View convertView, ViewGroup parent) { return getView(position,convertView,parent); } }
package id.ac.um.produkskripsi; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import id.ac.um.produkskripsi.adapter.ListAdapter; public class HomeCB extends android.app.Fragment { @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_list, container, false); RecyclerView recyclerView = view.findViewById(R.id.listRecycler); ListAdapter listAdapter = new ListAdapter(); recyclerView.setAdapter(listAdapter); RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getActivity()); recyclerView.setLayoutManager(layoutManager); return view; } }
package littleservantmod.profession.mode; import java.util.HashMap; import java.util.List; import java.util.Map; import com.google.common.collect.Lists; import littleservantmod.api.profession.mode.IMode; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.INBTSerializable; public class ModeDispatcher implements INBTSerializable<NBTTagCompound> { private IMode[] modes; private Map<ResourceLocation, IMode> modesMap; private INBTSerializable<NBTBase>[] writers; private String[] names; /** 現在の職業のモード */ private IMode currentMode = null; public ModeDispatcher(Map<ResourceLocation, IMode> defaultModes, Map<ResourceLocation, IMode> list) { for (Map.Entry<ResourceLocation, IMode> entry : list.entrySet()) { defaultModes.put(entry.getKey(), entry.getValue()); } this.initNBT(defaultModes); } /**NBT関係の初期化処理*/ private void initNBT(Map<ResourceLocation, IMode> list) { List<IMode> lstCaps = Lists.newArrayList(); List<INBTSerializable<NBTBase>> lstWriters = Lists.newArrayList(); List<String> lstNames = Lists.newArrayList(); HashMap<ResourceLocation, IMode> mapRro = new HashMap<>(); for (Map.Entry<ResourceLocation, IMode> entry : list.entrySet()) { IMode prov = entry.getValue(); lstCaps.add(prov); mapRro.put(entry.getKey(), entry.getValue()); if (prov instanceof INBTSerializable) { lstWriters.add((INBTSerializable<NBTBase>) prov); lstNames.add(entry.getKey().toString()); } } modes = lstCaps.toArray(new IMode[lstCaps.size()]); modesMap = mapRro; writers = lstWriters.toArray(new INBTSerializable[lstWriters.size()]); names = lstNames.toArray(new String[lstNames.size()]); } public IMode[] getModes() { return modes; } public IMode getDefaultMode() { return modesMap.get(ModeEventHandler.kyeDefault); } public IMode getMode(ResourceLocation resourceLocation) { if (!this.modesMap.containsKey(resourceLocation)) { this.modesMap.get(ModeEventHandler.kyeDefault); } return this.modesMap.get(resourceLocation); } public void setCurrentMode(IMode mode) { this.currentMode = mode; } // NBT @Override public NBTTagCompound serializeNBT() { NBTTagCompound nbt = new NBTTagCompound(); for (int x = 0; x < writers.length; x++) { nbt.setTag(names[x], writers[x].serializeNBT()); } return nbt; } @Override public void deserializeNBT(NBTTagCompound nbt) { for (int x = 0; x < writers.length; x++) { if (nbt.hasKey(names[x])) { writers[x].deserializeNBT(nbt.getTag(names[x])); } } } }
package com.exercise.factorypal.rest.entity; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.AllArgsConstructor; import lombok.Data; import lombok.ToString; @Data @ToString @AllArgsConstructor public class MetricsPair { @JsonProperty("line_id") private long lineId; private Metrics metrics; }
package test; import org.testng.annotations.AfterMethod; import org.testng.annotations.Test; import page.LoginPage; public class LoginTest { LoginPage loginPage=new LoginPage(); @Test public void Login(){ loginPage.Login(); } @AfterMethod public void TearDown(){ } }
package com.locadoraveiculosweb.modelo; import javax.persistence.Entity; import javax.persistence.EnumType; import javax.persistence.Enumerated; import javax.persistence.ManyToOne; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import lombok.Getter; import lombok.Setter; @Getter @Setter @Entity @NamedQueries({ @NamedQuery( name = "ModeloCarro.findAll", query = "select mc from ModeloCarro mc " ) }) public class ModeloCarro extends BaseEntity { private static final long serialVersionUID = 1L; private String descricao; @ManyToOne private Fabricante fabricante; @Enumerated(EnumType.STRING) private Categoria categoria; }
package DEV; import static DEV.Conexion.conexion; import giovynet.nativelink.SerialPort; import giovynet.serial.Baud; import giovynet.serial.Com; import giovynet.serial.Parameters; import java.io.File; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.sql.Statement; import java.text.DateFormat; import java.text.DecimalFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Properties; import java.util.logging.Level; import java.util.logging.Logger; import java.util.regex.Pattern; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; import javax.swing.JOptionPane; import javax.swing.table.DefaultTableModel; import javax.swing.text.TabableView; import net.sf.jasperreports.engine.JRException; import net.sf.jasperreports.engine.JasperFillManager; import net.sf.jasperreports.engine.JasperPrint; import net.sf.jasperreports.engine.JasperReport; import net.sf.jasperreports.engine.util.JRLoader; import net.sf.jasperreports.view.JasperViewer; public class Metodos { public static String getNombreMetodo() { return new Exception().getStackTrace()[1].getMethodName(); } public static void MostrarError(Object error, String metodo) { JOptionPane.showMessageDialog(null, "Se ha detectado un error con los datos ingresados." + error); sendEmail(String.valueOf(error + " Ref: " + metodo)); } public static Date Fecha_hoy() { Date hoy = new Date(); return hoy; } public static void sendEmail(String mensaje) { try { // Propiedades de la conexión Properties props = new Properties(); props.setProperty("mail.smtp.host", "smtp.gmail.com"); props.setProperty("mail.smtp.starttls.enable", "true"); props.setProperty("mail.smtp.port", "587"); props.setProperty("mail.smtp.user", "estudiocuatrok@gmail.com"); props.setProperty("mail.smtp.auth", "true"); // Preparamos la sesion Session session = Session.getDefaultInstance(props); // Construimos el mensaje MimeMessage message = new MimeMessage(session); message.setFrom(new InternetAddress("estudiocuatrok@gmail.com")); message.addRecipient(Message.RecipientType.TO, new InternetAddress("estudiocuatrok@gmail.com")); message.setSubject("ERROR en Sistema Silos"); message.setText(mensaje); // Lo enviamos. Transport t = session.getTransport("smtp"); t.connect("estudiocuatrok@gmail.com", "Michalik87"); t.sendMessage(message, message.getAllRecipients()); // Cierre. t.close(); } catch (MessagingException ex) { MostrarError(ex, getNombreMetodo()); } } // -------------------------------------- Definicion de variables globales public static int max = 0; public static int id_transportista = 0; public static int recibo_de_dinero_id_cliente = 0; public static int recibo_de_dinero_id_moneda = 0; public static int combustible_uso_id_personal = 0; public static int combustible_venta_id_cliente = 0; public static int id_ticket = 0; public static int productos_aplicacion_id_parcela = 0; public static int productos_aplicacion_id_cultivo = 0; public static int id_combustible = 0; public static int id_vehiculo = 0; public static int id_parcela = 0; public static int id_camion = 0; public static int ventas_id_forma_pago = 0; public static int ventas_id_moneda = 0; public static int ventas_id_cliente = 0; public static int id_producto_aplicacion_detalle = 0; public static int id_facturas_compras = 0; public static int id_facturas_compras_detalle = 0; public static int compras_tipo = 0; public static int id_chofer = 0; public static int recepcion_id_motivo = 0; public static int Productos_aplicacion_abm_id_zafra = 0; public static int productos_aplicacion_abm_id_producto = 0; public static int recepcion_id_recepcion_detalle = 0; public static int productos_aplicacion_detalle_id_producto_aplicacion_detalle = 0; public static int recepcion_id_motivo_de_descuento = 0; public static int recibo_de_dinero_id_banco = 0; public static int tabla_ad_id_tipo = 0; public static int liquidaciones_multiples_id_recepcion = 0; public static int personales_pagos_id_concepto = 0; public static int personales_pagos_id_empleado = 0; public static int personales_pago_id_mes = 0; public static int consultas_id_recepcion = 0; public static int seleccionado = 0; public static int compras_id_moneda = 0; public static int consultas_id_cliente = 0; public static int compras_id_proveedor = 0; public static int contratos_recepcion_id_contrato = 0; public static int ventas_id_producto = 0; public static int id_combustible_uso_selected = 0; public static int id_sucursal_selected = 0; public static int listado_id_remitente = 0; public static int configuracion_id_sucursal_selected = 0; public static int combustibles_uso_id_vehiculo = 0; public static int id_carreta = 0; public static int id_empleado_cargo = 0; public static int id_granos_tipo = 0; public static int Contratos_listado_id_cliente = 0; public static int id_recepcion = 0; public static int dato_int = 0; public static int id_moneda = 0; public static int id_remitente = 0; public static int id_tecnologia = 0; public static int compras_id_producto = 0; public static int id_empleado = 0; public static boolean ismac = false; public static long cant = 0; public static long total_sin_descuento = 0; public static long cant_san_rafael = 0; public static int id_cuenta = 0; public static int id_recibo = 0; public static int id_usuario_selected = 0; public static int factura = 0; public static int id_cuenta_max = 0; public static int id_cliente = 0; public static int id_chofer_nuevo = 0; public static int id_usuario_buscar = 0; public static int id_ubicacion = 0; public static int id_cuenta_detalle = 0; public static int id_cuenta_detalle_facturacion = 0; public static int id = 0; public static int id_combustible_uso = 0; public static int formulario_que_pide = 0; public static ResultSetMetaData rsm; public static DefaultTableModel dtm; public static String comercio; public static String titulo; public static int id_comercio; public static int id_sucursal; public static int privilegio; public static int id_sueldo; public static int id_sueldo_detalle; public static String comercio_direccion; public static String empresa; public static String empresa_datos; public static String sucursal; public static String imagen; public static String path; public static String remitente; public static String ubicacion_proyecto; public static String ubicacion_reportes; public static String comercio_telefono; public static String comercio_email; public static String comercio_ruc; public static int id_proveedor = 1; public static int consultas_id_estado = 0; public static int id_productos_precio = 1; public static int id_medio_de_pago = 0; public static int id_producto_listado = 0; public static int habilitar_control_individual_de_pago = 0; public static int habilitar_medio_de_pago = 0; public static int bloquear_facturas = 0; public static int alerta_stock = 0; public static int habilitar_facturacion = 0; public static String caja_numero = "000"; public static String sucursal_numero = "000"; public static String rubro = ""; public static int id_productos_tipo = 0; public static int id_producto = 0; public static int tabla_ad_id_concepto = 0; public static int id_rubro = 0; public static int id_venta = 0; public static int id_recepcion_detalle = 0; public static int id_venta_detalle = 0; public static boolean error; public static boolean error_cuenta_detalle; public static PreparedStatement ps; public static ResultSet rs; public static int id_pedido_interno = 0; public static int id_pagare = 0; public static int id_zafra = 0; public static int id_contrato = 0; public static int productos_id_proveedor = 0; public static int id_combustible_venta = 0; public static int id_producto_aplicacion = 0; public static int pedidos = 0; public static int precio_automatico = 0; public static int venta_terminar = 0; public static int venta_terminar_con_nedio_de_pago = 0; public static int formulario_externo = 0; public static int entro = 0; public static String id_pedido_seleccionado = null; public static String nombre = null; public static String ruta_imagen = null; public static ArrayList<String> AI = new ArrayList<>(); public static boolean existe = false; public static int tipo_de_venta = 0; public static int id_cliente_listado = 0; public static int id_usuario_ABM = 0; public static int id_usuario = 0; public static int id_motivo = 0; public static int contrato_recepcion_id_zafra = 0; public static int contrato_recepcion_id_cliente = 0; public static int recepcion_id_zafra = 0; public static int uso_de_productos_listado_id_parcela = 0; public static int uso_de_productos_listado_id_zafra = 0; public static int uso_de_productos_listado_id_cultivo = 0; public static int recepcion_id_variedad = 0; public static int recepcion_id_remitente = 0; public static int contratos_id_zafra = 0; public static int contratos_id_cliente = 0; public static int listado_recepcion_pendiente_id_cliente = 0; public static int ultimo_producto_agregado_id_cuenta_detalle = 0; public static int productos_aplicacion_id_tipo = 0; public static long total = 0; public static Date hoy = new Date(); public static boolean error_impurezas; public static boolean error_humedad; public static boolean error_ardido; public static boolean error_quebrado; public static boolean error_chuzos; public static boolean error_verdes; public static DecimalFormat formato = new DecimalFormat("#,###,###,###"); // public static void Contratos_clear() { // Contratos.jTextField_cliente.setText(""); // Contratos.jTextField_contrato.setText(""); // Contratos.jTextField_premio.setText(""); // Contratos.jTextField_toneladas.setText(""); // Contratos.jTextField_zafra.setText(""); // id_contrato = 0; // contratos_id_cliente = 0; // contratos_id_zafra = 0; // Contratos.jTextField_cliente.requestFocus(); // } public static double Recepcion_total_a_pagar(String precio) { double total_a_pagar = 0; double total_a_pagar_long = 0; double neto = 0; try { Statement ST_recepcion = conexion.createStatement(); ResultSet RS_recepcion = ST_recepcion.executeQuery("SELECT * FROM recepcion where id_recepcion = '" + id_recepcion + "'"); while (RS_recepcion.next()) { neto = RS_recepcion.getLong("total_neto_carga"); } total_a_pagar = Double.parseDouble(precio) * (neto / 1000); } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } return total_a_pagar; } // public static void Compras_buscar() { // try { // Statement ST_recepcion = conexion.createStatement(); // ResultSet RS_recepcion = ST_recepcion.executeQuery("" // + "SELECT * " // + "FROM facturas_compra " // + "inner join proveedor on proveedor.id_proveedor = facturas_compra.id_proveedor " // + "inner join factura_tipo on factura_tipo.id_factura_tipo = facturas_compra.id_factura_tipo " // + "inner join moneda on moneda.id_moneda = facturas_compra.id_moneda " // + "where id_facturas_compra = '" + id_facturas_compras + "'"); // while (RS_recepcion.next()) { // Compras.jT_factura_nro.setText(RS_recepcion.getString("numero").trim()); // Compras.jDateChooser.setDate(RS_recepcion.getDate("fecha")); // Compras.jT_Proveedor.setText(RS_recepcion.getString("nombre").trim()); // Compras.jT_tipo.setText(RS_recepcion.getString("tipo").trim()); // Compras.jT_moneda.setText(RS_recepcion.getString("moneda").trim()); // compras_id_proveedor = RS_recepcion.getInt("id_proveedor"); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // } // } // public static void Compras_total() { // try { // Statement ST_recepcion = conexion.createStatement(); // ResultSet RS_recepcion = ST_recepcion.executeQuery("" // + "SELECT SUM(precio) " // + "FROM facturas_compra_detalle " // + "where id_facturas_compra = '" + id_facturas_compras + "'"); // while (RS_recepcion.next()) { // Compras.jTextField_total.setText(RS_recepcion.getString(1)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // } // } // public static void Ventas_traer_datos() { // try { // Statement ST_recepcion = conexion.createStatement(); // ResultSet RS_recepcion = ST_recepcion.executeQuery("" // + "SELECT * " // + "FROM venta " // + "inner join cliente on cliente.id_cliente = venta.id_cliente " // + "inner join venta_forma_pago on venta_forma_pago.id_venta_forma_pago = venta.id_venta_forma_pago " // + "inner join moneda on moneda.id_moneda = venta.id_moneda " // + "where id_venta = '" + id_venta + "' "); // while (RS_recepcion.next()) { // Ventas.jTextField_cliente.setText(RS_recepcion.getString("nombre").trim()); // Ventas.jTextField_forma_pago.setText(RS_recepcion.getString("forma_pago")); // ventas_id_forma_pago = RS_recepcion.getInt("id_venta_forma_pago"); // Ventas.jTextField_moneda.setText(RS_recepcion.getString("moneda")); // ventas_id_moneda = RS_recepcion.getInt("id_moneda"); // Ventas.jTextField_numero.setText(RS_recepcion.getString("numero")); // Ventas.jTextField_total.setText(num.format(RS_recepcion.getLong("total"))); // Ventas.jDateChooser_fecha.setDate(RS_recepcion.getDate("fecha")); // Ventas.jTextField_numero.setText(RS_recepcion.getString("id_venta")); // } // ST_recepcion = conexion.createStatement(); // RS_recepcion = ST_recepcion.executeQuery("" // + "SELECT sum(exentas) " // + "FROM venta_detalle " // + "where id_venta = '" + id_venta + "' "); // while (RS_recepcion.next()) { // Ventas.jTextField_total_0.setText(String.valueOf(num.format(RS_recepcion.getDouble(1)))); // } // // ST_recepcion = conexion.createStatement(); // RS_recepcion = ST_recepcion.executeQuery("" // + "SELECT sum(cinco) " // + "FROM venta_detalle " // + "where id_venta = '" + id_venta + "' "); // while (RS_recepcion.next()) { // Ventas.jTextField_total_5.setText(String.valueOf(num.format(RS_recepcion.getDouble(1)))); // double iva5 = 0; // iva5 = (RS_recepcion.getDouble(1) / 21); // Ventas.jTextField_iva_5.setText(String.valueOf(num.format(iva5))); // } // ST_recepcion = conexion.createStatement(); // RS_recepcion = ST_recepcion.executeQuery("" // + "SELECT sum(diez) " // + "FROM venta_detalle " // + "where id_venta = '" + id_venta + "' "); // while (RS_recepcion.next()) { // Ventas.jTextField_total_10.setText(String.valueOf(num.format(RS_recepcion.getDouble(1)))); // double iva10 = 0; // iva10 = (RS_recepcion.getDouble(1) / 11); // Ventas.jTextField_iva_10.setText(String.valueOf(num.format(iva10))); // } // // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // } // } // // public static void Recibo_de_dinero_traer_datos() { // try { // Statement ST_recepcion = conexion.createStatement(); // ResultSet RS_recepcion = ST_recepcion.executeQuery("" // + "SELECT * " // + "FROM recibo " // + "inner join cliente on cliente.id_cliente = recibo.id_cliente " // + "inner join moneda on moneda.id_moneda = recibo.id_moneda " // + "inner join banco on banco.id_banco = recibo.id_banco " // + "where id_recibo = '" + id_recibo + "' "); // while (RS_recepcion.next()) { // recibo_de_dinero_id_banco = RS_recepcion.getInt("id_banco"); // recibo_de_dinero_id_cliente = RS_recepcion.getInt("id_cliente"); // recibo_de_dinero_id_moneda = RS_recepcion.getInt("id_moneda"); // // Recibo_de_dinero.jTextField_cliente.setText(RS_recepcion.getString("nombre").trim()); // Recibo_de_dinero.jTextField_banco.setText(RS_recepcion.getString("banco")); // Recibo_de_dinero.jTextField_moneda.setText((RS_recepcion.getString("moneda"))); // Recibo_de_dinero.jDateChooser2.setDate(RS_recepcion.getDate("fecha")); // Recibo_de_dinero.jTextField_cheque.setText(RS_recepcion.getString("cheque")); // Recibo_de_dinero.jTextField_concepto.setText(RS_recepcion.getString("concepto")); // Recibo_de_dinero.jTextField_dinero.setText(String.valueOf(RS_recepcion.getLong("cantidad"))); // } // // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // } // } // // public static void Ventas_calculo() { // try { // // Statement ST_recepcion = conexion.createStatement(); // ResultSet RS_recepcion = ST_recepcion.executeQuery("" // + "SELECT * " // + "FROM venta " // + "where id_venta = '" + id_venta + "' "); // while (RS_recepcion.next()) { // Ventas.jTextField_total.setText(num.format(RS_recepcion.getLong("total"))); // } // // ST_recepcion = conexion.createStatement(); // RS_recepcion = ST_recepcion.executeQuery("" // + "SELECT sum(exentas) " // + "FROM venta_detalle " // + "where id_venta = '" + id_venta + "' "); // while (RS_recepcion.next()) { // Ventas.jTextField_total_0.setText(String.valueOf(num.format(RS_recepcion.getDouble(1)))); // } // // ST_recepcion = conexion.createStatement(); // RS_recepcion = ST_recepcion.executeQuery("" // + "SELECT sum(cinco) " // + "FROM venta_detalle " // + "where id_venta = '" + id_venta + "' "); // while (RS_recepcion.next()) { // Ventas.jTextField_total_5.setText(String.valueOf(num.format(RS_recepcion.getDouble(1)))); // double iva5 = 0; // iva5 = (RS_recepcion.getDouble(1) / 21); // Ventas.jTextField_iva_5.setText(String.valueOf(num.format(iva5))); // } // ST_recepcion = conexion.createStatement(); // RS_recepcion = ST_recepcion.executeQuery("" // + "SELECT sum(diez) " // + "FROM venta_detalle " // + "where id_venta = '" + id_venta + "' "); // while (RS_recepcion.next()) { // Ventas.jTextField_total_10.setText(String.valueOf(num.format(RS_recepcion.getDouble(1)))); // double iva10 = 0; // iva10 = (RS_recepcion.getDouble(1) / 11); // Ventas.jTextField_iva_10.setText(String.valueOf(num.format(iva10))); // } // // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // } // } // // public static DecimalFormat num = new DecimalFormat("#,###.##"); // // public static void Sueldo_detalle_get_total() { // try { // long total = 0; // long diferencia = 0; // // Statement ST_recepcion = conexion.createStatement(); // ResultSet RS_recepcion = ST_recepcion.executeQuery("" // + "select * " // + "from sueldo_detalle " // + "inner join concepto_de_pago on concepto_de_pago.id_concepto_de_pago = sueldo_detalle.id_concepto_de_pago " // + "where id_sueldo = '" + id_sueldo + "'"); // while (RS_recepcion.next()) { // if (RS_recepcion.getLong("importe") < 1) { // // } else { // total = (RS_recepcion.getLong("importe")) + total; // } // diferencia = RS_recepcion.getLong("importe") + diferencia; // } // Personales_pagos_ABM.jTextField_diferencia.setText(formato.format(diferencia)); // Personales_pagos_ABM.jTextField_total.setText(formato.format(total)); // // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // } // } // // public static void Contrato_traer_datos() { // try { // Statement ST = conexion.createStatement(); // ResultSet RS = ST.executeQuery("" // + "SELECT * FROM contrato " // + "inner join cliente on cliente.id_cliente = contrato.id_cliente " // + "inner join zafra on zafra.id_zafra = contrato.id_zafra " // + "where id_contrato = '" + id_contrato + "' "); // while (RS.next()) { // if (RS.getString("nombre") != null) { // Contratos.jTextField_cliente.setText(RS.getString("nombre").trim()); // } // contratos_id_cliente = RS.getInt("id_cliente"); // if (RS.getString("nro") != null) { // Contratos.jTextField_contrato.setText(RS.getString("nro").trim()); // } // if (RS.getString("premio") != null) { // Contratos.jTextField_premio.setText(RS.getString("premio").trim()); // } // if (RS.getString("tonelada") != null) { // Contratos.jTextField_toneladas.setText(RS.getString("tonelada").trim()); // } // if (RS.getString("zafra") != null) { // Contratos.jTextField_zafra.setText(RS.getString("zafra").trim()); // } // if (RS.getString("fecha") != null) { // Contratos.jDateChooser_fecha.setDate(RS.getDate("fecha")); // } // contratos_id_zafra = RS.getInt("id_zafra"); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // } // } // // public synchronized static void Compras_actualizar(String numero) { // try { // PreparedStatement st = conexion.prepareStatement("" // + "UPDATE facturas_compra " // + "SET fecha_date ='" + util_Date_to_sql_date(Compras.jDateChooser.getDate()) + "', " // + "id_proveedor ='" + id_proveedor + "', " // + "numero ='" + numero + "' " // + "WHERE id_facturas_compra = '" + id_facturas_compras + "'"); // st.executeUpdate(); // JOptionPane.showMessageDialog(null, "Datos actualizados correctamente"); // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // } // } // // public synchronized static void Compras_tipo_factura_update() { // try { // int tipo = 0; // Statement ST = conexion.createStatement(); // ResultSet RS = ST.executeQuery("" // + "SELECT * FROM facturas_compra " // + "where id_facturas_compra = '" + id_facturas_compras + "' "); // while (RS.next()) { // tipo = RS.getInt("id_factura_tipo"); // } // if (tipo == 2) { // PreparedStatement st = conexion.prepareStatement("" // + "UPDATE facturas_compra " // + "SET id_factura_tipo ='1' " // + "WHERE id_facturas_compra = '" + id_facturas_compras + "'"); // st.executeUpdate(); // Compras.jT_tipo.setText("CONTADO"); // } else { // PreparedStatement st = conexion.prepareStatement("" // + "UPDATE facturas_compra " // + "SET id_factura_tipo ='2' " // + "WHERE id_facturas_compra = '" + id_facturas_compras + "'"); // st.executeUpdate(); // Compras.jT_tipo.setText("CREDITO"); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // } // } // // public synchronized static void Compras_moneda_update() { // try { // int tipo = 0; // Statement ST = conexion.createStatement(); // ResultSet RS = ST.executeQuery("" // + "SELECT * FROM facturas_compra " // + "where id_facturas_compra = '" + id_facturas_compras + "' "); // while (RS.next()) { // tipo = RS.getInt("id_moneda"); // } // if (tipo == 2) { // PreparedStatement st = conexion.prepareStatement("" // + "UPDATE facturas_compra " // + "SET id_moneda ='1' " // + "WHERE id_facturas_compra = '" + id_facturas_compras + "'"); // st.executeUpdate(); // Compras.jT_moneda.setText("GS"); // } else { // PreparedStatement st = conexion.prepareStatement("" // + "UPDATE facturas_compra " // + "SET id_moneda ='2' " // + "WHERE id_facturas_compra = '" + id_facturas_compras + "'"); // st.executeUpdate(); // Compras.jT_moneda.setText("USD"); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // } // } // // public synchronized static void Ventas_actualizar_tipo() { // try { // int tipo = 0; // Statement ST = conexion.createStatement(); // ResultSet RS = ST.executeQuery("" // + "SELECT * FROM venta " // + "where id_venta = '" + id_venta + "' "); // while (RS.next()) { // tipo = RS.getInt("id_venta_forma_pago"); // } // if (tipo == 2) { // PreparedStatement st = conexion.prepareStatement("" // + "UPDATE venta " // + "SET id_venta_forma_pago ='1' " // + "WHERE id_venta = '" + id_venta + "'"); // st.executeUpdate(); // Ventas.jTextField_forma_pago.setText("CONTADO"); // } else { // PreparedStatement st = conexion.prepareStatement("" // + "UPDATE venta " // + "SET id_venta_forma_pago ='2' " // + "WHERE id_venta = '" + id_venta + "'"); // st.executeUpdate(); // Ventas.jTextField_forma_pago.setText("CREDITO"); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public synchronized static void Ventas_moneda_update() { // try { // // int moneda = 0; // // Statement ST = conexion.createStatement(); // ResultSet RS = ST.executeQuery("" // + "SELECT * FROM venta " // + "where id_venta = '" + id_venta + "' "); // while (RS.next()) { // moneda = RS.getInt("id_moneda"); // } // // if (moneda == 1) { // moneda = 2; // Ventas.jTextField_moneda.setText("USD"); // } else { // Ventas.jTextField_moneda.setText("GS."); // moneda = 1; // } // // PreparedStatement st = conexion.prepareStatement("" // + "UPDATE venta " // + "SET id_moneda ='" + moneda + "' " // + "WHERE id_venta = '" + id_venta + "'"); // st.executeUpdate(); // // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public synchronized static void Consultas_seleccionar_update() { // try { // PreparedStatement st = conexion.prepareStatement("" // + "UPDATE recepcion " // + "SET seleccionado ='" + seleccionado + "' " // + "WHERE id_recepcion = '" + consultas_id_recepcion + "'"); // st.executeUpdate(); // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } public synchronized static void Liquidaciones_multiples_recepcion_update(int valor) { try { PreparedStatement st = conexion.prepareStatement("" + "UPDATE recepcion " + "SET seleccionado ='" + valor + "' " + "WHERE id_recepcion = '" + liquidaciones_multiples_id_recepcion + "'"); st.executeUpdate(); } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Consultas_seleccionar_update_all() { try { PreparedStatement st = conexion.prepareStatement("" + "UPDATE recepcion " + "SET seleccionado ='" + seleccionado + "' " + "WHERE seleccionado = '1'"); st.executeUpdate(); } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Ventas_update_moneda() { try { int dolar = 0; if (ventas_id_moneda == 1) { dolar = 1; } if (ventas_id_moneda == 2) { PreparedStatement ps3 = conexion.prepareStatement("select * from configuracion "); ResultSet rs3 = ps3.executeQuery(); while (rs3.next()) { dolar = rs3.getInt("dolar"); } } PreparedStatement st = conexion.prepareStatement("" + "UPDATE venta " + "SET id_moneda ='" + ventas_id_moneda + "', " + "dolar = '" + dolar + "' " + "WHERE id_venta = '" + id_venta + "'" ); st.executeUpdate(); } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } // // public synchronized static void Compras_tipo_update() { // try { // // if (compras_tipo == 2) { // PreparedStatement st = conexion.prepareStatement("" // + "UPDATE facturas_compra " // + "SET tipo = '1'," // + "tipo_str = 'CONTADO' " // + "WHERE id_facturas_compra = '" + id_facturas_compras + "'"); // st.executeUpdate(); // compras_tipo = 1; // Compras.jT_tipo.setText("CONTADO"); // } else { // PreparedStatement st = conexion.prepareStatement("" // + "UPDATE facturas_compra " // + "SET tipo = '2'," // + "tipo_str = 'CREDITO' " // + "WHERE id_facturas_compra = '" + id_facturas_compras + "'"); // st.executeUpdate(); // compras_tipo = 2; // Compras.jT_tipo.setText("CREDITO"); // // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } public synchronized static void Contratos_recepcion_update() { try { PreparedStatement st = conexion.prepareStatement("" + "UPDATE contrato " + "SET estado ='2', " + "estado_str = 'Cumplido' " + "WHERE id_contrato = '" + contratos_recepcion_id_contrato + "'"); st.executeUpdate(); } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Ventas_update_cliente() { try { PreparedStatement st = conexion.prepareStatement("" + "UPDATE venta " + "SET id_cliente ='" + ventas_id_cliente + "' " + "WHERE id_venta = '" + id_venta + "'"); st.executeUpdate(); } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Configuracion_sucursal_guardar(String numero) { try { PreparedStatement st = conexion.prepareStatement("" + "UPDATE sucursal " + "SET numero_remision ='" + Integer.parseInt(numero) + "' " + "where id_sucursal ='" + configuracion_id_sucursal_selected + "'"); st.executeUpdate(); } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public static void Combustible_venta_max() { try { Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("SELECT MAX(id_combustible_venta) FROM combustible_venta"); if (result.next()) { id_combustible_venta = result.getInt(1); } } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public static void Productos_aplicacion_abm_max() { try { Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("SELECT MAX(id_producto_aplicacion) FROM producto_aplicacion"); if (result.next()) { id_producto_aplicacion = result.getInt(1); } } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public static void Sueldo_max() { try { Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("SELECT MAX(id_sueldo) FROM sueldo"); if (result.next()) { id_sueldo = result.getInt(1); } } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public static void Compras_max() { try { Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("SELECT MAX(id_facturas_compra) FROM facturas_compra"); if (result.next()) { id_facturas_compras = result.getInt(1); } } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Ventas_max() { try { Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("SELECT MAX(id_venta) FROM venta "); if (result.next()) { id_venta = result.getInt(1); } } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Ventas_guardar() { try { Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("SELECT MAX(id_venta) FROM venta"); if (result.next()) { id_venta = result.getInt(1) + 1; } PreparedStatement stUpdateProducto = conexion.prepareStatement("INSERT INTO venta VALUES(?,?,?,?,?,?,?)"); stUpdateProducto.setInt(1, id_venta); stUpdateProducto.setInt(2, 0); stUpdateProducto.setDate(3, util_Date_to_sql_date(hoy)); stUpdateProducto.setLong(4, 0); stUpdateProducto.setInt(5, ventas_id_cliente); stUpdateProducto.setInt(6, ventas_id_forma_pago); stUpdateProducto.setInt(7, ventas_id_moneda); stUpdateProducto.executeUpdate(); } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void TablaAD_guardar(String cantidad, String porcentaje) { try { Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("SELECT MAX(id_tablaad) FROM tabla_ad"); if (result.next()) { id = result.getInt(1) + 1; } PreparedStatement st = conexion.prepareStatement("INSERT INTO tabla_ad VALUES(?,?,?,?,?,?)"); st.setInt(1, id); st.setInt(2, tabla_ad_id_tipo); st.setInt(3, tabla_ad_id_concepto); st.setDouble(4, Double.parseDouble(cantidad)); st.setDouble(5, Double.parseDouble(porcentaje)); st.setString(6, "D"); st.executeUpdate(); } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } // public synchronized static void Productos_aplicacion_abm_guardar_detalle(String dosis, String has_str) { // try { // // double dosis_double = Double.parseDouble(dosis); // double has = Double.parseDouble(has_str); // double precio = 0; // Statement st1 = conexion.createStatement(); // ResultSet result = st1.executeQuery("SELECT * FROM productos where id_producto = '" + productos_aplicacion_abm_id_producto + "' "); // if (result.next()) { // precio = result.getDouble("precio"); // } // // PreparedStatement stUpdateProducto = conexion.prepareStatement("INSERT INTO producto_aplicacion_detalle VALUES(?,?,?,?,?,?,?)"); // stUpdateProducto.setInt(1, MAX_tabla("id_producto_aplicacion_detalle", "producto_aplicacion_detalle")); // stUpdateProducto.setInt(2, id_producto_aplicacion); // stUpdateProducto.setInt(3, productos_aplicacion_abm_id_producto); // stUpdateProducto.setDouble(4, dosis_double); // stUpdateProducto.setDouble(5, dosis_double * has); // stUpdateProducto.setDouble(6, has); // stUpdateProducto.setDouble(7, precio); // stUpdateProducto.executeUpdate(); // // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } public synchronized static void Productos_aplicacion_abm_guardar(Date fecha) { try { if (productos_aplicacion_id_cultivo == 0) { JOptionPane.showMessageDialog(null, "Debes elegir un tipo de cultivo para continuar."); } else { if (id_producto_aplicacion == 0) { Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("SELECT MAX(id_producto_aplicacion) FROM producto_aplicacion "); if (result.next()) { id_producto_aplicacion = result.getInt(1) + 1; } int aplicacion = 1; ResultSet rs3 = st1.executeQuery("SELECT MAX(aplicacion) FROM producto_aplicacion " + "where id_granos_tipo = '" + productos_aplicacion_id_cultivo + "' " + "and id_parcela = '" + productos_aplicacion_id_parcela + "' " + "and id_zafra = '" + Productos_aplicacion_abm_id_zafra + "' " + "and aplicacion != '2' "); while (rs3.next()) { aplicacion = rs3.getInt(1) + 1; } PreparedStatement stUpdateProducto = conexion.prepareStatement("INSERT INTO producto_aplicacion VALUES(?,?,?,?,?,?,?)"); stUpdateProducto.setInt(1, id_producto_aplicacion); stUpdateProducto.setInt(2, productos_aplicacion_id_cultivo); stUpdateProducto.setInt(3, productos_aplicacion_id_parcela); stUpdateProducto.setInt(4, Productos_aplicacion_abm_id_zafra); stUpdateProducto.setDate(5, util_Date_to_sql_date(fecha)); stUpdateProducto.setInt(6, aplicacion); stUpdateProducto.setInt(7, productos_aplicacion_id_tipo); stUpdateProducto.executeUpdate(); } else { PreparedStatement st2 = conexion.prepareStatement("" + "UPDATE producto_aplicacion " + "SET id_granos_tipo ='" + productos_aplicacion_id_cultivo + "', " + "id_parcela ='" + productos_aplicacion_id_parcela + "', " + "fecha ='" + util_Date_to_sql_date(fecha) + "', " + "id_zafra ='" + Productos_aplicacion_abm_id_zafra + "' " + "WHERE id_producto_aplicacion = '" + id_producto_aplicacion + "'"); st2.executeUpdate(); } } } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public static boolean Verificar_tabla_ad(int tipo_descuento, double valor, int tipo) { error = true; try { Statement ST = conexion.createStatement(); ResultSet RS = ST.executeQuery("SELECT * FROM tabla_ad where cantidad= '" + valor + "' and id_concepto_tabla_ad='" + tipo_descuento + "' and id_granos_tipo = '" + tipo + "' "); while (RS.next()) { error = false; } } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } return error; } public synchronized static void Recepcion_detalle_guardar(String valor) { try { double valor_double = Double.parseDouble(valor); Verificar_tabla_ad(recepcion_id_motivo_de_descuento, valor_double, id_granos_tipo); if (error == false) { Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("SELECT MAX(id_recepcion_detalle) FROM recepcion_detalle "); if (result.next()) { id_recepcion_detalle = result.getInt(1) + 1; } double peso_neto = 0; double total_descuento = 0; double valor_porcentaje = valor_double; st1 = conexion.createStatement(); result = st1.executeQuery("SELECT * FROM recepcion where id_recepcion = '" + id_recepcion + "'"); if (result.next()) { peso_neto = result.getDouble("peso_neto"); } st1 = conexion.createStatement(); result = st1.executeQuery("" + "SELECT * FROM tabla_ad " + "where cantidad= '" + valor_double + "'" + "and id_concepto_tabla_ad='" + recepcion_id_motivo_de_descuento + "' and id_granos_tipo = '" + id_granos_tipo + "'"); while (result.next()) { valor_double = result.getDouble("porcentaje"); } PreparedStatement stUpdateProducto = conexion.prepareStatement("INSERT INTO recepcion_detalle VALUES(?,?,?,?,?,?)"); stUpdateProducto.setInt(1, id_recepcion_detalle); stUpdateProducto.setInt(2, id_recepcion); stUpdateProducto.setInt(3, recepcion_id_motivo_de_descuento); stUpdateProducto.setDouble(4, valor_double); stUpdateProducto.setDouble(5, peso_neto * valor_double / 100); stUpdateProducto.setDouble(6, valor_porcentaje); stUpdateProducto.executeUpdate(); } else { JOptionPane.showMessageDialog(null, "ATENCION. El valor ingresado no se encuentra en la tabla de DESCUENTOS."); } } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Remitente_guardar(String remitente) { try { Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("SELECT MAX(id_remitente) FROM remitente"); if (result.next()) { id_remitente = result.getInt(1) + 1; } PreparedStatement stUpdateProducto = conexion.prepareStatement("INSERT INTO remitente VALUES(?,?)"); stUpdateProducto.setInt(1, id_remitente); stUpdateProducto.setString(2, remitente); stUpdateProducto.executeUpdate(); JOptionPane.showMessageDialog(null, "Agregado correctamente"); } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Compras_guardar() { try { Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("SELECT MAX(id_facturas_compra) FROM facturas_compra "); if (result.next()) { id_facturas_compras = result.getInt(1) + 1; } PreparedStatement stUpdateProducto = conexion.prepareStatement("INSERT INTO facturas_compra VALUES(?,?,?,?,?,?,?,?)"); stUpdateProducto.setInt(1, id_facturas_compras); stUpdateProducto.setString(2, "0"); stUpdateProducto.setInt(3, 0); // proveedor no especificado stUpdateProducto.setDate(4, util_Date_to_sql_date(hoy)); stUpdateProducto.setLong(5, 1); stUpdateProducto.setLong(6, 1); stUpdateProducto.setLong(7, 0); stUpdateProducto.setLong(8, 1); stUpdateProducto.executeUpdate(); } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Ventas_detalle_guardar(String precio, String unidad) { try { double precio_double = Double.valueOf(precio); double unidad_double = Double.valueOf(unidad); Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("SELECT MAX(id_venta_detalle) FROM venta_detalle"); if (result.next()) { id_venta_detalle = result.getInt(1) + 1; } int iva = 0; st1 = conexion.createStatement(); result = st1.executeQuery("SELECT * FROM productos where id_producto = '" + ventas_id_producto + "'"); if (result.next()) { if (result.getInt("iva") == 5) { iva = 5; } if (result.getInt("iva") == 10) { iva = 10; } } PreparedStatement stUpdateProducto = conexion.prepareStatement("INSERT INTO venta_detalle VALUES(?,?,?,?,?,?,?,?,?)"); stUpdateProducto.setInt(1, id_venta_detalle); stUpdateProducto.setDouble(2, precio_double); stUpdateProducto.setDouble(3, unidad_double); stUpdateProducto.setDouble(4, 0); stUpdateProducto.setInt(5, id_venta); stUpdateProducto.setInt(6, ventas_id_producto); if (iva == 0) { stUpdateProducto.setDouble(7, (precio_double * unidad_double)); } else { stUpdateProducto.setDouble(7, 0); } if (iva == 5) { stUpdateProducto.setDouble(8, (precio_double * unidad_double)); } else { stUpdateProducto.setDouble(8, 0); } if (iva == 10) { stUpdateProducto.setDouble(9, (precio_double * unidad_double)); } else { stUpdateProducto.setDouble(9, 0); } stUpdateProducto.executeUpdate(); } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public static long Recepcion_total_a_pagar_long(String precio) { long total_a_pagar = 0; long neto = 0; try { Statement ST_recepcion = conexion.createStatement(); ResultSet RS_recepcion = ST_recepcion.executeQuery("SELECT * FROM recepcion where id_recepcion = '" + id_recepcion + "'"); while (RS_recepcion.next()) { neto = RS_recepcion.getLong("total_neto_carga"); } total_a_pagar = Long.parseLong(precio) * neto; } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } return total_a_pagar; } // public static void Ventas_calculo() { // try { // Statement ST_recepcion = conexion.createStatement(); // ResultSet RS_recepcion = ST_recepcion.executeQuery("" // + "SELECT sum(total) " // + "FROM venta_detalle " // + "where id_venta = '" + id_venta + "'"); // while (RS_recepcion.next()) { // Ventas.jTextField_total.setText(String.valueOf(RS_recepcion.getDouble(1))); // } // // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // } // } public static String Obtener_peso() { String peso = ""; JOptionPane.showMessageDialog(null, "Entrando.."); try { SerialPort serialPort = new SerialPort(); List<String> lstFreeSerialPort = serialPort.getFreeSerialPort();//Gets a list of serial ports free JOptionPane.showMessageDialog(null, "puerto asignado: " + lstFreeSerialPort.get(0)); Parameters parameters = new Parameters();//Create a parameter object parameters.setPort(lstFreeSerialPort.get(0));//assigns the first port found parameters.setBaudRate(Baud._4800);//assigns baud rate parameters.setByteSize("8");// assigns byte size parameters.setParity("N");// assigns parity Com com = new Com(parameters);// With the "parameters" creates a "Com" int ok = 0; int dataReceived = 0; for (int i = 0; i < 20; i++) {//Send and receive data every 800 milliseconds dataReceived = com.receiveSingleCharAsInteger(); if (dataReceived > 0) { if (ok == 0) { peso = String.valueOf(dataReceived); ok = 1; } } JOptionPane.showMessageDialog(null, "Alerta " + String.valueOf(dataReceived)); } com.close(); } catch (Exception ex) { MostrarError(ex, getNombreMetodo()); } return peso; } // // public static void Humedad_verificar() { // try { // error_humedad = true; // if (isNumericDouble(Recepcion_ABM.jTextField_humedad.getText().trim())) { // // Statement ST_tabla_ad_humedad = conexion.createStatement(); // ResultSet RS_tabla_ad_humedad = ST_tabla_ad_humedad.executeQuery("SELECT * FROM tabla_ad where cantidad= '" + Recepcion_ABM.jTextField_humedad.getText() + "' and id_concepto_tabla_ad='1'"); // while (RS_tabla_ad_humedad.next()) { // error_humedad = false; // } // if (error_humedad) { // JOptionPane.showMessageDialog(null, "ATENCION. Valor de humedad no encontrado en la tabla AD."); // Recepcion_ABM.jTextField_humedad.setText(""); // Recepcion_ABM.jTextField_humedad.requestFocus(); // } // } else { // JOptionPane.showMessageDialog(null, "ATENCION. Valor de humedad."); // Recepcion_ABM.jTextField_humedad.requestFocus(); // } // // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // public static void Ardidos_verificar() { // try { // error_ardido = true; // if (isNumericDouble(Recepcion_ABM.jTextField_ardidos.getText().trim())) { // Statement ST_tabla_ad_ardidos = conexion.createStatement(); // ResultSet RS_tabla_ad_ardidos = ST_tabla_ad_ardidos.executeQuery("SELECT * FROM tabla_ad where cantidad= '" + Recepcion_ABM.jTextField_ardidos.getText() + "' and id_concepto_tabla_ad='5'"); // while (RS_tabla_ad_ardidos.next()) { // error_ardido = false; // } // if (error_ardido) { // JOptionPane.showMessageDialog(null, "ATENCION. Valor de Ardidos no encontrado en la tabla AD."); // Recepcion_ABM.jTextField_ardidos.setText(""); // Recepcion_ABM.jTextField_ardidos.requestFocus(); // } // } else { // JOptionPane.showMessageDialog(null, "ATENCION. Valor de Ardidos."); // Recepcion_ABM.jTextField_ardidos.requestFocus(); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // public static void Quebrados_verificar() { // try { // error_quebrado = true; // if (isNumericDouble(Recepcion_ABM.jTextField_g_quebrados.getText().trim())) { // Statement ST_tabla_ad_quebrados = conexion.createStatement(); // ResultSet RS_tabla_ad_quebrados = ST_tabla_ad_quebrados.executeQuery("SELECT * FROM tabla_ad where cantidad= '" + Recepcion_ABM.jTextField_g_quebrados.getText() + "' and id_concepto_tabla_ad='6'"); // while (RS_tabla_ad_quebrados.next()) { // error_quebrado = false; // } // if (error_quebrado) { // JOptionPane.showMessageDialog(null, "ATENCION. Valor de Granos Quebrados no encontrado en la tabla AD."); // Recepcion_ABM.jTextField_g_quebrados.setText(""); // Recepcion_ABM.jTextField_g_quebrados.requestFocus(); // } // } else { // JOptionPane.showMessageDialog(null, "ATENCION. Valor de Granos Quebrados."); // Recepcion_ABM.jTextField_g_quebrados.requestFocus(); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // public static void Verdes_verificar() { // try { // error_verdes = true; // if (isNumericDouble(Recepcion_ABM.jTextField_g_verdes.getText().trim())) { // // Statement ST_tabla_ad_granos_verdes = conexion.createStatement(); // ResultSet RS_tabla_ad_granos_verdes = ST_tabla_ad_granos_verdes.executeQuery("SELECT * FROM tabla_ad where cantidad= '" + Recepcion_ABM.jTextField_g_verdes.getText() + "' and id_concepto_tabla_ad='3'"); // while (RS_tabla_ad_granos_verdes.next()) { // error_verdes = false; // } // if (error_verdes) { // JOptionPane.showMessageDialog(null, "ATENCION. Valor de Granos Verdes no encontrado en la tabla AD."); // Recepcion_ABM.jTextField_g_verdes.setText(""); // Recepcion_ABM.jTextField_g_verdes.requestFocus(); // } // } else { // JOptionPane.showMessageDialog(null, "ATENCION. Valor de Granos Verdes."); // Recepcion_ABM.jTextField_g_verdes.requestFocus(); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // public static void Chuzos_verificar() { // try { // error_chuzos = true; // if (isNumericDouble(Recepcion_ABM.jTextField_chuzos.getText().trim())) { // // Statement ST_tabla_ad_chuzos = conexion.createStatement(); // ResultSet RS_tabla_ad_chuzos = ST_tabla_ad_chuzos.executeQuery("SELECT * FROM tabla_ad where cantidad= '" + Recepcion_ABM.jTextField_chuzos.getText() + "' and id_concepto_tabla_ad='4'"); // while (RS_tabla_ad_chuzos.next()) { // error_chuzos = false; // } // if (error_chuzos) { // JOptionPane.showMessageDialog(null, "ATENCION. Valor de Chuzos no encontrado en la tabla AD."); // Recepcion_ABM.jTextField_chuzos.setText(""); // Recepcion_ABM.jTextField_chuzos.requestFocus(); // } // } else { // JOptionPane.showMessageDialog(null, "ATENCION. Valor de Chuzos."); // Recepcion_ABM.jTextField_chuzos.requestFocus(); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // public static void Impurezas_verificar() { // try { // // if (isNumericDouble(Recepcion_ABM.jTextField_c_extranhos.getText().trim())) { // Statement ST_tabla_ad_impurezas = conexion.createStatement(); // ResultSet RS_tabla_ad_impurezas = ST_tabla_ad_impurezas.executeQuery("SELECT * FROM tabla_ad where cantidad= '" + Recepcion_ABM.jTextField_c_extranhos.getText() + "' and id_concepto_tabla_ad='2'"); // while (RS_tabla_ad_impurezas.next()) { // error_impurezas = false; // } // if (error_impurezas) { // JOptionPane.showMessageDialog(null, "ATENCION. Valor de Cuerpos Extraños no encontrado en la tabla AD."); // Recepcion_ABM.jTextField_c_extranhos.setText(""); // Recepcion_ABM.jTextField_c_extranhos.requestFocus(); // } // } else { // JOptionPane.showMessageDialog(null, "ATENCION. Valor de Cuerpos Extraños."); // Recepcion_ABM.jTextField_c_extranhos.requestFocus(); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Remision_clear() { // // Recepcion_ABM.jLabel1.setText(""); //// Recepcion_ABM.jTextField_tipo.setText("SOJA"); // Metodos.id_granos_tipo = 0; // Recepcion_ABM.jDateChooser_fecha.setDate(hoy); // Recepcion_ABM.jDateChooser_inicio.setDate(hoy); // Recepcion_ABM.jDateChooser_fin.setDate(hoy); //// Recepcion_ABM.jTextField_ardidos.setText("0"); // Recepcion_ABM.jTextField_bruto.setText(""); //// Recepcion_ABM.jTextField_c_extranhos.setText("0"); // Recepcion_ABM.jTextField_camion.setText(""); // id_camion = 0; // Recepcion_ABM.jTextField_carreta.setText(""); // id_carreta = 0; // Recepcion_ABM.jTextField_chofer.setText(""); // id_chofer = 0; //// Recepcion_ABM.jTextField_chuzos.setText("0"); // Recepcion_ABM.jTextField_cliente.setText(""); // id_cliente = 0; // Recepcion_ABM.jTextField_parcela.setText(""); // id_parcela = 0; // Recepcion_ABM.jTextField_comp_pesaje.setText(""); // Recepcion_ABM.jTextField_destino.setText(""); //// Recepcion_ABM.jTextField_g_quebrados.setText("0"); //// Recepcion_ABM.jTextField_g_verdes.setText("0"); //// Recepcion_ABM.jTextField_humedad.setText("0"); // Recepcion_ABM.jTextField_neto.setText(""); // Recepcion_ABM.jTextField_numero.setText(""); // Recepcion_ABM.jTextField_origen.setText(""); //// Recepcion_ABM.jTextField_ruc.setText(""); // Recepcion_ABM.jTextField_tara.setText("0"); // // Recepcion_ABM.jTextField_telefono.setText(""); // Recepcion_ABM.jTextField_tipo.setText(""); // Recepcion_ABM.jTextField_precio.setText("0"); // Recepcion_ABM.jTextField_total.setText("0"); // Recepcion_ABM.jTextField_neto_descuento.setText("0"); // Recepcion_ABM.jCheckBox_recepcion.setSelected(false); // Recepcion_ABM.jCheckBox_remision.setSelected(true); // // Recepcion_ABM.jTextField_numero.requestFocus(); // id_recepcion = 0; // // Recepcion_ABM.jTextField_moneda.setText("GS"); // id_moneda = 1; // // Recepcion_ABM.jTextField_motivo.setText(""); // recepcion_id_motivo = 0; // // Recepcion_ABM.jTextField_zafra.setText(""); // recepcion_id_zafra = 0; // // Recepcion_ABM.jTextField_variedad.setText(""); // recepcion_id_variedad = 0; // // recepcion_id_remitente = 1; // Recepcion_remitente(); // Recepcion_ABM.jTextField_remitente.setText(remitente); // Recepcion_ABM.jTextField_parcela.requestFocus(); // Recepcion_ABM.jTextField_remitente.setText(remitente); // // Recepcion_ABM.jButton_borrar.setVisible(false); // Recepcion_ABM.jButton_print.setVisible(false); // // } // // public static void Recepcion_MAX() { // try { // // Conexion.Verificar_conexion(); // String sql = "select MAX(id_recepcion) from recepcion"; // Statement ST_Productos = conexion.createStatement(); // ResultSet RS_Productos = ST_Productos.executeQuery(sql); // if (RS_Productos.next()) { // id_recepcion = RS_Productos.getInt(1); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static int MAX_tabla(String id, String tabla) { // dato_int = 0; // try { // Statement st = conexion.createStatement(); // ResultSet rs = st.executeQuery("SELECT MAX(" + id + ") FROM " + tabla + " "); // while (rs.next()) { // dato_int = rs.getInt(1) + 1; // } // rs.close(); // st.close(); // // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // } // return dato_int; // } // // public static void Recepcion_remitente() { // try { // // Conexion.Verificar_conexion(); // // String sql = "select * from remitente where id_remitente = '1' "; // Statement ST_Productos = conexion.createStatement(); // ResultSet RS_Productos = ST_Productos.executeQuery(sql); // if (RS_Productos.next()) { // remitente = RS_Productos.getString("remitente"); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public synchronized static int Factura_de_compra_Max() { // try { // ResultSet RS_Productos; // try (Statement ST_Productos = conexion.createStatement()) { // RS_Productos = ST_Productos.executeQuery("SELECT MAX(id_facturas_compra) from facturas_compra"); // if (RS_Productos.next()) { // max = RS_Productos.getInt(1); // } // } // RS_Productos.close(); // // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // // return max; // // } // // public synchronized static String getHoy_format2() { // Date dNow = new Date(); // SimpleDateFormat ft = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); // String hoy = ft.format(dNow); // return hoy; // } // // public synchronized static void Compras_clear() { // Compras.jT_Proveedor.setText(""); // Compras.jT_factura_nro.setText(""); // Compras.jTextField_total.setText("0"); // id_proveedor = 0; // Compras.jButton_borrar.setVisible(false); // Compras.jT_factura_nro.requestFocus(); // } // // public synchronized static void Compras_Verificar_Numero_de_Factura(String numero) { // try { // if (id_facturas_compras == 0) { // boolean factura_registrada = false; // if (numero.length() > 1) { // String numero_de_factura_ingresado = numero.trim(); // numero_de_factura_ingresado = numero_de_factura_ingresado.replace("-", ""); // Statement st1 = conexion.createStatement(); // ResultSet result = st1.executeQuery("" // + "SELECT * FROM facturas_compra " // + "where id_comercio = '" + id_comercio + "' " // + "and id_proveedor = '" + id_proveedor + "' " // + "and borrado != '1'"); // while (result.next()) { // numero = result.getString("numero").trim(); // numero = numero.replace("-", ""); // if (numero.equals(numero_de_factura_ingresado)) { // id_facturas_compras = result.getInt("id_facturas_compra"); // Compras.jDateChooser.setDate(result.getDate("fecha_date")); // JOptionPane.showMessageDialog(null, "Factura registrada"); // RefreshListCompras(); // factura_registrada = true; // } // } // // } // } else { // Compras_actualizar(numero); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public synchronized static void RefreshListCompras() { // DefaultTableModel modelo = (DefaultTableModel) Compras.jTable1.getModel(); // while (modelo.getRowCount() > 0) { // modelo.removeRow(0); // } // try { // PreparedStatement ps = conexion.prepareStatement("" // + "select id_facturas_compra_detalle, nombre, cantidad, facturas_compra_detalle.precio, facturas_compra_detalle.total " // + "from facturas_compra_detalle " // + "inner join productos " // + "on productos.id_producto = facturas_compra_detalle.id_producto " // + "where id_facturas_compra = '" + id_facturas_compras + "'"); // ResultSet rs = ps.executeQuery(); // rsm = rs.getMetaData(); // // long total = 0; // // ArrayList<Object[]> data = new ArrayList<>(); // while (rs.next()) { // total = rs.getInt("total") + total; // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // if (rs.getObject(i + 1) != null) { // if (rs.getObject(i + 1).toString().length() > 1) { // rows[0] = rs.getObject(1).toString(); // rows[1] = rs.getObject(2).toString().trim(); // rows[2] = (rs.getObject(3).toString()); // if (rs.getObject(4) == null) { // } else { // rows[3] = getSepararMiles(rs.getObject(4).toString()); // } // if (rs.getObject(5) == null) { // } else { // rows[4] = getSepararMiles(rs.getObject(5).toString()); // } // } // } // } // data.add(rows); // } // DefaultTableModel dtm = (DefaultTableModel) Compras.jTable1.getModel(); // for (int i = 0; i < data.size(); i++) { // dtm.addRow(data.get(i)); // } // String strLong = Long.toString(total); // String nuevo = DEV.Metodos.getSepararMiles(strLong); // // // -------------- SETEAR VALORES EN FORM // Compras.jTextField_total.setText(nuevo); // // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // } // } // // public static void Recepcion_buscar() { // try { // // Conexion.Verificar_conexion(); // // String sql = "select *, camion.marca as camionmarca, camion.chapa as camionchapa, " // + "carreta.marca as carretamarca, carreta.chapa as carretachapa, chofer.nombre as chonombre " // + "from recepcion " // + "inner join granos_tipo on granos_tipo.id_granos_tipo = recepcion.id_granos_tipo " // + "inner join cliente on cliente.id_cliente = recepcion.id_cliente " // + "inner join camion on camion.id_camion = recepcion.id_camion " // + "inner join carreta on carreta.id_carreta = recepcion.id_carreta " // + "inner join chofer on chofer.id_chofer = recepcion.id_chofer " // + "inner join parcela on parcela.id_parcela = recepcion.id_parcela " // + "inner join moneda on moneda.id_moneda = recepcion.id_moneda " // + "inner join motivo on motivo.id_motivo = recepcion.id_motivo " // + "inner join sucursal on sucursal.id_sucursal = recepcion.id_sucursal " // + "inner join variedad on variedad.id_variedad = recepcion.id_variedad " // + "inner join remitente on remitente.id_remitente = recepcion.id_remitente " // + "inner join zafra on zafra.id_zafra = recepcion.id_zafra " // + "where id_recepcion = '" + id_recepcion + "' " // + "and (recepcion.borrado_int != '1' or recepcion.borrado_int is null)"; // Statement ST_Productos = conexion.createStatement(); // ResultSet RS_Productos = ST_Productos.executeQuery(sql); // if (RS_Productos.next()) { // Recepcion_ABM.jTextField_numero.setText(RS_Productos.getString("numero")); // Recepcion_ABM.jDateChooser_fecha.setDate(RS_Productos.getDate("fecha")); // Recepcion_ABM.jDateChooser_fin.setDate(RS_Productos.getDate("fecha_salida")); // Recepcion_ABM.jDateChooser_inicio.setDate(RS_Productos.getDate("fecha_llegada")); // if (RS_Productos.getInt("movimiento") == 1) { // Recepcion_ABM.jCheckBox_recepcion.setSelected(true); // Recepcion_ABM.jCheckBox_remision.setSelected(false); // } // if (RS_Productos.getInt("movimiento") == 2) { // Recepcion_ABM.jCheckBox_recepcion.setSelected(false); // Recepcion_ABM.jCheckBox_remision.setSelected(true); // } // Recepcion_ABM.jTextField_tipo.setText(RS_Productos.getString("tipo").trim()); // Recepcion_ABM.jTextField_cliente.setText(RS_Productos.getString("nombre").trim()); // if (RS_Productos.getString("ruc") != null) { //// Recepcion_ABM.jTextField_ruc.setText(RS_Productos.getString("ruc").trim()); // } // if (RS_Productos.getString("telefono") != null) { // // Recepcion_ABM.jTextField_telefono.setText(RS_Productos.getString("telefono").trim()); // } // Recepcion_ABM.jTextField_camion.setText( // RS_Productos.getString("camionmarca").trim() // + " - " + RS_Productos.getString("camionchapa").trim()); // Recepcion_ABM.jTextField_carreta.setText( // RS_Productos.getString("carretamarca").trim() // + " - " + RS_Productos.getString("carretachapa").trim()); // Recepcion_ABM.jTextField_chofer.setText(RS_Productos.getString("chonombre").trim()); // Recepcion_ABM.jTextField_comp_pesaje.setText(RS_Productos.getString("comp_pesaje").trim()); // // if (RS_Productos.getString("peso_bruto") != null) { // Recepcion_ABM.jTextField_bruto.setText(getSepararMiles(RS_Productos.getString("peso_bruto").trim())); // } else { // Recepcion_ABM.jTextField_bruto.setText("0"); // } // if (RS_Productos.getString("peso_tara") != null) { // Recepcion_ABM.jTextField_tara.setText(getSepararMiles(RS_Productos.getString("peso_tara").trim())); // } else { // Recepcion_ABM.jTextField_tara.setText("0"); // } // if (RS_Productos.getString("peso_neto") != null) { // Recepcion_ABM.jTextField_neto.setText(getSepararMiles(RS_Productos.getString("peso_neto").trim())); // } else { // Recepcion_ABM.jTextField_neto.setText("0"); // } // if (RS_Productos.getString("precio") != null) { // Recepcion_ABM.jTextField_precio.setText(getSepararMiles(RS_Productos.getString("precio").trim())); // } else { // Recepcion_ABM.jTextField_precio.setText("0"); // } // DecimalFormat num = new DecimalFormat("#,###.##"); // // if (RS_Productos.getString("total_a_pagar") != null) { // Recepcion_ABM.jTextField_total.setText(num.format(Double.parseDouble(RS_Productos.getString("total_a_pagar")))); // } else { // Recepcion_ABM.jTextField_total.setText("0"); // } // if (RS_Productos.getString("origen") != null) { // Recepcion_ABM.jTextField_origen.setText(RS_Productos.getString("origen").trim()); // } else { // Recepcion_ABM.jTextField_origen.setText("0"); // } // if (RS_Productos.getString("origen") != null) { // Recepcion_ABM.jTextField_origen.setText(RS_Productos.getString("origen").trim()); // } else { // Recepcion_ABM.jTextField_origen.setText("0"); // } // if (RS_Productos.getString("destino") != null) { // Recepcion_ABM.jTextField_destino.setText(RS_Productos.getString("destino").trim()); // } else { // Recepcion_ABM.jTextField_destino.setText("0"); // } //// Recepcion_ABM.jTextField_humedad.setText(RS_Productos.getString("humedad").trim()); //// Recepcion_ABM.jTextField_c_extranhos.setText(RS_Productos.getString("impurezas").trim()); //// Recepcion_ABM.jTextField_g_verdes.setText(RS_Productos.getString("granos_verdes").trim()); //// Recepcion_ABM.jTextField_g_quebrados.setText(RS_Productos.getString("quebrados").trim()); //// Recepcion_ABM.jTextField_ardidos.setText(RS_Productos.getString("ardidos").trim()); //// Recepcion_ABM.jTextField_chuzos.setText(RS_Productos.getString("chuzos").trim()); // Recepcion_ABM.jTextField_parcela.setText(RS_Productos.getString("parcela")); // Recepcion_ABM.jTextField_precio.setText(RS_Productos.getString("precio")); // Recepcion_ABM.jTextField_observaciones.setText(RS_Productos.getString("observaciones")); // Recepcion_ABM.jTextField_moneda.setText(RS_Productos.getString("moneda")); // Recepcion_ABM.jTextField_neto_descuento.setText(getSepararMiles(RS_Productos.getString("total_neto_carga"))); // Recepcion_ABM.jTextField_motivo.setText((RS_Productos.getString("motivo"))); // Recepcion_ABM.jTextField_zafra.setText((RS_Productos.getString("zafra"))); // Recepcion_ABM.jTextField_variedad.setText((RS_Productos.getString("variedad"))); // Recepcion_ABM.jTextField_remitente.setText((RS_Productos.getString("remitente"))); // Recepcion_ABM.jLabel1.setText(RS_Productos.getString("sucursal")); // // id_cliente = RS_Productos.getInt("id_cliente"); // id_parcela = RS_Productos.getInt("id_parcela"); // id_chofer = RS_Productos.getInt("id_chofer"); // id_carreta = RS_Productos.getInt("id_carreta"); // id_camion = RS_Productos.getInt("id_camion"); // id_granos_tipo = RS_Productos.getInt("id_granos_tipo"); // id_moneda = RS_Productos.getInt("id_moneda"); // recepcion_id_motivo = RS_Productos.getInt("id_motivo"); // recepcion_id_zafra = RS_Productos.getInt("id_zafra"); // recepcion_id_variedad = RS_Productos.getInt("id_variedad"); // recepcion_id_remitente = RS_Productos.getInt("id_remitente"); // // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // } // } // // public static void Trasnportista_cargar_jtable(String buscar) { // try { // dtm = (DefaultTableModel) Transportista_listado.jTable1.getModel(); // for (int j = 0; j < Transportista_listado.jTable1.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select * " // + "from transportista " // + "where nombre ilike '%" + buscar + "%' " // + "and borrado_int != '1'"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Transportista_listado.jTable1.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Recepcion_detalle_jtable() { // try { // // Conexion.Verificar_conexion(); // // dtm = (DefaultTableModel) Recepcion_ABM.jTable_detalle.getModel(); // for (int j = 0; j < Recepcion_ABM.jTable_detalle.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_recepcion_detalle, concepto, valor_porcentaje, valor, descuento " // + "from recepcion_detalle " // + "inner join concepto_tabla_ad on concepto_tabla_ad.id_concepto_tabla_ad = recepcion_detalle.id_concepto_tabla_ad " // + "where id_recepcion = '" + id_recepcion + "' " // + ""); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Recepcion_ABM.jTable_detalle.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void TablaAD_concepto_jtable() { // try { // // Conexion.Verificar_conexion(); // // dtm = (DefaultTableModel) TablaAD.jTable_concepto.getModel(); // for (int j = 0; j < TablaAD.jTable_concepto.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_concepto_tabla_ad, concepto " // + "from concepto_tabla_ad " // + ""); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) TablaAD.jTable_concepto.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Productos_aplicacion_buscar_jtable(String cultivo, String parcela, String zafra) { // try { // dtm = (DefaultTableModel) Productos_aplicacion_ABM.jTable_buscar.getModel(); // for (int j = 0; j < Productos_aplicacion_ABM.jTable_buscar.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_producto_aplicacion, fecha, zafra, parcela, tipo " // + "from producto_aplicacion " // + "inner join zafra on zafra.id_zafra = producto_aplicacion.id_zafra " // + "inner join parcela on parcela.id_parcela = producto_aplicacion.id_parcela " // + "inner join granos_tipo on granos_tipo.id_granos_tipo = producto_aplicacion.id_granos_tipo " // + "where granos_tipo.tipo ilike '%" + cultivo + "%' " // + "and zafra ilike '%" + zafra + "%' " // + "and parcela ilike '%" + parcela + "%' " // + ""); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Productos_aplicacion_ABM.jTable_buscar.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Productos_aplicacion_detalle_jtable() { // try { // dtm = (DefaultTableModel) Productos_aplicacion_ABM.jTable_detalle.getModel(); // for (int j = 0; j < Productos_aplicacion_ABM.jTable_detalle.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_producto_aplicacion_detalle, nombre, dosis, total " // + "from producto_aplicacion_detalle " // + "inner join productos on productos.id_producto = producto_aplicacion_detalle.id_producto " // + "where id_producto_aplicacion = '" + id_producto_aplicacion + "' " // + ""); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Productos_aplicacion_ABM.jTable_detalle.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Productos_aplicacion_abm_productos_jtable(String buscar) { // try { // dtm = (DefaultTableModel) Productos_aplicacion_ABM.jTable_productos.getModel(); // for (int j = 0; j < Productos_aplicacion_ABM.jTable_productos.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_producto, nombre " // + "from productos " // + "where nombre ilike '%" + buscar + "%' " // + ""); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Productos_aplicacion_ABM.jTable_productos.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Productos_aplicacion_abm_zafra_jtable() { // try { // dtm = (DefaultTableModel) Productos_aplicacion_ABM.jTable_zafra.getModel(); // for (int j = 0; j < Productos_aplicacion_ABM.jTable_zafra.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_zafra, zafra " // + "from zafra " // + "order by zafra"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Productos_aplicacion_ABM.jTable_zafra.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // } // } // // public static void Productos_aplicacion_abm_cultivo_jtable() { // try { // dtm = (DefaultTableModel) Productos_aplicacion_ABM.jTable_cultivo.getModel(); // for (int j = 0; j < Productos_aplicacion_ABM.jTable_cultivo.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_granos_tipo, tipo " // + "from granos_tipo " // + "order by tipo "); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Productos_aplicacion_ABM.jTable_cultivo.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // } // } // // public static void Productos_aplicacion_parcela_jtable(String buscar) { // try { // // Conexion.Verificar_conexion(); // // dtm = (DefaultTableModel) Productos_aplicacion_ABM.jTable_parcela.getModel(); // for (int j = 0; j < Productos_aplicacion_ABM.jTable_parcela.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_parcela, parcela " // + "from parcela " // + "where parcela ilike '%" + buscar + "%' " // + "order by parcela "); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Productos_aplicacion_ABM.jTable_parcela.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Compras_detalle_jtable() { // try { // dtm = (DefaultTableModel) Compras.jTable1.getModel(); // for (int j = 0; j < Compras.jTable1.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_facturas_compra_detalle, nombre, unidades, facturas_compra_detalle.precio as precio " // + "from facturas_compra_detalle " // + "inner join productos on productos.id_producto = facturas_compra_detalle.id_producto " // + "where id_facturas_compra = '" + id_facturas_compras + "' " // + ""); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Compras.jTable1.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Compras_buscar_jtable(String buscar) { // try { // dtm = (DefaultTableModel) Compras.jTable_buscar.getModel(); // for (int j = 0; j < Compras.jTable_buscar.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_facturas_compra, nombre, numero, fecha, total " // + "from facturas_compra " // + "inner join proveedor on proveedor.id_proveedor = facturas_compra.id_proveedor " // + "where nombre ilike '%" + buscar + "%' " // + "order by fecha, numero "); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Compras.jTable_buscar.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Consultas_jtable(Date desde, Date hasta) { // try { // if (desde != null && hasta != null) { // // String sql = ""; // if (consultas_id_estado == 0) { // sql = "select sum(total_neto_carga) " // + "from recepcion " // + "inner join cliente on cliente.id_cliente = recepcion.id_cliente " // + "inner join recepcion_estado on recepcion_estado.id_recepcion_estado = recepcion.id_recepcion_estado " // + "where recepcion.id_cliente = '" + consultas_id_cliente + "' " // + "and fecha >= '" + desde + "' " // + "and fecha <= '" + hasta + "' " // + "and recepcion.borrado_int != '1' " // + "and movimiento = '1' " // + "and seleccionado != '1'"; // } else { // sql = "select sum(total_neto_carga) " // + "from recepcion " // + "inner join cliente on cliente.id_cliente = recepcion.id_cliente " // + "inner join recepcion_estado on recepcion_estado.id_recepcion_estado = recepcion.id_recepcion_estado " // + "where recepcion.id_cliente = '" + consultas_id_cliente + "' " // + "and fecha >= '" + desde + "' " // + "and fecha <= '" + hasta + "' " // + "and recepcion.borrado_int != '1' " // + "and movimiento = '1' " // + "and recepcion.id_recepcion_estado = '" + consultas_id_estado + "'" // + "and seleccionado != '1'"; // // } // // Statement ST_Productos = conexion.createStatement(); // ResultSet RS_Productos = ST_Productos.executeQuery(sql); // if (RS_Productos.next()) { // Consultas.jTextField_total.setText(RS_Productos.getString(1)); // } // // dtm = (DefaultTableModel) Consultas.jTable_movimientos.getModel(); // for (int j = 0; j < Consultas.jTable_movimientos.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // // sql = "" // + "select id_recepcion, numero, nombre, movimiento_string, recepcion_estado.estado, fecha, peso_neto, total_descuento, total_neto_carga " // + "from recepcion " // + "inner join cliente on cliente.id_cliente = recepcion.id_cliente " // + "inner join recepcion_estado on recepcion_estado.id_recepcion_estado = recepcion.id_recepcion_estado " // + "where recepcion.id_cliente = '" + consultas_id_cliente + "' " // + "and fecha >= '" + desde + "' " // + "and fecha <= '" + hasta + "' " // + "and movimiento = '1' " // + "and seleccionado != '1'"; // // if (consultas_id_estado != 0) { // sql = "" // + "select id_recepcion, numero, nombre, movimiento_string, recepcion_estado.estado, fecha, peso_neto, total_descuento, total_neto_carga " // + "from recepcion " // + "inner join cliente on cliente.id_cliente = recepcion.id_cliente " // + "inner join recepcion_estado on recepcion_estado.id_recepcion_estado = recepcion.id_recepcion_estado " // + "where recepcion.id_cliente = '" + consultas_id_cliente + "' " // + "and fecha >= '" + desde + "' " // + "and fecha <= '" + hasta + "' " // + "and recepcion.borrado_int != '1' " // + "and recepcion.id_recepcion_estado = '" + consultas_id_estado + "'" // + "and movimiento = '1' " // + "and seleccionado != '1'"; // } // // PreparedStatement ps2 = conexion.prepareStatement(sql); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Consultas.jTable_movimientos.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Consultas_seleccionado_jtable(Date desde, Date hasta) { // try { // if (desde != null && hasta != null) { // // String sql = "select sum(total_neto_carga) " // + "from recepcion " // + "inner join cliente on cliente.id_cliente = recepcion.id_cliente " // + "inner join recepcion_estado on recepcion_estado.id_recepcion_estado = recepcion.id_recepcion_estado " // + "where recepcion.id_cliente = '" + consultas_id_cliente + "' " // + "and seleccionado = '1' " // + "and fecha >= '" + desde + "' " // + "and fecha <= '" + hasta + "' " // + "and recepcion.borrado_int != '1' "; // // Statement ST_Productos = conexion.createStatement(); // ResultSet RS_Productos = ST_Productos.executeQuery(sql); // if (RS_Productos.next()) { // Consultas.jTextField_seleccionado.setText(RS_Productos.getString(1)); // } // // dtm = (DefaultTableModel) Consultas.jTable_seleccionados.getModel(); // for (int j = 0; j < Consultas.jTable_seleccionados.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_recepcion, numero, nombre, movimiento_string, recepcion_estado.estado, fecha, peso_neto, total_descuento, total_neto_carga " // + "from recepcion " // + "inner join cliente on cliente.id_cliente = recepcion.id_cliente " // + "inner join recepcion_estado on recepcion_estado.id_recepcion_estado = recepcion.id_recepcion_estado " // + "where recepcion.id_cliente = '" + consultas_id_cliente + "' " // + "and seleccionado = '1' " // + "and fecha >= '" + desde + "' " // + "and fecha <= '" + hasta + "' " // + "and recepcion.borrado_int != '1' "); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Consultas.jTable_seleccionados.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Personales_pagos_empleados_jtable(String buscar) { // try { // dtm = (DefaultTableModel) Personales_pagos_ABM.jTable_empleado.getModel(); // for (int j = 0; j < Personales_pagos_ABM.jTable_empleado.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_empleado, nombre " // + "from empleado " // + "where nombre ilike '%" + buscar + "%' " // + "order by nombre"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Personales_pagos_ABM.jTable_empleado.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Pago_salario_mes_jtable() { // try { // dtm = (DefaultTableModel) Personales_pagos_ABM.jTable_mes.getModel(); // for (int j = 0; j < Personales_pagos_ABM.jTable_mes.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select * " // + "from mes " // + "order by id_mes"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Personales_pagos_ABM.jTable_mes.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void TablaAD_tipo_jtable() { // try { // dtm = (DefaultTableModel) TablaAD.jTable_tipo.getModel(); // for (int j = 0; j < TablaAD.jTable_tipo.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select * " // + "from granos_tipo " // + "order by granos_tipo"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) TablaAD.jTable_tipo.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Liquidaciones_multiples_moneda_jtable() { // try { // dtm = (DefaultTableModel) Liquidaciones_multiples.jTable_moneda.getModel(); // for (int j = 0; j < Liquidaciones_multiples.jTable_moneda.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select * " // + "from moneda " // + "order by moneda"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Liquidaciones_multiples.jTable_moneda.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Liquidaciones_multiples_recepciones_jtable(String buscar) { // try { // dtm = (DefaultTableModel) Liquidaciones_multiples.jTable_recepciones.getModel(); // for (int j = 0; j < Liquidaciones_multiples.jTable_recepciones.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + " select id_recepcion, nombre, fecha, total_neto_carga " // + " from recepcion " // + " inner join cliente on cliente.id_cliente = recepcion.id_cliente " // + " where recepcion.borrado != '1' " // + " and nombre ilike '%" + buscar + "%' and seleccionado = '0' " // + " order by id_recepcion DESC "); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Liquidaciones_multiples.jTable_recepciones.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Recibo_de_dinero_recibos_jtable(String buscar) { // try { // dtm = (DefaultTableModel) Recibo_de_dinero.jTable_recibos.getModel(); // for (int j = 0; j < Recibo_de_dinero.jTable_recibos.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + " select id_recibo, nombre, fecha, cantidad " // + " from recibo " // + " inner join cliente on cliente.id_cliente = recibo.id_cliente " // + " where nombre ilike '%" + buscar + "%' " // + " order by fecha DESC "); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Recibo_de_dinero.jTable_recibos.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Liquidaciones_multiples_Seleccionado_jtable() { // try { // Liquidaciones_multiples.jTextField1.setText("0"); // // long total_neto_carga = 0; // Statement ST_26 = conexion.createStatement(); // ResultSet RS_26 = ST_26.executeQuery("" // + " select SUM(total_neto_carga) " // + " from recepcion " // + " where seleccionado = '1' " // + " "); // while (RS_26.next()) { // total_neto_carga = RS_26.getLong(1); // } // // Liquidaciones_multiples.jTextField1.setText(getSepararMiles(String.valueOf(total_neto_carga))); // // dtm = (DefaultTableModel) Liquidaciones_multiples.jTable_seleccionadas.getModel(); // for (int j = 0; j < Liquidaciones_multiples.jTable_seleccionadas.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + " select id_recepcion, nombre, fecha, total_neto_carga " // + " from recepcion " // + " inner join cliente on cliente.id_cliente = recepcion.id_cliente " // + " where seleccionado = '1' " // + " order by fecha "); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Liquidaciones_multiples.jTable_seleccionadas.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Recepcion_tipo_jtable() { // try { // dtm = (DefaultTableModel) Recepcion_ABM.jTable_tipo.getModel(); // for (int j = 0; j < Recepcion_ABM.jTable_tipo.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select * " // + "from granos_tipo " // + "order by tipo"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Recepcion_ABM.jTable_tipo.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Personales_pagos_sueldo_jtable(String buscar) { // try { // dtm = (DefaultTableModel) Personales_pagos_ABM.jTable_sueldos.getModel(); // for (int j = 0; j < Personales_pagos_ABM.jTable_sueldos.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_sueldo, nombre, mes, anho, total " // + "from sueldo " // + "inner join empleado on empleado.id_empleado = sueldo.id_empleado " // + "inner join mes on mes.id_mes = sueldo.id_mes " // + "where nombre ilike '%" + buscar + "%' " // + "order by id_sueldo"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Personales_pagos_ABM.jTable_sueldos.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Sueldo_detalle_jtable() { // try { // dtm = (DefaultTableModel) Personales_pagos_ABM.jTable_detalle.getModel(); // for (int j = 0; j < Personales_pagos_ABM.jTable_detalle.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_sueldo_detalle, concepto_de_pago, importe, importe " // + "from sueldo_detalle " // + "inner join concepto_de_pago on concepto_de_pago.id_concepto_de_pago = sueldo_detalle.id_concepto_de_pago " // + "where id_sueldo = '" + id_sueldo + "'" // + ""); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[0] = rs2.getObject(1).toString(); // rows[1] = rs2.getObject(2).toString().trim(); // if (Long.parseLong(rs2.getObject(3).toString()) > 0) { // rows[2] = "0"; // rows[3] = rs2.getObject(3).toString(); // } // if (Long.parseLong(rs2.getObject(3).toString()) < 0) { // rows[2] = rs2.getObject(3).toString(); // rows[3] = "0"; // } // } // data2.add(rows); // } // dtm = (DefaultTableModel) Personales_pagos_ABM.jTable_detalle.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Personales_pagos_conceptos_jtable() { // try { // dtm = (DefaultTableModel) Personales_pagos_ABM.jTable_concepto.getModel(); // for (int j = 0; j < Personales_pagos_ABM.jTable_concepto.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select * " // + "from concepto_de_pago " // + "order by concepto_de_pago"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Personales_pagos_ABM.jTable_concepto.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Compras_proveedor_jtable(String buscar) { // try { // dtm = (DefaultTableModel) Compras.jTable_proverdor.getModel(); // for (int j = 0; j < Compras.jTable_proverdor.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_proveedor, nombre " // + "from proveedor " // + "where nombre ilike '%" + buscar + "%' " // + "order by nombre "); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Compras.jTable_proverdor.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Compras_producto_jtable(String buscar) { // try { // dtm = (DefaultTableModel) Compras.jTable_producto.getModel(); // for (int j = 0; j < Compras.jTable_producto.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_producto, nombre " // + "from productos " // + "where nombre ilike '%" + buscar + "%' " // + "and borrado != '1'"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Compras.jTable_producto.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Listado_recepcion_remitente_jtable() { // try { // // Conexion.Verificar_conexion(); // // dtm = (DefaultTableModel) Listado_recepciones_remitente.jTable_remitente.getModel(); // for (int j = 0; j < Listado_recepciones_remitente.jTable_remitente.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select * " // + "from remitente "); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Listado_recepciones_remitente.jTable_remitente.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Tecnologia_cargar_jtable() { // try { // dtm = (DefaultTableModel) Tecnologia.jTable_tecnologia.getModel(); // for (int j = 0; j < Tecnologia.jTable_tecnologia.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_variedad, variedad, tipo " // + "from variedad " // + "inner join granos_tipo on granos_tipo.id_granos_tipo = variedad.id_granos_tipo "); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Tecnologia.jTable_tecnologia.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Ventas_detalle_jtable() { // try { // dtm = (DefaultTableModel) Ventas.jTable_detalle.getModel(); // for (int j = 0; j < Ventas.jTable_detalle.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_venta_detalle, nombre, unidad, venta_detalle.precio, exentas, cinco, diez " // + "from venta_detalle " // + "inner join productos on productos.id_producto = venta_detalle.id_producto " // + "where id_venta = '" + id_venta + "' "); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Ventas.jTable_detalle.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Ventas_buscar_jtable(String buscar) { // try { // dtm = (DefaultTableModel) Ventas.jTable_ventas.getModel(); // for (int j = 0; j < Ventas.jTable_ventas.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_venta, nombre, fecha, total " // + "from venta " // + "inner join cliente on cliente.id_cliente = venta.id_cliente " // + "where nombre ilike '%" + buscar + "%' " // + ""); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // if (rs2.getObject(i + 1) != null) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } else { // rows[i] = rs2.getObject(i + 1); // } // } // data2.add(rows); // } // dtm = (DefaultTableModel) Ventas.jTable_ventas.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Ventas_cliente_jtable(String buscar) { // try { // dtm = (DefaultTableModel) Ventas.jTable_cliente.getModel(); // for (int j = 0; j < Ventas.jTable_cliente.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_cliente, nombre " // + "from cliente " // + "where nombre ilike '%" + buscar + "%' " // + ""); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // if (rs2.getObject(i + 1) != null) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } else { // rows[i] = rs2.getObject(i + 1); // } // } // data2.add(rows); // } // dtm = (DefaultTableModel) Ventas.jTable_cliente.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Ventas_moneda_jtable() { // try { // dtm = (DefaultTableModel) Ventas.jTable_moneda.getModel(); // for (int j = 0; j < Ventas.jTable_moneda.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select * " // + "from moneda "); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Ventas.jTable_moneda.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Ventas_agregar_producto_jtable(String buscar) { // try { // dtm = (DefaultTableModel) Ventas.jTable_productos.getModel(); // for (int j = 0; j < Ventas.jTable_productos.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_producto, nombre, precio " // + "from productos " // + "where nombre ilike '%" + buscar + "%' " // + "and borrado != '1'"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Ventas.jTable_productos.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Configuracion_sucursal_jtable() { // try { // dtm = (DefaultTableModel) Configuracion.jTable_sucursal.getModel(); // for (int j = 0; j < Configuracion.jTable_sucursal.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select * " // + "from sucursal where id_sucursal = '" + id_sucursal + "' "); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Configuracion.jTable_sucursal.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Listado_recepciones_sucursal_jtable() { // try { // dtm = (DefaultTableModel) Listado_recepciones.jTable_sucursal.getModel(); // for (int j = 0; j < Listado_recepciones.jTable_sucursal.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select * " // + "from sucursal "); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Listado_recepciones.jTable_sucursal.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Contratos_jtable(String buscar) { // try { // dtm = (DefaultTableModel) Contratos.jTable_contratos.getModel(); // for (int j = 0; j < Contratos.jTable_contratos.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_contrato, nombre " // + "from contrato " // + "inner join cliente on cliente.id_cliente = contrato.id_cliente " // + "where nombre ilike '%" + buscar + "%' " // + ""); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Contratos.jTable_contratos.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Tickets_jtable() { // try { // dtm = (DefaultTableModel) Tickets.jTable1.getModel(); // for (int j = 0; j < Tickets.jTable1.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_recepcion, fecha, nombre, peso_bruto, peso_tara, peso_neto " // + "from recepcion inner join cliente on recepcion.id_cliente = cliente.id_cliente " // + ""); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Tickets.jTable1.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Contratos_recepcion_contratos_jtable() { // try { // dtm = (DefaultTableModel) Contratos_recepcion.jTable_contratos.getModel(); // for (int j = 0; j < Contratos_recepcion.jTable_contratos.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_contrato, nro, fecha, tonelada, premio, estado_str " // + "from contrato " // + "where id_cliente = '" + contrato_recepcion_id_cliente + "' " // + "and id_zafra = '" + contrato_recepcion_id_zafra + "' " // + "order by id_contrato DESC"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Contratos_recepcion.jTable_contratos.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Contratos_recepcion_recepciones_jtable() { // try { // dtm = (DefaultTableModel) Contratos_recepcion.jTable_recepciones.getModel(); // for (int j = 0; j < Contratos_recepcion.jTable_recepciones.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_recepcion, fecha, peso_neto, total_neto_carga, recepcion_estado.estado as recepcion_estado, precio, total_a_pagar " // + "from recepcion " // + "inner join recepcion_estado on recepcion_estado.id_recepcion_estado = recepcion.id_recepcion_estado " // + "" // + "where id_cliente = '" + contrato_recepcion_id_cliente + "' " // + "and id_zafra = '" + contrato_recepcion_id_zafra + "' " // + " and peso_neto > '0' " // + "and recepcion.borrado_int != '1' "); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // if (isNumericDouble(rs2.getObject(i + 1).toString())) { // //rows[i] = (rs2.getObject(i + 1).toString().trim()); // // double total_double = Double.parseDouble(rs2.getObject(i + 1).toString()); // // if (total_double > 1000000) { // long total_long = (long) total_double; // // String total_long_str = getSepararMiles((String.valueOf(total_long))); // rows[i] = total_long_str; // // } else { // rows[i] = rs2.getObject(i + 1).toString(); // } // // } else { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // } // data2.add(rows); // } // dtm = (DefaultTableModel) Contratos_recepcion.jTable_recepciones.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Contratos_recepcion_calculo() { // try { // // double toneladas_cumplidas = 0; // Statement ST_26 = conexion.createStatement(); // ResultSet RS_26 = ST_26.executeQuery("" // + "select SUM(tonelada) " // + "from contrato " // + "where id_cliente = '" + contrato_recepcion_id_cliente + "' " // + "and id_zafra = '" + contrato_recepcion_id_zafra + "' " // + "and estado = '2' " // + " "); // while (RS_26.next()) { // toneladas_cumplidas = RS_26.getDouble(1) + toneladas_cumplidas; // } // // double toneladas = 0; // Statement ST_2 = conexion.createStatement(); // ResultSet RS_2 = ST_2.executeQuery("" // + "select SUM(tonelada) " // + "from contrato " // + "where id_cliente = '" + contrato_recepcion_id_cliente + "' " // + "and id_zafra = '" + contrato_recepcion_id_zafra + "' " // + " "); // while (RS_2.next()) { // toneladas = RS_2.getDouble(1) + toneladas; // } // // Statement ST_tabla_ad_humedad = conexion.createStatement(); // ResultSet RS_tabla_ad_humedad = ST_tabla_ad_humedad.executeQuery("" // + "select SUM(total_neto_carga) " // + "from recepcion " // + "where id_cliente = '" + contrato_recepcion_id_cliente + "' " // + "and id_zafra = '" + contrato_recepcion_id_zafra + "' " // + " and peso_neto > '0' " // + "and borrado != '1' "); // while (RS_tabla_ad_humedad.next()) { // double total = RS_tabla_ad_humedad.getDouble(1) / 1000; // // Contratos_recepcion.jTextField_total.setText(String.format("%,4g%n", (total - toneladas_cumplidas))); // Contratos_recepcion.jTextField_faltante.setText(String.format("%,4g%n", (toneladas - total))); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Contrato_recepcion_cliente_jtable(String buscar) { // try { // dtm = (DefaultTableModel) Contratos_recepcion.jTable_cliente.getModel(); // for (int j = 0; j < Contratos_recepcion.jTable_cliente.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_cliente, nombre " // + "from cliente " // + "where nombre ilike '%" + buscar + "%' " // + "and (borrado_int != '1' or borrado_int is null) " // + "order by nombre "); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // if (rs2.getObject(i + 1) != null) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } else { // rows[i] = rs2.getObject(i + 1); // } // } // data2.add(rows); // } // dtm = (DefaultTableModel) Contratos_recepcion.jTable_cliente.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Contrato_recepcion_zafra_jtable() { // try { // Conexion.Verificar_conexion(); // // dtm = (DefaultTableModel) Contratos_recepcion.jTable_zafra.getModel(); // for (int j = 0; j < Contratos_recepcion.jTable_zafra.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_zafra, zafra " // + "from zafra " // + "order by zafra "); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // if (rs2.getObject(i + 1) != null) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } else { // rows[i] = rs2.getObject(i + 1); // } // } // data2.add(rows); // } // dtm = (DefaultTableModel) Contratos_recepcion.jTable_zafra.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Contrato_zafra_jtable() { // try { // dtm = (DefaultTableModel) Contratos.jTable_zafra.getModel(); // for (int j = 0; j < Contratos.jTable_zafra.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select * " // + "from zafra " // + " order by zafra"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Contratos.jTable_zafra.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Combustible_uso_vehiculo_jtable() { // try { // dtm = (DefaultTableModel) Combustible_uso.jTable_vehiculo.getModel(); // for (int j = 0; j < Combustible_uso.jTable_vehiculo.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_vehiculo, tipo, modelo, descripcion " // + "from vehiculo " // + ""); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Combustible_uso.jTable_vehiculo.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Consultas_cliente_jtable(String buscar) { // try { // dtm = (DefaultTableModel) Consultas.jTable_clientes.getModel(); // for (int j = 0; j < Consultas.jTable_clientes.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_cliente, nombre " // + "from cliente " // + "where nombre ilike '%" + buscar + "%' " // + "and borrado_int != '1' " // + ""); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Consultas.jTable_clientes.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Combustible_uso_personales_jtable(String buscar) { // try { // dtm = (DefaultTableModel) Combustible_uso.jTable_personales.getModel(); // for (int j = 0; j < Combustible_uso.jTable_personales.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_empleado, nombre " // + "from empleado " // + "where nombre ilike '%" + buscar + "%'" // + "order by nombre"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Combustible_uso.jTable_personales.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Combustible_uso_clientes_jtable() { // try { // dtm = (DefaultTableModel) Combustible_venta.jTable_clientes.getModel(); // for (int j = 0; j < Combustible_venta.jTable_clientes.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_cliente, nombre " // + "from cliente " // + ""); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Combustible_venta.jTable_clientes.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Combustible_venta_buscar() { // try { // dtm = (DefaultTableModel) Combustible_venta.jTable_buscar.getModel(); // for (int j = 0; j < Combustible_venta.jTable_buscar.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_combustible_venta, nombre, litros, fecha, descripcion " // + "from combustible_venta " // + "inner join cliente on cliente.id_cliente = combustible_venta.id_cliente " // + "order by fecha DESC"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Combustible_venta.jTable_buscar.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Vehiculos_jtable() { // try { // dtm = (DefaultTableModel) Vehiculo.jTable_vehiculos.getModel(); // for (int j = 0; j < Vehiculo.jTable_vehiculos.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_vehiculo, marca, modelo, descripcion " // + "from vehiculo " // + "where id_vehiculo > '0'"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Vehiculo.jTable_vehiculos.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Contrato_cliente_jtable(String buscar) { // try { // dtm = (DefaultTableModel) Contratos.jTable_cliente.getModel(); // for (int j = 0; j < Contratos.jTable_cliente.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select * " // + "from cliente " // + "where nombre ilike '%" + buscar + "%' " // + "and (borrado_int != '1' or borrado_int is null) " // + "order by nombre"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // if (rs2.getObject(i + 1) != null) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } else { // rows[i] = rs2.getObject(i + 1); // } // } // data2.add(rows); // } // dtm = (DefaultTableModel) Contratos.jTable_cliente.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Listado_recepciones_pendientes_cliente_jtable(String buscar) { // try { // dtm = (DefaultTableModel) Listado_recepciones_pendientes.jTable_cliente.getModel(); // for (int j = 0; j < Listado_recepciones_pendientes.jTable_cliente.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_cliente, nombre " // + "from cliente " // + "where nombre ilike '%" + buscar + "%' " // + "and borrado_int != '1'"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Listado_recepciones_pendientes.jTable_cliente.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Recepcion_motivo_jtable() { // try { // // Conexion.Verificar_conexion(); // // dtm = (DefaultTableModel) Recepcion_ABM.jTable_motivo.getModel(); // for (int j = 0; j < Recepcion_ABM.jTable_motivo.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select * " // + "from motivo " // + "order by motivo"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Recepcion_ABM.jTable_motivo.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Recepcion_motivo_de_descuento_jtable() { // try { // // Conexion.Verificar_conexion(); // // dtm = (DefaultTableModel) Recepcion_ABM.jTable_motivo_de_descuento.getModel(); // for (int j = 0; j < Recepcion_ABM.jTable_motivo_de_descuento.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select distinct (concepto_tabla_ad.id_concepto_tabla_ad), concepto " // + "from concepto_tabla_ad " // + "inner join tabla_ad on tabla_ad.id_concepto_tabla_ad = concepto_tabla_ad.id_concepto_tabla_ad " // + "where id_granos_tipo = '" + id_granos_tipo + "'" // + "order by concepto "); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Recepcion_ABM.jTable_motivo_de_descuento.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Recepcion_variedad_jtable() { // try { // dtm = (DefaultTableModel) Recepcion_ABM.jTable_variedad.getModel(); // for (int j = 0; j < Recepcion_ABM.jTable_variedad.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select * " // + "from variedad " // + "order by variedad"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Recepcion_ABM.jTable_variedad.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Recepcion_zafra_jtable() { // try { // dtm = (DefaultTableModel) Recepcion_ABM.jTable_zafra.getModel(); // for (int j = 0; j < Recepcion_ABM.jTable_zafra.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select * " // + "from zafra " // + "order by zafra"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Recepcion_ABM.jTable_zafra.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Recepcion_remitente_jtable() { // try { // dtm = (DefaultTableModel) Recepcion_ABM.jTable_remitente.getModel(); // for (int j = 0; j < Recepcion_ABM.jTable_remitente.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select * " // + "from remitente " // + "order by remitente"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Recepcion_ABM.jTable_remitente.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Recepcion_mondea_jtable() { // try { // dtm = (DefaultTableModel) Recepcion_Moneda_listado.jTable1.getModel(); // for (int j = 0; j < Recepcion_Moneda_listado.jTable1.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select * " // + "from moneda "); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Recepcion_Moneda_listado.jTable1.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Recepcion_granos_tipo_jtable() { // try { // dtm = (DefaultTableModel) Recepcion_productos_tipo.jTable1.getModel(); // for (int j = 0; j < Recepcion_productos_tipo.jTable1.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select * " // + "from granos_tipo "); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Recepcion_productos_tipo.jTable1.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Recepcion_listado_jtable(String buscar) { // try { // String sql = ""; // dtm = (DefaultTableModel) Recepcion_listado.jTable1.getModel(); // for (int j = 0; j < Recepcion_listado.jTable1.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // // if (privilegio == 1) { // sql = "" // + "select id_recepcion, numero, nombre, movimiento_string, fecha, tipo, parcela, recepcion_estado.estado as recepcionestado, sucursal " // + "from recepcion " // + "inner join parcela on parcela.id_parcela = recepcion.id_parcela " // + "inner join sucursal on sucursal.id_sucursal = recepcion.id_sucursal " // + "inner join cliente on cliente.id_cliente = recepcion.id_cliente " // + "inner join recepcion_estado on recepcion_estado.id_recepcion_estado = recepcion.id_recepcion_estado " // + "inner join granos_tipo on granos_tipo.id_granos_tipo = recepcion.id_granos_tipo " // + "where (recepcion.borrado != 'SI' " // + "and recepcion.borrado_int != '1' " // + "or recepcion.borrado_int is null) " // + "and nombre ilike '%" + buscar + "%' " // + "order by id_recepcion DESC "; // } // if (privilegio == 2) { // sql = "" // + "select id_recepcion, numero, nombre, movimiento_string, fecha, tipo, parcela, recepcion_estado.estado as recepcionestado, sucursal " // + "from recepcion " // + "inner join parcela on parcela.id_parcela = recepcion.id_parcela " // + "inner join sucursal on sucursal.id_sucursal = recepcion.id_sucursal " // + "inner join cliente on cliente.id_cliente = recepcion.id_cliente " // + "inner join recepcion_estado on recepcion_estado.id_recepcion_estado = recepcion.id_recepcion_estado " // + "inner join granos_tipo on granos_tipo.id_granos_tipo = recepcion.id_granos_tipo " // + "where (recepcion.borrado != 'SI' " // + "and recepcion.borrado_int != '1' " // + "or recepcion.borrado_int is null) " // + "and nombre ilike '%" + buscar + "%' " // + "and recepcion.id_sucursal = '" + id_sucursal + "' " // + "order by id_recepcion DESC "; // } // // PreparedStatement ps2 = conexion.prepareStatement(sql); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Recepcion_listado.jTable1.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Tabla_AD_jtable() { // try { // dtm = (DefaultTableModel) Tabla_AD_listado.jTable1.getModel(); // for (int j = 0; j < Tabla_AD_listado.jTable1.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_tablaad, tipo, concepto, cantidad, porcentaje, ad " // + "from tabla_ad " // + "inner join granos_tipo on granos_tipo.id_granos_tipo = tabla_ad.id_granos_tipo " // + "inner join concepto_tabla_ad on concepto_tabla_ad.id_concepto_tabla_ad = tabla_ad.id_concepto_tabla_ad " // + "order by tipo, concepto, cantidad"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Tabla_AD_listado.jTable1.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Stock_de_granos() { // try { // cant = 0; // cant_san_rafael = 0; // // dtm = (DefaultTableModel) Stock.jTable_stock.getModel(); // for (int j = 0; j < Stock.jTable_stock.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select distinct recepcion.id_granos_tipo, tipo, tipo, sucursal from recepcion " // + "inner join sucursal on sucursal.id_sucursal = recepcion.id_sucursal " // + "inner join granos_tipo on granos_tipo.id_granos_tipo = recepcion.id_granos_tipo " // + "where recepcion.borrado_int != '1' " // + " "); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // // Statement ST_Recepcion = conexion.createStatement(); // ResultSet RS_Recepcion = ST_Recepcion.executeQuery("" // + "select * from recepcion " // + "inner join sucursal on sucursal.id_sucursal = recepcion.id_sucursal " // + "where id_granos_tipo='" + rs2.getObject(1) + "' " // + "and borrado_int != '1' " // + " "); // while (RS_Recepcion.next()) { //// if (privilegio == 1) { // if (RS_Recepcion.getLong("movimiento") == 1 && RS_Recepcion.getLong("id_sucursal") == 1) { // cant = RS_Recepcion.getLong("total_neto_carga") + cant; // } // if (RS_Recepcion.getLong("movimiento") == 2 && RS_Recepcion.getLong("id_sucursal") == 1) { // cant = cant - RS_Recepcion.getLong("total_neto_carga"); // } //// } //// if (RS_Recepcion.getLong("movimiento") == 1 && RS_Recepcion.getLong("id_sucursal") == 2) { //// cant_san_rafael = RS_Recepcion.getLong("peso_neto") + cant_san_rafael; //// } //// if (RS_Recepcion.getLong("movimiento") == 2 && RS_Recepcion.getLong("id_sucursal") == 2) { //// cant_san_rafael = cant_san_rafael - RS_Recepcion.getLong("peso_neto"); //// } // // } // // rows[0] = rs2.getObject(1); // rows[1] = rs2.getObject(2).toString().trim(); // rows[2] = cant; // rows[3] = rs2.getObject(4); // cant = 0; // // } // data2.add(rows); // } // dtm = (DefaultTableModel) Stock.jTable_stock.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // // String cantidad = Long.toString(cant); //// Stock.jTextField_stock.setText(getSepararMiles(cantidad)); // // String cantidad_san_rafael = Long.toString(cant_san_rafael); //// Stock.jTextField_stock_san_rafael.setText(getSepararMiles(cantidad_san_rafael)); // // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Stock_de_Combustible() { // try { // long cant_litros_entrada = 0; // long cant_litros_salida = 0; // Statement ST_Granos_Tipo = conexion.createStatement(); // ResultSet RS_Granos_Tipo = ST_Granos_Tipo.executeQuery("select SUM(litros) from combustible where id_sucursal = '1'"); // while (RS_Granos_Tipo.next()) { // cant_litros_entrada = RS_Granos_Tipo.getLong(1); // } // Statement ST_Recepcion = conexion.createStatement(); // ResultSet RS_Recepcion = ST_Recepcion.executeQuery("select SUM(litros) from combustible_uso where id_sucursal = '1'"); // while (RS_Recepcion.next()) { // cant_litros_salida = RS_Recepcion.getLong(1); // // } // // String cantidad = Long.toString(cant_litros_entrada - cant_litros_salida); // Stock_combustible.jTextField_stock.setText(getSepararMiles(cantidad)); // // cant_litros_entrada = 0; // cant_litros_salida = 0; // ST_Granos_Tipo = conexion.createStatement(); // RS_Granos_Tipo = ST_Granos_Tipo.executeQuery("select SUM(litros) from combustible where id_sucursal = '2'"); // while (RS_Granos_Tipo.next()) { // cant_litros_entrada = RS_Granos_Tipo.getLong(1); // } // ST_Recepcion = conexion.createStatement(); // RS_Recepcion = ST_Recepcion.executeQuery("select SUM(litros) from combustible_uso where id_sucursal = '2'"); // while (RS_Recepcion.next()) { // cant_litros_salida = RS_Recepcion.getLong(1); // } // // cantidad = Long.toString(cant_litros_entrada - cant_litros_salida); // Stock_combustible.jTextField_stock_san_rafael.setText(getSepararMiles(cantidad)); // // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Stock_de_granos2() { // try { // cant = 0; // Statement ST_Granos_Tipo = conexion.createStatement(); // ResultSet RS_Granos_Tipo = ST_Granos_Tipo.executeQuery("select * from granos_tipo where borrado != '1'"); // while (RS_Granos_Tipo.next()) { // Statement ST_Recepcion = conexion.createStatement(); // ResultSet RS_Recepcion = ST_Recepcion.executeQuery("" // + "select * from recepcion " // + "where id_granos_tipo='" + RS_Granos_Tipo.getInt("id_granos_tipo") + "' " // + "and borrado_int != '1' and id_sucursal = '" + id_sucursal_selected + "' "); // while (RS_Recepcion.next()) { // if (RS_Recepcion.getLong("movimiento") == 1) { // cant = RS_Recepcion.getLong("total_neto_carga") + cant; // } // if (RS_Recepcion.getLong("movimiento") == 2) { // cant = cant - RS_Recepcion.getLong("total_neto_carga"); // } // // } // } // RS_Granos_Tipo = ST_Granos_Tipo.executeQuery("select * from granos_tipo where borrado != '1'"); // while (RS_Granos_Tipo.next()) { // Statement ST_Recepcion = conexion.createStatement(); // ResultSet RS_Recepcion = ST_Recepcion.executeQuery("" // + "select * from recepcion " // + "where id_granos_tipo='" + RS_Granos_Tipo.getInt("id_granos_tipo") + "' " // + "and borrado_int != '1' " // + "and id_sucursal = '" + id_sucursal_selected + "' "); // while (RS_Recepcion.next()) { // if (RS_Recepcion.getLong("movimiento") == 1) { // total_sin_descuento = RS_Recepcion.getLong("peso_neto") + total_sin_descuento; // } // if (RS_Recepcion.getLong("movimiento") == 2) { // total_sin_descuento = total_sin_descuento - RS_Recepcion.getLong("peso_neto"); // } // } // } // // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Camion_cargar_jtable(String buscar) { // try { // dtm = (DefaultTableModel) Camion_listado.jTable1.getModel(); // for (int j = 0; j < Camion_listado.jTable1.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_camion,marca,modelo,anho,chapa, nombre " // + "from camion " // + "inner join transportista on transportista.id_transportista = camion.id_transportista " // + "where marca ilike '%" + buscar + "%' " // + "and camion.borrado_int != '1'"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Camion_listado.jTable1.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Productos_cargar_jtable(String buscar) { // try { // dtm = (DefaultTableModel) Productos_listado.jTable1.getModel(); // for (int j = 0; j < Productos_listado.jTable1.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_producto, nombre " // + "from productos " // + "where nombre ilike '%" + buscar + "%'"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Productos_listado.jTable1.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Parcela_cargar_jtable(String buscar) { // try { // dtm = (DefaultTableModel) Parcela_listado.jTable1.getModel(); // for (int j = 0; j < Parcela_listado.jTable1.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_parcela, parcela, precio_del_flete, porcentaje, has " // + "from parcela " // + "where parcela ilike '%" + buscar + "%' " // + "order by parcela"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // if (rs2.getObject(i + 1) != null) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // // } else { // rows[i] = rs2.getObject(i + 1); // // } // } // data2.add(rows); // } // dtm = (DefaultTableModel) Parcela_listado.jTable1.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Recepcion_Parcela_cargar_jtable(String buscar) { // try { // dtm = (DefaultTableModel) Recepcion_Parcela_listado.jTable1.getModel(); // for (int j = 0; j < Recepcion_Parcela_listado.jTable1.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_parcela, parcela, precio_del_flete " // + "from parcela " // + "where parcela ilike '%" + buscar + "%' "); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Recepcion_Parcela_listado.jTable1.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Listados_Parcela_cargar_jtable(String buscar) { // try { // dtm = (DefaultTableModel) Listados_Parcela_listado.jTable1.getModel(); // for (int j = 0; j < Listados_Parcela_listado.jTable1.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_parcela, parcela " // + "from parcela " // + "where parcela ilike '%" + buscar + "%' "); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Listados_Parcela_listado.jTable1.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Recepcion_Camion_cargar_jtable(String buscar) { // try { // dtm = (DefaultTableModel) Recepcion_Camion_listado.jTable1.getModel(); // for (int j = 0; j < Recepcion_Camion_listado.jTable1.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_camion,marca,modelo,anho,chapa, nombre " // + "from camion " // + "inner join transportista on transportista.id_transportista = camion.id_transportista " // + "where chapa ilike '%" + buscar + "%' " // + "and camion.borrado_int != '1'"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Recepcion_Camion_listado.jTable1.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Cliente_cargar_jtable(String buscar) { // try { // dtm = (DefaultTableModel) Cliente_listado.jTable1.getModel(); // for (int j = 0; j < Cliente_listado.jTable1.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_cliente,nombre,ruc,telefono,direccion " // + "from cliente " // + "where nombre ilike '%" + buscar + "%' " // + "and (borrado_int != '1' or borrado_int is null) " // + "order by nombre"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // if (rs2.getObject(i + 1) != null) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // } // data2.add(rows); // } // dtm = (DefaultTableModel) Cliente_listado.jTable1.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Personales_cargar_jtable(String buscar) { // try { // dtm = (DefaultTableModel) Personales_listado.jTable1.getModel(); // for (int j = 0; j < Personales_listado.jTable1.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_empleado,nombre,ci,telefono,descripcion_del_trabajo, salario " // + "from empleado " // + "where nombre ilike '%" + buscar + "%' " // + "order by nombre"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // if (rs2.getObject(i + 1) != null) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // } // data2.add(rows); // } // dtm = (DefaultTableModel) Personales_listado.jTable1.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Empleado_cargo_cargar_jtable(String buscar) { // try { // dtm = (DefaultTableModel) Personales_Cargo_listado.jTable1.getModel(); // for (int j = 0; j < Personales_Cargo_listado.jTable1.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_empleado_cargo, cargo " // + "from empleado_cargo " // + "where cargo ilike '%" + buscar + "%' " // + ""); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // if (rs2.getObject(i + 1) != null) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // } // data2.add(rows); // } // dtm = (DefaultTableModel) Personales_Cargo_listado.jTable1.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Producto_proveedor_cargar_jtable(String buscar) { // try { // dtm = (DefaultTableModel) Producto_proveedor_listado.jTable1.getModel(); // for (int j = 0; j < Producto_proveedor_listado.jTable1.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_proveedor, nombre, ruc " // + "from proveedor " // + "where nombre ilike '%" + buscar + "%' " // + "order by nombre"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // if (rs2.getObject(i + 1) != null) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // } // data2.add(rows); // } // dtm = (DefaultTableModel) Producto_proveedor_listado.jTable1.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Listado_recepciones_Cliente_cargar_jtable(String buscar) { // try { // dtm = (DefaultTableModel) Listado_recepciones_Cliente_buscar.jTable1.getModel(); // for (int j = 0; j < Listado_recepciones_Cliente_buscar.jTable1.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_cliente,nombre " // + "from cliente " // + "where nombre ilike '%" + buscar + "%' " // + "and (borrado_int != '1' or borrado_int is null) " // + "order by nombre"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // if (rs2.getObject(i + 1) != null) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // } // data2.add(rows); // } // dtm = (DefaultTableModel) Listado_recepciones_Cliente_buscar.jTable1.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Listado_recepciones_Usuario_cargar_jtable(String buscar) { // try { // dtm = (DefaultTableModel) Listado_recepciones_Usuario_buscar.jTable1.getModel(); // for (int j = 0; j < Listado_recepciones_Usuario_buscar.jTable1.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_usuario,nombre_real " // + "from usuario " // + "where nombre ilike '%" + buscar + "%' " // + "order by nombre"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // if (rs2.getObject(i + 1) != null) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // } // data2.add(rows); // } // dtm = (DefaultTableModel) Listado_recepciones_Usuario_buscar.jTable1.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Recepcion_Cliente_cargar_jtable(String buscar) { // try { // dtm = (DefaultTableModel) Recepcion_Cliente_listado.jTable1.getModel(); // for (int j = 0; j < Recepcion_Cliente_listado.jTable1.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_cliente,nombre " // + "from cliente " // + "where nombre ilike '%" + buscar + "%' " // + "and (borrado_int != '1' or borrado_int is null) " // + "order by nombre"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // if (rs2.getObject(i + 1) != null) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // } // data2.add(rows); // } // dtm = (DefaultTableModel) Recepcion_Cliente_listado.jTable1.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Chofer_cargar_jtable(String buscar) { // try { // dtm = (DefaultTableModel) Conductor_listado.jTable1.getModel(); // for (int j = 0; j < Conductor_listado.jTable1.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_chofer,nombre,ci,telefono,direccion " // + "from chofer " // + "where nombre ilike '%" + buscar + "%' " // + "and (borrado_int != '1' or borrado_int is null) " // + "order by nombre"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // if (rs2.getObject(i + 1) != null) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // } // data2.add(rows); // } // dtm = (DefaultTableModel) Conductor_listado.jTable1.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Consultas_estado_jtable() { // try { // dtm = (DefaultTableModel) Consultas.jTable_estado.getModel(); // for (int j = 0; j < Consultas.jTable_estado.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select * " // + "from recepcion_estado " // + "order by recepcion_estado "); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // if (rs2.getObject(i + 1) != null) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // } // data2.add(rows); // } // dtm = (DefaultTableModel) Consultas.jTable_estado.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Listado_recepciones_Chofer_cargar_jtable(String buscar) { // try { // dtm = (DefaultTableModel) Listados_recepciones_Chofer_listado.jTable1.getModel(); // for (int j = 0; j < Listados_recepciones_Chofer_listado.jTable1.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_chofer,nombre,ci,telefono,direccion " // + "from chofer " // + "where nombre ilike '%" + buscar + "%' " // + "and (borrado_int != '1' or borrado_int is null) " // + "order by nombre"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // if (rs2.getObject(i + 1) != null) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // } // data2.add(rows); // } // dtm = (DefaultTableModel) Listados_recepciones_Chofer_listado.jTable1.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Recepcion_Chofer_cargar_jtable(String buscar) { // try { // dtm = (DefaultTableModel) Recepcion_Chofer_listado.jTable1.getModel(); // for (int j = 0; j < Recepcion_Chofer_listado.jTable1.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_chofer,nombre,ci,telefono,direccion " // + "from chofer " // + "where nombre ilike '%" + buscar + "%' " // + "and (borrado_int != '1' or borrado_int is null) " // + "order by nombre"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // if (rs2.getObject(i + 1) != null) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // } // data2.add(rows); // } // dtm = (DefaultTableModel) Recepcion_Chofer_listado.jTable1.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Carreta_cargar_jtable(String buscar) { // try { // dtm = (DefaultTableModel) Carreta_listado.jTable1.getModel(); // for (int j = 0; j < Carreta_listado.jTable1.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_carreta,marca,modelo,chapa,anho " // + "from carreta " // + "where marca ilike '%" + buscar + "%' " // + "and (borrado_int != '1' or borrado_int is null) " // + "order by marca"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // if (rs2.getObject(i + 1) != null) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // } // data2.add(rows); // } // dtm = (DefaultTableModel) Carreta_listado.jTable1.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Proveedor_cargar_jtable(String buscar) { // try { // dtm = (DefaultTableModel) Proveedor_listado.jTable1.getModel(); // for (int j = 0; j < Proveedor_listado.jTable1.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_proveedor, nombre, telefono, ruc " // + "from proveedor " // + "where nombre ilike '%" + buscar + "%' " // + "order by nombre"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // if (rs2.getObject(i + 1) != null) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // } // data2.add(rows); // } // dtm = (DefaultTableModel) Proveedor_listado.jTable1.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Recepcion_Carreta_cargar_jtable(String buscar) { // try { // dtm = (DefaultTableModel) Recepcion_Carreta_listado.jTable1.getModel(); // for (int j = 0; j < Recepcion_Carreta_listado.jTable1.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_carreta,marca,modelo,chapa,anho " // + "from carreta " // + "where marca ilike '%" + buscar + "%' " // + "and (borrado_int != '1' or borrado_int is null) " // + "order by marca"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // if (rs2.getObject(i + 1) != null) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // } // data2.add(rows); // } // dtm = (DefaultTableModel) Recepcion_Carreta_listado.jTable1.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Camion_Trasnportista_cargar_jtable(String buscar) { // try { // dtm = (DefaultTableModel) Camion_transportista_listado.jTable1.getModel(); // for (int j = 0; j < Camion_transportista_listado.jTable1.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select * " // + "from transportista " // + "where nombre ilike '%" + buscar + "%' " // + "and borrado_int != '1'"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Camion_transportista_listado.jTable1.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Combustibles_uso_litros(Date fecha) { // try { // Statement ST_Productos = conexion.createStatement(); // ResultSet RS_Productos = ST_Productos.executeQuery("" // + "SELECT SUM(litros) " // + "from combustible_uso " // + "where fecha = '" + fecha + "' " // + "and id_sucursal = '" + id_sucursal + "'"); // if (RS_Productos.next()) { // if (RS_Productos.getString(1) != null) { // Combustible_uso.jTextField_total.setText(getSepararMiles(RS_Productos.getString(1))); // } // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Combustibles_uso_jtable(Date fecha) { // try { // dtm = (DefaultTableModel) Combustible_uso.jTable_combustible_uso.getModel(); // for (int j = 0; j < Combustible_uso.jTable_combustible_uso.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_combustible_uso, fecha, litros, combustible_uso.descripcion, tipo, modelo, vehiculo.descripcion, nombre " // + "from combustible_uso " // + "inner join vehiculo on vehiculo.id_vehiculo = combustible_uso.id_vehiculo " // + "inner join empleado on empleado.id_empleado = combustible_uso.id_empleado " // + "where fecha = '" + fecha + "' " // + "and id_sucursal = '" + id_sucursal + "'" // + "order by fecha, id_combustible_uso DESC"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Combustible_uso.jTable_combustible_uso.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } public static void Transportista_borrar() { try { PreparedStatement stClienteBorrar = conexion.prepareStatement("" + "UPDATE transportista " + "SET borrado_int = '1' " + "WHERE id_transportista ='" + id_transportista + "'"); stClienteBorrar.executeUpdate(); } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public static void Contrato_borrar() { try { PreparedStatement stClienteBorrar = conexion.prepareStatement("" + "DELETE from contrato " + "WHERE id_contrato ='" + id_contrato + "'"); stClienteBorrar.executeUpdate(); } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public static void productos_aplicacion_abm_id_detalle_borrar() { try { PreparedStatement stClienteBorrar = conexion.prepareStatement("" + "DELETE from producto_aplicacion_detalle " + "WHERE id_producto_aplicacion_detalle ='" + productos_aplicacion_detalle_id_producto_aplicacion_detalle + "'"); stClienteBorrar.executeUpdate(); } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public static void Recepcion_detalle_borrar() { try { PreparedStatement stClienteBorrar = conexion.prepareStatement("" + "DELETE from recepcion_detalle " + "WHERE id_recepcion_detalle ='" + recepcion_id_recepcion_detalle + "'"); stClienteBorrar.executeUpdate(); double peso_neto = 0; double total_descuento = 0; Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("SELECT * FROM recepcion where id_recepcion = '" + id_recepcion + "'"); if (result.next()) { peso_neto = result.getDouble("peso_neto"); } st1 = conexion.createStatement(); result = st1.executeQuery("SELECT SUM(descuento) FROM recepcion_detalle where id_recepcion = '" + id_recepcion + "'"); if (result.next()) { total_descuento = result.getLong(1); } double total_neto_carga = peso_neto - total_descuento; long tnc = (long) total_neto_carga; long total_desc = (long) total_descuento; PreparedStatement st2 = conexion.prepareStatement("" + "UPDATE recepcion " + "SET total_descuento ='" + total_desc + "', " + "total_neto_carga ='" + tnc + "' " + "WHERE id_recepcion = '" + id_recepcion + "'"); st2.executeUpdate(); } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public static void Compra_detalle_borrar() { try { PreparedStatement stClienteBorrar = conexion.prepareStatement("" + "DELETE from facturas_compra_detalle " + "WHERE id_facturas_compra_detalle ='" + id_facturas_compras_detalle + "'"); stClienteBorrar.executeUpdate(); } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public static void Personales_pagos_detalle_borrar() { try { PreparedStatement st = conexion.prepareStatement("" + "DELETE from sueldo_detalle " + "WHERE id_sueldo_detalle ='" + id_sueldo_detalle + "'"); st.executeUpdate(); Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("SELECT SUM(importe) FROM sueldo_detalle where id_sueldo = '" + id_sueldo + "'"); if (result.next()) { st = conexion.prepareStatement("" + "UPDATE sueldo " + "SET total ='" + result.getLong(1) + "' " + "WHERE id_sueldo = '" + id_sueldo + "'"); st.executeUpdate(); } } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public static void Parcela_borrar() { try { PreparedStatement st = conexion.prepareStatement("" + "DELETE from parcela " + "WHERE id_parcela ='" + id_parcela + "'"); st.executeUpdate(); JOptionPane.showMessageDialog(null, "Borrado correctamente"); } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public static void Ventas_detalle_borrar() { try { PreparedStatement stClienteBorrar = conexion.prepareStatement("" + "DELETE from venta_detalle " + "WHERE id_venta_detalle ='" + id_venta_detalle + "'"); stClienteBorrar.executeUpdate(); } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public static void Recepcion_anular() { try { PreparedStatement stClienteBorrar = conexion.prepareStatement("" + "UPDATE recepcion " + "SET borrado_int = '1' " + "WHERE id_recepcion ='" + id_recepcion + "'"); stClienteBorrar.executeUpdate(); } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public static void Cliente_borrar() { try { PreparedStatement stClienteBorrar = conexion.prepareStatement("" + "UPDATE cliente " + "SET borrado_int ='1' " + "WHERE id_cliente ='" + id_cliente + "'"); stClienteBorrar.executeUpdate(); } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public static void Chofer_borrar() { try { PreparedStatement stClienteBorrar = conexion.prepareStatement("" + "UPDATE chofer " + "SET borrado_int ='1' " + "WHERE id_chofer ='" + id_chofer + "'"); stClienteBorrar.executeUpdate(); } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public static void Carreta_borrar() { try { PreparedStatement stClienteBorrar = conexion.prepareStatement("" + "UPDATE carreta " + "SET borrado_int ='1' " + "WHERE id_carreta ='" + id_carreta + "'"); stClienteBorrar.executeUpdate(); } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public static void Combustible_uso_borrar() { try { PreparedStatement stClienteBorrar = conexion.prepareStatement("" + "DELETE from combustible_uso " + "WHERE id_combustible_uso ='" + id_combustible_uso_selected + "'"); stClienteBorrar.executeUpdate(); } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } // // public static void Cofiguracion_obtener_datos() { // try { // Statement ST31 = conexion.createStatement(); // ResultSet RS31 = ST31.executeQuery("" // + "SELECT * FROM configuracion "); // while (RS31.next()) { // Configuracion.jTextField_anho.setText(RS31.getString("anho")); // Configuracion.jTextField_empresa.setText(RS31.getString("empresa").trim()); // Configuracion.jTextField_telefono.setText(RS31.getString("telefono").trim()); // Configuracion.jTextField_ruc.setText(RS31.getString("ruc").trim()); // Configuracion.jTextField_dolar.setText(RS31.getString("dolar").trim()); // Configuracion.jTextField_direccion.setText(RS31.getString("direccion").trim()); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } public static synchronized void Recepcion_guardar( String numero, Date fecha, String comp_pesaje, String peso_bruto_str, String peso_tara_str, // String humedad, // String impurezas, // String quebrados, // String granos_verdes, // String ardidos, // String chuzos, String origen, String destino, Date fecha_salida, Date fecha_llegada, String precio, String observaciones, String total_a_pagar) { try { if (id_cliente == 0) { JOptionPane.showMessageDialog(null, "Complete el cliente"); } if (id_chofer == 0) { JOptionPane.showMessageDialog(null, "Complete el chofer"); } if (id_camion == 0) { JOptionPane.showMessageDialog(null, "Complete el camion"); } if (id_carreta == 0) { JOptionPane.showMessageDialog(null, "Complete la carreta"); } if (id_cliente == 0 || id_chofer == 0 || id_carreta == 0 || id_camion == 0) { JOptionPane.showMessageDialog(null, "Complete todos los campos."); } else { if (isNumeric(precio) || isNumericDouble(precio)) { } else { precio = "0"; // Recepcion_ABM.jTextField_precio.setText("0"); } long peso_tara = Long.parseLong(peso_tara_str.replace(".", "")); long peso_bruto = Long.parseLong(peso_bruto_str.replace(".", "")); DecimalFormat num = new DecimalFormat("#,###,###"); double descuento_humedad = 0; double descuento_humedad_kg = 0; String descuento_humedad_string = null; double descuento_ardidos = 0; double descuento_ardidos_kg = 0; String descuento_ardidos_string = null; double descuento_chuzos = 0; double descuento_chuzos_kg = 0; String descuento_chuzos_string = null; double descuento_quebrados = 0; double descuento_quebrados_kg = 0; String descuento_quebrados_string = null; double descuento_impurezas = 0; double descuento_impurezas_kg = 0; String descuento_impurezas_string = null; double descuento_granos_verdes = 0; double descuento_granos_verdes_kg = 0; String descuento_granos_verdes_string = "0.00"; int error = 0; int error_general = 0; String error_detalle = ""; String movimiento_string = ""; double total_descuento_kg = 0; // Statement ST_tabla_ad_humedad = conexion.createStatement(); // ResultSet RS_tabla_ad_humedad = ST_tabla_ad_humedad.executeQuery("SELECT * FROM tabla_ad where cantidad= '" + humedad + "' and id_concepto_tabla_ad='1'"); // while (RS_tabla_ad_humedad.next()) { // descuento_humedad_string = RS_tabla_ad_humedad.getString("porcentaje"); // } // Statement ST_tabla_ad_impurezas = conexion.createStatement(); // ResultSet RS_tabla_ad_impurezas = ST_tabla_ad_impurezas.executeQuery("SELECT * FROM tabla_ad where cantidad= '" + impurezas + "' and id_concepto_tabla_ad='2'"); // while (RS_tabla_ad_impurezas.next()) { // descuento_impurezas_string = RS_tabla_ad_impurezas.getString("porcentaje"); // } // Statement ST_tabla_ad_chuzos = conexion.createStatement(); // ResultSet RS_tabla_ad_chuzos = ST_tabla_ad_chuzos.executeQuery("SELECT * FROM tabla_ad where cantidad= '" + chuzos + "' and id_concepto_tabla_ad='4'"); // while (RS_tabla_ad_chuzos.next()) { // descuento_chuzos_string = RS_tabla_ad_chuzos.getString("porcentaje"); // } // Statement ST_tabla_ad_ardidos = conexion.createStatement(); // ResultSet RS_tabla_ad_ardidos = ST_tabla_ad_ardidos.executeQuery("SELECT * FROM tabla_ad where cantidad= '" + ardidos + "' and id_concepto_tabla_ad='5'"); // while (RS_tabla_ad_ardidos.next()) { // descuento_ardidos_string = RS_tabla_ad_ardidos.getString("porcentaje"); // } // Statement ST_tabla_ad_quebrados = conexion.createStatement(); // ResultSet RS_tabla_ad_quebrados = ST_tabla_ad_quebrados.executeQuery("SELECT * FROM tabla_ad where cantidad= '" + quebrados + "' and id_concepto_tabla_ad='6'"); // while (RS_tabla_ad_quebrados.next()) { // descuento_quebrados_string = RS_tabla_ad_quebrados.getString("porcentaje"); // } // // Statement ST_tabla_ad_granos_verdes = conexion.createStatement(); // ResultSet RS_tabla_ad_granos_verdes = ST_tabla_ad_granos_verdes.executeQuery("SELECT * FROM tabla_ad where cantidad= '" + granos_verdes + "' and id_concepto_tabla_ad='3'"); // while (RS_tabla_ad_granos_verdes.next()) { // descuento_granos_verdes_string = RS_tabla_ad_granos_verdes.getString("porcentaje"); // } // // descuento_humedad = Double.parseDouble((descuento_humedad_string)); // descuento_impurezas = Double.parseDouble((descuento_impurezas_string)); // descuento_granos_verdes = Double.parseDouble((descuento_granos_verdes_string)); // descuento_chuzos = Double.parseDouble((descuento_chuzos_string)); // descuento_ardidos = Double.parseDouble((descuento_ardidos_string)); // descuento_quebrados = Double.parseDouble((descuento_quebrados_string)); Long peso_neto_long = new Long(peso_bruto - peso_tara); double peso_neto_double = peso_neto_long.doubleValue(); // descuento_humedad_kg = (peso_neto_double * descuento_humedad / 100); // descuento_impurezas_kg = (peso_neto_double * descuento_impurezas / 100); // descuento_granos_verdes_kg = (peso_neto_double * descuento_granos_verdes / 100); // descuento_chuzos_kg = (peso_neto_double * descuento_chuzos / 100); // descuento_ardidos_kg = (peso_neto_double * descuento_ardidos / 100); // descuento_quebrados_kg = (peso_neto_double * descuento_quebrados / 100); total_descuento_kg = (descuento_impurezas_kg + descuento_humedad_kg + descuento_granos_verdes_kg + descuento_chuzos_kg + descuento_ardidos_kg + descuento_quebrados_kg); // long total_descuento = 0; // long total_descuento = (new Double(total_descuento_kg)).longValue(); // long descuento_humedad_kg_long = (new Double(descuento_humedad_kg)).longValue(); // long descuento_impurezas_kg_long = (new Double(descuento_impurezas_kg)).longValue(); // long descuento_granos_verdes_kg_long = (new Double(descuento_granos_verdes_kg)).longValue(); // long descuento_chuzos_kg_long = (new Double(descuento_chuzos_kg)).longValue(); // long descuento_ardidos_kg_long = (new Double(descuento_ardidos_kg)).longValue(); // long descuento_quebrados_kg_long = (new Double(descuento_quebrados_kg)).longValue(); long total_descuento = 0; long descuento_humedad_kg_long = 0; long descuento_impurezas_kg_long = 0; long descuento_granos_verdes_kg_long = 0; long descuento_chuzos_kg_long = 0; long descuento_ardidos_kg_long = 0; long descuento_quebrados_kg_long = 0; long peso_neto = (peso_bruto - peso_tara); long total_neto_carga = (peso_neto - total_descuento); int estado = 0; int guardo = 0; long _num = id_recepcion; Statement ST_Configuracion = conexion.createStatement(); ResultSet RS_Configuracion = ST_Configuracion.executeQuery("SELECT * FROM sucursal where id_sucursal = '" + id_sucursal + "'"); while (RS_Configuracion.next()) { _num = RS_Configuracion.getLong("numero_remision") + 1; } String moneda_str = ""; Statement ST_moneda = conexion.createStatement(); ResultSet RS_moneda = ST_moneda.executeQuery("SELECT * FROM moneda where id_moneda = '" + id_moneda + "'"); while (RS_moneda.next()) { moneda_str = RS_moneda.getString("moneda"); } int movimiento = 0; // if (Recepcion_ABM.jCheckBox_recepcion.isSelected()) { // movimiento = 1; // } // if (Recepcion_ABM.jCheckBox_remision.isSelected()) { // movimiento = 2; // } java.sql.Date fecha_sql_date = util_Date_to_sql_date(fecha); if (peso_tara == 0) { estado = 3; } if (movimiento == 1) { movimiento_string = "Recepcion"; } if (movimiento == 2) { movimiento_string = "Remision"; } java.sql.Date fecha_salida_sql_date = util_Date_to_sql_date(fecha_salida); java.sql.Date fecha_llegada_sql_date = util_Date_to_sql_date(fecha_llegada); if (id_recepcion == 0) { /// INSERT NUEVO // Recepcion_MAX(); id_recepcion = id_recepcion + 1; PreparedStatement st2 = conexion.prepareStatement("" + "INSERT INTO recepcion VALUES(" + "?,?,?,?,?, ?,?,?,?,?," + "?,?,?,?,?, ?,?,?,?,?," + "?,?,?,?,?, ?,?,?,?,?," + "?,?,?,?,?, ?,?,?,?,?," + "?,?,?,?,?, ?,?,?,?,?," + "?,?,?,?,?, ?,?,?)"); st2.setInt(1, id_recepcion); if (movimiento == 2) { st2.setLong(2, _num); guardo = 1; } else { st2.setInt(2, id_recepcion); } st2.setDate(3, fecha_sql_date); st2.setInt(4, id_cliente); st2.setInt(5, id_granos_tipo); st2.setInt(6, id_camion); st2.setInt(7, id_carreta); st2.setInt(8, id_chofer); st2.setString(9, comp_pesaje); st2.setLong(10, peso_bruto); st2.setLong(11, peso_tara); st2.setLong(12, peso_neto); st2.setString(13, ""); st2.setString(13, ""); st2.setString(14, ""); st2.setString(15, ""); st2.setString(16, ""); st2.setString(17, ""); st2.setString(18, ""); st2.setLong(19, total_descuento); st2.setLong(20, total_neto_carga); st2.setString(21, "NO"); st2.setInt(22, 0); st2.setInt(23, estado); st2.setString(24, ""); st2.setString(25, ""); // st2.setString(26, humedad + " % - " + descuento_humedad + " % - " + num.format(descuento_humedad_kg_long) + " Kg"); // st2.setString(27, impurezas + " % - " + descuento_impurezas + " % - " + num.format(descuento_impurezas_kg_long) + " Kg"); // st2.setString(28, quebrados + " % - " + descuento_quebrados + " % - " + num.format(descuento_quebrados_kg_long) + " Kg"); // st2.setString(29, granos_verdes + " % - " + descuento_granos_verdes + " % - " + num.format(descuento_granos_verdes_kg_long) + " Kg"); // st2.setString(30, ardidos + " % - " + descuento_ardidos + " % - " + num.format(descuento_ardidos_kg_long) + " Kg"); // st2.setString(31, chuzos + " % - " + descuento_chuzos + " % - " + num.format(descuento_chuzos_kg_long) + " Kg"); st2.setString(26, ""); st2.setString(27, ""); st2.setString(28, ""); st2.setString(29, ""); st2.setString(30, ""); st2.setString(31, ""); st2.setInt(32, movimiento); st2.setString(33, movimiento_string); st2.setString(34, origen); st2.setString(35, destino); st2.setDate(36, fecha_salida_sql_date); st2.setDate(37, fecha_llegada_sql_date); st2.setInt(38, 0); st2.setDouble(39, Double.parseDouble(precio)); st2.setInt(40, id_parcela); st2.setString(41, observaciones); st2.setString(42, descuento_humedad + " %"); st2.setLong(43, descuento_humedad_kg_long); st2.setString(44, descuento_impurezas + " %"); st2.setLong(45, descuento_impurezas_kg_long); st2.setString(46, descuento_quebrados + " %"); st2.setLong(47, descuento_quebrados_kg_long); st2.setString(48, descuento_ardidos + " %"); st2.setLong(49, descuento_quebrados_kg_long); st2.setInt(50, id_usuario); // st2.setDouble(51, Double.parseDouble(Recepcion_ABM.jTextField_total.getText().replace(".", "").replace(",", "."))); st2.setLong(52, id_moneda); st2.setInt(53, recepcion_id_motivo); st2.setInt(54, recepcion_id_zafra); if (Double.parseDouble(precio) >= 1) { st2.setInt(55, 2); } else { st2.setInt(55, 1); } st2.setInt(56, id_sucursal); st2.setInt(57, recepcion_id_variedad); st2.setInt(58, recepcion_id_remitente); // if (id_recepcion < 500) { st2.executeUpdate(); // Recepcion_ABM.jTextField_neto_descuento.setText(getSepararMiles(String.valueOf(total_neto_carga))); // } int id_recibo = 1; Statement st_recibo_id = conexion.createStatement(); ResultSet result_recibo_id = st_recibo_id.executeQuery("SELECT MAX(id_recibo) FROM recibo"); if (result_recibo_id.next()) { id_recibo = result_recibo_id.getInt(1) + 1; } Calendar fecha2 = new GregorianCalendar(); int anho = fecha2.get(Calendar.YEAR); int mes = fecha2.get(Calendar.MONTH); int dia = fecha2.get(Calendar.DAY_OF_MONTH); PreparedStatement st3 = conexion.prepareStatement("INSERT INTO recibo VALUES(?,?,?,?,?,?,?,?)"); st3.setInt(1, id_recibo); st3.setInt(2, id_cliente); st3.setDate(3, fecha_sql_date); st3.setString(4, "Recepcion de granos segun nota de remision adjunta nro" + numero); st3.setLong(5, 450 * total_neto_carga); st3.setString(6, "NO"); st3.setString(7, "Natalio, " + dia + " del " + (mes + 1) + " del " + anho + ";"); st3.setString(8, "NO"); st3.executeUpdate(); if (guardo == 1) { PreparedStatement stUpdateAuxiliar = conexion.prepareStatement("" + "UPDATE sucursal " + "SET numero_remision ='" + _num + "' " + "WHERE id_sucursal ='" + id_sucursal + "'"); stUpdateAuxiliar.executeUpdate(); guardo = 0; } // JOptionPane.showMessageDialog(null, "Guardado correctamente"); // FIN INSERT } else { // update int id_recepcion_estado = 0; if (Double.parseDouble(precio) >= 1) { id_recepcion_estado = 2; } else { id_recepcion_estado = 1; } if (movimiento == 2) { numero = String.valueOf(_num); } if (movimiento == 1) { numero = String.valueOf(id_recepcion); } PreparedStatement stUpdateAuxiliar = conexion.prepareStatement("" + "UPDATE recepcion " + "SET fecha ='" + fecha_sql_date + "', " + "numero ='" + numero + "', " + "id_cliente ='" + id_cliente + "', " + "id_granos_tipo ='" + id_granos_tipo + "', " + "id_camion ='" + id_camion + "', " + "id_carreta ='" + id_carreta + "', " + "id_chofer ='" + id_chofer + "', " + "comp_pesaje ='" + comp_pesaje + "', " + "peso_bruto ='" + peso_bruto + "', " + "peso_tara ='" + peso_tara + "', " + "peso_neto ='" + peso_neto + "', " // + "humedad ='" + humedad + "', " // + "impurezas ='" + impurezas + "', " // + "quebrados ='" + quebrados + "', " // + "granos_verdes ='" + granos_verdes + "', " // + "total_descuento ='" + total_descuento + "', " // + "total_neto_carga ='" + total_neto_carga + "', " + "estado ='" + estado + "', " // + "ardidos ='" + ardidos + "', " // + "chuzos ='" + chuzos + "', " // + "por_humedad ='" + humedad + " % - " + descuento_humedad + " % - " + num.format(descuento_humedad_kg_long) + " Kg" + "', " // + "por_impurezas ='" + impurezas + " % - " + descuento_impurezas + " % - " + num.format(descuento_impurezas_kg_long) + " Kg" + "', " // + "por_quebrados ='" + quebrados + " % - " + descuento_quebrados + " % - " + num.format(descuento_quebrados_kg_long) + " Kg" + "', " // + "por_granos_verdes ='" + granos_verdes + " % - " + descuento_granos_verdes + " % - " + num.format(descuento_granos_verdes_kg_long) + " Kg" + "', " // + "por_ardidos ='" + ardidos + " % - " + descuento_ardidos + " % - " + num.format(descuento_ardidos_kg_long) + " Kg" + "', " // + "por_chuzos ='" + chuzos + " % - " + descuento_chuzos + " % - " + num.format(descuento_chuzos_kg_long) + " Kg" + "', " + "movimiento ='" + movimiento + "', " + "movimiento_string ='" + movimiento_string + "', " + "origen ='" + origen + "', " + "destino ='" + destino + "', " + "observaciones ='" + observaciones + "', " + "id_recepcion_estado ='" + id_recepcion_estado + "', " + "id_parcela ='" + id_parcela + "', " // + "humedad_descuento_por ='" + descuento_humedad + " %" + "', " // + "humedad_descuento_kg ='" + descuento_humedad_kg_long + "', " // + "impurezas_descuento_por ='" + descuento_impurezas + " %" + "', " // + "impurezas_descuento_kg ='" + descuento_impurezas_kg_long + "', " // + "quebrados_descuento_por ='" + descuento_quebrados + " %" + "', " // + "quebrados_descuento_kg ='" + descuento_quebrados_kg_long + "', " // + "ardidos_descuento_por ='" + descuento_ardidos + " %" + "', " // + "ardidos_descuento_kg ='" + descuento_ardidos_kg_long + "', " + "precio ='" + Double.parseDouble(precio) + "', " // + "total_a_pagar ='" + Double.parseDouble(Recepcion_ABM.jTextField_total.getText().replace(".", "").replace(",", ".")) + "', " + "fecha_salida ='" + fecha_salida_sql_date + "', " + "id_moneda ='" + id_moneda + "', " + "id_motivo ='" + recepcion_id_motivo + "', " + "id_zafra ='" + recepcion_id_zafra + "', " + "id_variedad ='" + recepcion_id_variedad + "', " + "id_remitente ='" + recepcion_id_remitente + "', " + "fecha_llegada ='" + fecha_llegada_sql_date + "' " + "WHERE id_recepcion ='" + id_recepcion + "'"); stUpdateAuxiliar.executeUpdate(); // Recepcion_ABM.jTextField_neto_descuento.setText(getSepararMiles(String.valueOf(total_neto_carga))); // JOptionPane.showMessageDialog(null, "Actualizado correctamente"); } } } catch (SQLException ex) { JOptionPane.showMessageDialog(null, "Error en uno de los campos." + ex); } } public static DecimalFormat num_decimal_dolares = new DecimalFormat("#.##"); public static DecimalFormat num_decimal_gs = new DecimalFormat("###,###,###,###"); static void Recibo_de_dinero_update(String cheque, String concepto, String dinero, Date fecha) { try { PreparedStatement st2 = conexion.prepareStatement("UPDATE recibo " + "SET id_cliente = '" + recibo_de_dinero_id_cliente + "', " + "id_banco = '" + recibo_de_dinero_id_banco + "', " + "id_moneda = '" + recibo_de_dinero_id_moneda + "', " + "concepto = '" + concepto + "', " + "cheque = '" + cheque + "', " + "fecha = '" + util_Date_to_sql_date(fecha) + "', " + "cantidad = '" + Long.parseLong(dinero.replace(".", "")) + "' " + "WHERE id_recibo = '" + id_recibo + "' "); st2.executeUpdate(); JOptionPane.showMessageDialog(null, "Actualizado correctamente."); } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Recepcion_imprimir(String precio) { try { Conexion.Verificar_conexion(); int duenho = 0; Statement ST_Recepcion22 = conexion.createStatement(); ResultSet RS_Recepcion22 = ST_Recepcion22.executeQuery("select * from cliente where duenho = '1'"); while (RS_Recepcion22.next()) { duenho = RS_Recepcion22.getInt("id_cliente"); } if (isNumeric(precio)) { } else { precio = "0"; } long precio_long = Long.parseLong(precio); String reporte = ""; if (precio_long > 0) { reporte = "liquidacion_lovera"; } else { reporte = "compra_lovera"; } if (duenho == id_cliente) { reporte = "recepcion_lovera"; } long descuento = 0; int id_movimiento = 0; Statement ST_Recepcion2 = conexion.createStatement(); ResultSet RS_Recepcion2 = ST_Recepcion2.executeQuery("select * from recepcion where id_recepcion='" + id_recepcion + "'"); while (RS_Recepcion2.next()) { id_movimiento = RS_Recepcion2.getInt("movimiento"); descuento = RS_Recepcion2.getLong("humedad_descuento_kg") + RS_Recepcion2.getLong("impurezas_descuento_kg") + RS_Recepcion2.getLong("quebrados_descuento_kg") + RS_Recepcion2.getLong("ardidos_descuento_kg"); } PreparedStatement st2 = conexion.prepareStatement("UPDATE recepcion SET print='0' WHERE print='1' "); st2.executeUpdate(); PreparedStatement st = conexion.prepareStatement("UPDATE recepcion SET print='1' WHERE id_recepcion='" + id_recepcion + "'"); st.executeUpdate(); String dir = ""; if (id_movimiento == 2) { dir = "remision_lovera"; // establecimiento san esteban } if (id_movimiento == 1) { // dir = "recepcion_lovera"; // establecimiento san esteban // dir = "recepcion_agrosem"; // establecimiento don esteban dir = reporte; // establecimiento san esteban } Map parametros = new HashMap(); if (id_moneda == 1) { parametros.put("kilo", "Kilo"); } if (id_moneda == 2) { parametros.put("kilo", "Tonelada"); } String venta = ""; String exportacion = ""; String compra = ""; String importacion = ""; String consignacion = ""; String devolucion = ""; String traslado = ""; String transformacion = ""; String reparacion = ""; String emisor_movil = ""; String exhibicion = ""; String ferias = ""; if (recepcion_id_motivo == 2) { venta = "X"; } if (recepcion_id_motivo == 3) { exportacion = "X"; } if (recepcion_id_motivo == 4) { // venta compra = "X"; } if (recepcion_id_motivo == 5) { // venta importacion = "X"; } if (recepcion_id_motivo == 6) { // venta consignacion = "X"; } if (recepcion_id_motivo == 7) { // venta devolucion = "X"; } if (recepcion_id_motivo == 8) { // venta traslado = "X"; } if (recepcion_id_motivo == 9) { // venta transformacion = "X"; } if (recepcion_id_motivo == 10) { // venta reparacion = "X"; } if (recepcion_id_motivo == 11) { // venta emisor_movil = "X"; } if (recepcion_id_motivo == 12) { // venta exhibicion = "X"; } if (recepcion_id_motivo == 13) { // venta ferias = "X"; } String detalle = path + "liquidacion_detalle."; parametros.put("venta", venta); parametros.put("exportacion", exportacion); parametros.put("compra", compra); parametros.put("importacion", importacion); parametros.put("consignacion", consignacion); parametros.put("devolucion", devolucion); parametros.put("traslado", traslado); parametros.put("transformacion", transformacion); parametros.put("reparacion", reparacion); parametros.put("emisor_movil", emisor_movil); parametros.put("exhibicion", exhibicion); parametros.put("ferias", ferias); parametros.put("descuento", descuento); parametros.put("direccion", detalle); Conexion.Verificar_conexion(); String reporte_dir = path + dir + ".jasper"; System.err.println(reporte_dir); JasperReport jr = (JasperReport) JRLoader.loadObjectFromFile(reporte_dir); JasperPrint jp = JasperFillManager.fillReport(jr, parametros, conexion); JasperViewer jv = new JasperViewer(jp, false); jv.setVisible(true); } catch (JRException | SQLException ex) { MostrarError(ex, getNombreMetodo()); } } // public synchronized static void Listado_Recepcion_imprimir() { // // try { // String reporte_dir = path + "recepcion_listado_dia.jasper"; // Stock_de_granos2(); // // Map parametros = new HashMap(); // parametros.put("desde", Listado_recepciones.jDateChooser_desde.getDate()); // parametros.put("hasta", Listado_recepciones.jDateChooser_hasta.getDate()); // parametros.put("total", cant); // parametros.put("total_sin_descuento", total_sin_descuento); // parametros.put("id_sucursal", id_sucursal_selected); // JasperReport jr = (JasperReport) JRLoader.loadObjectFromFile(reporte_dir); // JasperPrint jp = JasperFillManager.fillReport(jr, parametros, conexion); // JasperViewer jv = new JasperViewer(jp, false); // jv.setVisible(true); // // } catch (JRException ex) { // MostrarError(ex, getNombreMetodo()); // } // } public synchronized static void Uso_de_productos_listado_imprimir(Date desde, Date hasta) { try { boolean entro = false; String parcela = ""; DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); String desde_str = df.format(desde); String hasta_str = df.format(hasta); PreparedStatement stClienteBorrar = conexion.prepareStatement("" + "DELETE from imprimir "); stClienteBorrar.executeUpdate(); Statement ST_Productos = conexion.createStatement(); String sql = "" + "select *, producto_aplicacion_detalle.precio as precio_app from producto_aplicacion " + "inner join parcela on parcela.id_parcela = producto_aplicacion.id_parcela " + "inner join granos_tipo on granos_tipo.id_granos_tipo = producto_aplicacion.id_granos_tipo " + "inner join zafra on zafra.id_zafra= producto_aplicacion.id_zafra " + "inner join producto_aplicacion_detalle on producto_aplicacion_detalle.id_producto_aplicacion = producto_aplicacion.id_producto_aplicacion " + "inner join productos on productos.id_producto = producto_aplicacion_detalle.id_producto " + "where fecha >= '" + desde_str + "' and fecha <= '" + hasta_str + "' " + "and producto_aplicacion.id_parcela = '" + uso_de_productos_listado_id_parcela + "' " + "and producto_aplicacion.id_zafra = '" + uso_de_productos_listado_id_zafra + "' " + "and producto_aplicacion.id_granos_tipo = '" + uso_de_productos_listado_id_cultivo + "' " + "and tipo_aplicacion = '2' " + "order by fecha, aplicacion, parcela, granos_tipo"; // System.err.println(sql); id = 1; double total = 0; ResultSet RS_Productos = ST_Productos.executeQuery(sql); while (RS_Productos.next()) { entro = true; parcela = RS_Productos.getString("parcela"); PreparedStatement st3 = conexion.prepareStatement("INSERT INTO imprimir VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); st3.setInt(1, id); st3.setString(2, parcela); st3.setString(3, RS_Productos.getString("zafra")); st3.setString(4, RS_Productos.getString("nombre")); st3.setString(5, RS_Productos.getString("tipo")); st3.setString(6, RS_Productos.getString("tipo_aplicacion")); st3.setDouble(7, RS_Productos.getDouble("dosis")); st3.setDouble(8, RS_Productos.getDouble("hectareas")); st3.setDouble(9, RS_Productos.getDouble("total")); st3.setDouble(10, RS_Productos.getDouble("hectareas") * RS_Productos.getDouble("precio_app") * RS_Productos.getDouble("dosis")); st3.setInt(11, 0); st3.setDouble(12, 0); st3.setDate(13, RS_Productos.getDate("fecha")); if (RS_Productos.getInt("aplicacion") > 0) { st3.setString(14, RS_Productos.getString("aplicacion")); } else { st3.setString(14, " "); } st3.executeUpdate(); id = id + 1; total = total + RS_Productos.getDouble("hectareas") * RS_Productos.getDouble("precio_app") * RS_Productos.getDouble("dosis"); } if (entro == true) { PreparedStatement st3 = conexion.prepareStatement("INSERT INTO imprimir VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?)"); st3.setInt(1, id); st3.setString(2, parcela); st3.setString(3, " "); st3.setString(4, " --------- COSTOS DE LA SIEMBRA "); st3.setString(5, " "); st3.setString(6, " "); st3.setDouble(7, 0); st3.setDouble(8, 0); st3.setDouble(9, 0); st3.setDouble(10, total); st3.setInt(11, 0); st3.setInt(12, 0); st3.setDate(13, null); st3.executeUpdate(); } entro = false; sql = "" + "select *, producto_aplicacion_detalle.precio as precio_app from producto_aplicacion " + "inner join parcela on parcela.id_parcela = producto_aplicacion.id_parcela " + "inner join granos_tipo on granos_tipo.id_granos_tipo = producto_aplicacion.id_granos_tipo " + "inner join zafra on zafra.id_zafra= producto_aplicacion.id_zafra " + "inner join producto_aplicacion_detalle on producto_aplicacion_detalle.id_producto_aplicacion = producto_aplicacion.id_producto_aplicacion " + "inner join productos on productos.id_producto = producto_aplicacion_detalle.id_producto " + "where fecha >= '" + desde_str + "' and fecha <= '" + hasta_str + "' " + "and producto_aplicacion.id_parcela = '" + uso_de_productos_listado_id_parcela + "' " + "and producto_aplicacion.id_zafra = '" + uso_de_productos_listado_id_zafra + "' " + "and producto_aplicacion.id_granos_tipo = '" + uso_de_productos_listado_id_cultivo + "' " + "and tipo_aplicacion = '1' " + "order by fecha, aplicacion, parcela, granos_tipo"; int app = 0; int app_ant = 0; total = 0; int id2 = id; RS_Productos = ST_Productos.executeQuery(sql); while (RS_Productos.next()) { entro = true; if (id == id2) { app = RS_Productos.getInt("aplicacion"); app_ant = RS_Productos.getInt("aplicacion"); } id = id + 1; app = RS_Productos.getInt("aplicacion"); parcela = RS_Productos.getString("parcela"); if ((app_ant != app)) { PreparedStatement st3 = conexion.prepareStatement("INSERT INTO imprimir VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?)"); st3.setInt(1, id); st3.setString(2, parcela); st3.setString(3, " "); st3.setString(4, " --------- COSTOS DE LA APLICACION "); st3.setString(5, " "); st3.setString(6, " "); st3.setDouble(7, 0); st3.setDouble(8, 0); st3.setDouble(9, 0); st3.setDouble(10, total); st3.setInt(11, 0); st3.setInt(12, 0); st3.setDate(13, null); st3.executeUpdate(); id = id + 1; total = 0; } app_ant = RS_Productos.getInt("aplicacion"); PreparedStatement st3 = conexion.prepareStatement("INSERT INTO imprimir VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); st3.setInt(1, id); st3.setString(2, parcela); st3.setString(3, RS_Productos.getString("zafra")); st3.setString(4, RS_Productos.getString("nombre")); st3.setString(5, RS_Productos.getString("tipo")); st3.setString(6, RS_Productos.getString("tipo_aplicacion")); st3.setDouble(7, RS_Productos.getDouble("dosis")); st3.setDouble(8, RS_Productos.getDouble("hectareas")); st3.setDouble(9, RS_Productos.getDouble("total")); st3.setDouble(10, RS_Productos.getDouble("hectareas") * RS_Productos.getDouble("precio_app") * RS_Productos.getDouble("dosis")); st3.setInt(11, RS_Productos.getInt("aplicacion")); st3.setDouble(12, 0); st3.setDate(13, RS_Productos.getDate("fecha")); if (RS_Productos.getInt("aplicacion") > 0) { st3.setString(14, RS_Productos.getString("aplicacion")); } else { st3.setString(14, " "); } st3.executeUpdate(); total = total + RS_Productos.getDouble("hectareas") * RS_Productos.getDouble("precio_app") * RS_Productos.getDouble("dosis"); id = id + 1; } if (entro == true) { PreparedStatement st3 = conexion.prepareStatement("INSERT INTO imprimir VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?)"); st3.setInt(1, id); st3.setString(2, parcela); st3.setString(3, " "); st3.setString(4, " --------- COSTOS DE LA APLICACION "); st3.setString(5, " "); st3.setString(6, " "); st3.setDouble(7, 0); st3.setDouble(8, 0); st3.setDouble(9, 0); st3.setDouble(10, total); st3.setInt(11, 0); st3.setInt(12, 0); st3.setDate(13, null); st3.executeUpdate(); } Map parametros = new HashMap(); String reporte_dir = path + "aplicacion_de_productos.jasper"; // if (uso_de_productos_listado_id_parcela != 0) { // reporte_dir = path + "aplicacion_productos_parcela.jasper"; // parametros.put("id_parcela", uso_de_productos_listado_id_parcela); // } // if ((uso_de_productos_listado_id_parcela != 0) && (uso_de_productos_listado_id_zafra != 0)) { // reporte_dir = path + "aplicacion_productos_parcela_zafra.jasper"; // parametros.put("id_parcela", uso_de_productos_listado_id_parcela); // parametros.put("id_zafra", uso_de_productos_listado_id_zafra); // } // if ((uso_de_productos_listado_id_parcela != 0) // && (uso_de_productos_listado_id_zafra != 0) // && (uso_de_productos_listado_id_cultivo != 0)) { // reporte_dir = path + "aplicacion_productos_parcela_zafra_cultivo.jasper"; // parametros.put("id_parcela", uso_de_productos_listado_id_parcela); // parametros.put("id_zafra", uso_de_productos_listado_id_zafra); // parametros.put("id_cultivo", uso_de_productos_listado_id_cultivo); // } total = 0; ST_Productos = conexion.createStatement(); RS_Productos = ST_Productos.executeQuery("" + "select *, producto_aplicacion_detalle.precio as precio_app from producto_aplicacion " + "inner join parcela on parcela.id_parcela = producto_aplicacion.id_parcela " + "inner join granos_tipo on granos_tipo.id_granos_tipo = producto_aplicacion.id_granos_tipo " + "inner join zafra on zafra.id_zafra= producto_aplicacion.id_zafra " + "inner join producto_aplicacion_detalle on producto_aplicacion_detalle.id_producto_aplicacion = producto_aplicacion.id_producto_aplicacion " + "inner join productos on productos.id_producto = producto_aplicacion_detalle.id_producto " + "where fecha >= '" + desde_str + "' and fecha <= '" + hasta_str + "' " + "and producto_aplicacion.id_parcela = '" + uso_de_productos_listado_id_parcela + "' " + "and producto_aplicacion.id_zafra = '" + uso_de_productos_listado_id_zafra + "' " + "and producto_aplicacion.id_granos_tipo = '" + uso_de_productos_listado_id_cultivo + "' "); while (RS_Productos.next()) { total = total + RS_Productos.getDouble("hectareas") * RS_Productos.getDouble("precio_app") * RS_Productos.getDouble("dosis"); } parametros.put("desde", desde); parametros.put("hasta", hasta); parametros.put("total", total); JasperReport jr = (JasperReport) JRLoader.loadObjectFromFile(reporte_dir); JasperPrint jp = JasperFillManager.fillReport(jr, parametros, conexion); JasperViewer jv = new JasperViewer(jp, false); jv.setVisible(true); } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } catch (JRException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Stock_de_productos() { try { String reporte_dir = path + "stock.jasper"; Statement st = conexion.createStatement(); st.executeUpdate("truncate table listados"); int compras = 0; int ventas = 0; int stock = 0; Statement ST_Productos = conexion.createStatement(); ResultSet RS_Productos = ST_Productos.executeQuery("select * from productos order by nombre"); while (RS_Productos.next()) { Statement st_compras = conexion.createStatement(); ResultSet rs_compras = st_compras.executeQuery("" + "SELECT SUM(unidades) " + "FROM facturas_compra_detalle " + "where id_producto = '" + RS_Productos.getInt("id_producto") + "'"); if (rs_compras.next()) { compras = rs_compras.getInt(1); } Statement st_ventas = conexion.createStatement(); ResultSet rs_ventas = st_ventas.executeQuery("" + "SELECT SUM(unidad) " + "FROM venta_detalle " + "where id_producto = '" + RS_Productos.getInt("id_producto") + "'"); if (rs_ventas.next()) { ventas = rs_ventas.getInt(1); } Statement st_max = conexion.createStatement(); ResultSet rs_max = st_max.executeQuery("SELECT MAX(id) FROM listados"); if (rs_max.next()) { id = rs_max.getInt(1) + 1; } stock = compras - ventas; PreparedStatement st3 = conexion.prepareStatement("INSERT INTO listados VALUES(?,?,?)"); st3.setInt(1, id); st3.setString(2, RS_Productos.getString("nombre").toUpperCase()); st3.setInt(3, stock); st3.executeUpdate(); compras = 0; ventas = 0; stock = 0; } Map parametros = new HashMap(); JasperReport jr = (JasperReport) JRLoader.loadObjectFromFile(reporte_dir); JasperPrint jp = JasperFillManager.fillReport(jr, parametros, conexion); JasperViewer jv = new JasperViewer(jp, false); jv.setVisible(true); } catch (JRException | SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Ventas_listado_imprimir(Date desde, Date hasta) { try { float total_gs = 0; float total_usd = 0; Statement ST_Recepcion2 = conexion.createStatement(); ResultSet RS_Recepcion2 = ST_Recepcion2.executeQuery("select SUM(total) from venta where id_moneda ='1' and fecha >= '" + desde + "' and fecha <= '" + hasta + "' "); while (RS_Recepcion2.next()) { total_gs = RS_Recepcion2.getFloat(1); } RS_Recepcion2 = ST_Recepcion2.executeQuery("select SUM(total) from venta where id_moneda ='2' and fecha >= '" + desde + "' and fecha <= '" + hasta + "' "); while (RS_Recepcion2.next()) { total_usd = RS_Recepcion2.getFloat(1); } String reporte_dir = path + "ventas_listado_dia.jasper"; Map parametros = new HashMap(); parametros.put("desde", desde); parametros.put("hasta", hasta); parametros.put("total_gs", total_gs); parametros.put("total_usd", total_usd); JasperReport jr = (JasperReport) JRLoader.loadObjectFromFile(reporte_dir); JasperPrint jp = JasperFillManager.fillReport(jr, parametros, conexion); JasperViewer jv = new JasperViewer(jp, false); jv.setVisible(true); } catch (JRException | SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Compras_listado_imprimir(Date desde, Date hasta) { try { float total_gs = 0; float total_usd = 0; // Statement ST_Recepcion2 = conexion.createStatement(); // ResultSet RS_Recepcion2 = ST_Recepcion2.executeQuery("" // + "select SUM(total) " // + "from compras where id_moneda ='1' " // + "and fecha >= '" + desde + "' and fecha <= '" + hasta + "' "); // while (RS_Recepcion2.next()) { // total_gs = RS_Recepcion2.getFloat(1); // } // // RS_Recepcion2 = ST_Recepcion2.executeQuery("select SUM(total) from venta where id_moneda ='2' and fecha >= '" + desde + "' and fecha <= '" + hasta + "' "); // while (RS_Recepcion2.next()) { // total_usd = RS_Recepcion2.getFloat(1); // } String reporte_dir = path + "compras_listado_dia.jasper"; Map parametros = new HashMap(); parametros.put("desde", desde); parametros.put("hasta", hasta); // parametros.put("total_gs", total_gs); // parametros.put("total_usd", total_usd); JasperReport jr = (JasperReport) JRLoader.loadObjectFromFile(reporte_dir); JasperPrint jp = JasperFillManager.fillReport(jr, parametros, conexion); JasperViewer jv = new JasperViewer(jp, false); jv.setVisible(true); } catch (JRException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Liquidaciones_multiples_imprimir() { try { String reporte_dir = path + "liquidaciones_multiples.jasper"; Map parametros = new HashMap(); parametros.put("direccion", path + "\\liquidaciones_multiples_detalle."); Metodos.imagen = ubicacion_reportes + "\\reportes\\logo.jpg"; if (ismac == true) { Metodos.imagen = ubicacion_reportes + "//reportes//logo.jpg"; } parametros.put("imagen", imagen); JasperReport jr = (JasperReport) JRLoader.loadObjectFromFile(reporte_dir); JasperPrint jp = JasperFillManager.fillReport(jr, parametros, conexion); JasperViewer jv = new JasperViewer(jp, false); jv.setVisible(true); } catch (JRException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Venta_imprimir_pagare() { try { String reporte_dir = path + "pagare.jasper"; Map parametros = new HashMap(); parametros.put("id_pagare", id_pagare); JasperReport jr = (JasperReport) JRLoader.loadObjectFromFile(reporte_dir); JasperPrint jp = JasperFillManager.fillReport(jr, parametros, conexion); JasperViewer jv = new JasperViewer(jp, false); jv.setVisible(true); } catch (JRException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Recibo_imprimir() { try { long total = 0; Statement ST_Recepcion2 = conexion.createStatement(); ResultSet RS_Recepcion2 = ST_Recepcion2.executeQuery("select * from recibo where id_recibo='" + id_recibo + "'"); while (RS_Recepcion2.next()) { total = RS_Recepcion2.getLong("cantidad"); } String reporte_dir = path + "recibo.jasper"; Map parametros = new HashMap(); parametros.put("id_recibo", id_recibo); parametros.put("cantidad_string", Numero_a_String(total)); JasperReport jr = (JasperReport) JRLoader.loadObjectFromFile(reporte_dir); JasperPrint jp = JasperFillManager.fillReport(jr, parametros, conexion); JasperViewer jv = new JasperViewer(jp, false); jv.setVisible(true); } catch (JRException ex) { MostrarError(ex, getNombreMetodo()); } catch (SQLException | ClassNotFoundException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Sueldos_imprimir() { try { String reporte_dir = path + "sueldos.jasper"; Map parametros = new HashMap(); parametros.put("id_sueldo", id_sueldo); parametros.put("empresa", empresa); parametros.put("empresa_datos", empresa_datos); parametros.put("imagen", imagen); JasperReport jr = (JasperReport) JRLoader.loadObjectFromFile(reporte_dir); JasperPrint jp = JasperFillManager.fillReport(jr, parametros, conexion); JasperViewer jv = new JasperViewer(jp, false); jv.setVisible(true); } catch (JRException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Listado_Movimientos_remitente_imprimir(Date desde, Date hasta) { try { Map parametros = new HashMap(); parametros.put("desde", desde); parametros.put("hasta", hasta); parametros.put("id_remitente", listado_id_remitente); JasperReport jr = (JasperReport) JRLoader.loadObjectFromFile(ubicacion_reportes + "recepcion_listado_remitente.jasper"); JasperPrint jp = JasperFillManager.fillReport(jr, parametros, conexion); JasperViewer jv = new JasperViewer(jp, false); jv.setVisible(true); } catch (JRException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void combustible_venta_imprimir() { try { String reporte_dir = path + "combustibles.jasper"; Map parametros = new HashMap(); parametros.put("id_combustible_venta", id_combustible_venta); JasperReport jr = (JasperReport) JRLoader.loadObjectFromFile(reporte_dir); JasperPrint jp = JasperFillManager.fillReport(jr, parametros, conexion); JasperViewer jv = new JasperViewer(jp, false); jv.setVisible(true); } catch (JRException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Contratos_imprimir() { try { String reporte_dir = path + "contratos.jasper"; // Stock_de_granos2(); Map parametros = new HashMap(); // parametros.put("desde", Listado_recepciones.jDateChooser_desde.getDate()); // parametros.put("hasta", Listado_recepciones.jDateChooser_hasta.getDate()); // parametros.put("total", cant); parametros.put("imagen", imagen); JasperReport jr = (JasperReport) JRLoader.loadObjectFromFile(reporte_dir); JasperPrint jp = JasperFillManager.fillReport(jr, parametros, conexion); JasperViewer jv = new JasperViewer(jp, false); jv.setVisible(true); } catch (JRException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Tickets_imprimir() { try { String reporte_dir = path + "tickets.jasper"; Map parametros = new HashMap(); parametros.put("id_recepcion", id_ticket); JasperReport jr = (JasperReport) JRLoader.loadObjectFromFile(reporte_dir); JasperPrint jp = JasperFillManager.fillReport(jr, parametros, conexion); JasperViewer jv = new JasperViewer(jp, false); jv.setVisible(true); } catch (JRException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Listado_Combustible_imprimir(Date desde, Date hasta) { try { String reporte_dir = path + "combustibles_listado.jasper"; Map parametros = new HashMap(); parametros.put("desde", desde); parametros.put("hasta", hasta); parametros.put("imagen", imagen); JasperReport jr = (JasperReport) JRLoader.loadObjectFromFile(reporte_dir); JasperPrint jp = JasperFillManager.fillReport(jr, parametros, conexion); JasperViewer jv = new JasperViewer(jp, false); jv.setVisible(true); } catch (JRException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Listado_Movimientos_pendientes_imprimir(Date desde, Date hasta) { try { int id_duenho = 0; Statement ST_Recepcion2 = conexion.createStatement(); ResultSet RS_Recepcion2 = ST_Recepcion2.executeQuery("select * from cliente where duenho = '1'"); while (RS_Recepcion2.next()) { id_duenho = RS_Recepcion2.getInt("id_cliente"); } String reporte = "listado_movimientos_pendientes.jasper"; if (listado_recepcion_pendiente_id_cliente == 0) { reporte = "listado_movimientos_pendientes_all.jasper"; } Map parametros = new HashMap(); parametros.put("id_cliente", listado_recepcion_pendiente_id_cliente); parametros.put("id_duenho", id_duenho); parametros.put("desde", desde); parametros.put("hasta", hasta); String reporte_dir = path + reporte; JasperReport jr = (JasperReport) JRLoader.loadObjectFromFile(reporte_dir); JasperPrint jp = JasperFillManager.fillReport(jr, parametros, conexion); JasperViewer jv = new JasperViewer(jp, false); jv.setVisible(true); } catch (JRException ex) { MostrarError(ex, getNombreMetodo()); } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Listado_Movimientos_liquidados_imprimir(Date desde, Date hasta) { try { Statement ST_Recepcion2 = conexion.createStatement(); ResultSet RS_Recepcion2 = ST_Recepcion2.executeQuery("select * from cliente where duenho = '1'"); while (RS_Recepcion2.next()) { id_cliente = RS_Recepcion2.getInt("id_cliente"); } Map parametros = new HashMap(); parametros.put("id_cliente", id_cliente); parametros.put("desde", desde); parametros.put("hasta", hasta); String reporte_dir = path + "listado_movimientos_liquidados.jasper"; JasperReport jr = (JasperReport) JRLoader.loadObjectFromFile(reporte_dir); JasperPrint jp = JasperFillManager.fillReport(jr, parametros, conexion); JasperViewer jv = new JasperViewer(jp, false); jv.setVisible(true); } catch (JRException ex) { MostrarError(ex, getNombreMetodo()); } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Productos_uso_imprimir() { try { Map parametros = new HashMap(); String reporte_dir = path + "productos_uso.jasper"; JasperReport jr = (JasperReport) JRLoader.loadObjectFromFile(reporte_dir); JasperPrint jp = JasperFillManager.fillReport(jr, parametros, conexion); JasperViewer jv = new JasperViewer(jp, false); jv.setVisible(true); } catch (JRException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Listado_Movimientos_parcela_imprimir(String parcela, Date desde, Date hasta) { try { long neto = 0; long neto_sin_descuento = 0; Statement ST_Recepcion2 = conexion.createStatement(); ResultSet RS_Recepcion2 = ST_Recepcion2.executeQuery("" + "SELECT sum(total_neto_carga) " + "FROM recepcion " + "INNER JOIN cliente " + "ON recepcion.id_cliente = cliente.id_cliente " + "inner join granos_tipo " + "on recepcion.id_granos_tipo = granos_tipo.id_granos_tipo " + " where fecha >= '" + desde + "' " + " and fecha <= '" + hasta + "' " + "and recepcion.borrado_int != '1' " + "and id_parcela = '" + id_parcela + "' " + "and movimiento = '1' "); while (RS_Recepcion2.next()) { neto = RS_Recepcion2.getInt(1); } Statement ST_Recepcion25 = conexion.createStatement(); ResultSet RS_Recepcion25 = ST_Recepcion25.executeQuery("" + "SELECT sum(peso_neto) " + "FROM recepcion " + "INNER JOIN cliente " + "ON recepcion.id_cliente = cliente.id_cliente " + "inner join granos_tipo " + "on recepcion.id_granos_tipo = granos_tipo.id_granos_tipo " + " where fecha >= '" + desde + "' " + " and fecha <= '" + hasta + "' " + "and recepcion.borrado_int != '1' " + "and id_parcela = '" + id_parcela + "' " + "and movimiento = '1' "); while (RS_Recepcion25.next()) { neto_sin_descuento = RS_Recepcion25.getInt(1); } Statement ST_Recepcion21 = conexion.createStatement(); ResultSet RS_Recepcion21 = ST_Recepcion21.executeQuery("" + "SELECT sum(total_neto_carga) " + "FROM recepcion " + "INNER JOIN cliente " + "ON recepcion.id_cliente = cliente.id_cliente " + "inner join granos_tipo " + "on recepcion.id_granos_tipo = granos_tipo.id_granos_tipo " + " where fecha >= '" + desde + "' " + " and fecha <= '" + hasta + "' " + "and recepcion.borrado_int != '1' " + "and id_parcela = '" + id_parcela + "' " + "and movimiento = '2' "); while (RS_Recepcion21.next()) { neto = neto - RS_Recepcion21.getInt(1); } Statement ST_Recepcion216 = conexion.createStatement(); ResultSet RS_Recepcion216 = ST_Recepcion216.executeQuery("" + "SELECT sum(peso_neto) " + "FROM recepcion " + "INNER JOIN cliente " + "ON recepcion.id_cliente = cliente.id_cliente " + "inner join granos_tipo " + "on recepcion.id_granos_tipo = granos_tipo.id_granos_tipo " + " where fecha >= '" + desde + "' " + " and fecha <= '" + hasta + "' " + "and recepcion.borrado_int != '1' " + "and id_parcela = '" + id_parcela + "' " + "and movimiento = '2' "); while (RS_Recepcion216.next()) { neto_sin_descuento = neto_sin_descuento - RS_Recepcion216.getInt(1); } Map parametros = new HashMap(); parametros.put("desde", desde); parametros.put("hasta", hasta); parametros.put("id_parcela", id_parcela); parametros.put("parcela", parcela); parametros.put("neto", neto); parametros.put("neto_sin_descuento", neto_sin_descuento); parametros.put("imagen", imagen); String reporte_dir = path + "listado_movimientos_por_parcela.jasper"; JasperReport jr = (JasperReport) JRLoader.loadObjectFromFile(reporte_dir); JasperPrint jp = JasperFillManager.fillReport(jr, parametros, conexion); JasperViewer jv = new JasperViewer(jp, false); jv.setVisible(true); } catch (JRException ex) { MostrarError(ex, getNombreMetodo()); } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Listado_Movimientos_cliente_imprimir(String parcela, Date desde, Date hasta) { try { long neto = 0; Statement ST_Recepcion2 = conexion.createStatement(); ResultSet RS_Recepcion2 = ST_Recepcion2.executeQuery("" + "SELECT sum(total_neto_carga) " + "FROM recepcion " + "INNER JOIN cliente " + "ON recepcion.id_cliente = cliente.id_cliente " + "inner join granos_tipo " + "on recepcion.id_granos_tipo = granos_tipo.id_granos_tipo " + " where fecha >= '" + desde + "' " + " and fecha <= '" + hasta + "' " + "and recepcion.borrado_int != '1' " + "and recepcion.id_cliente = '" + id_cliente + "' " + "and movimiento = '1' "); while (RS_Recepcion2.next()) { neto = RS_Recepcion2.getInt(1); } Statement ST_Recepcion21 = conexion.createStatement(); ResultSet RS_Recepcion21 = ST_Recepcion21.executeQuery("" + "SELECT sum(total_neto_carga) " + "FROM recepcion " + "INNER JOIN cliente " + "ON recepcion.id_cliente = cliente.id_cliente " + "inner join granos_tipo " + "on recepcion.id_granos_tipo = granos_tipo.id_granos_tipo " + " where fecha >= '" + desde + "' " + " and fecha <= '" + hasta + "' " + "and recepcion.borrado_int != '1' " + "and recepcion.id_cliente = '" + id_cliente + "' " + "and movimiento = '2' "); while (RS_Recepcion21.next()) { neto = neto - RS_Recepcion21.getInt(1); } Map parametros = new HashMap(); String reporte_dir = path + "listado_movimientos_por_cliente.jasper"; parametros.put("desde", desde); parametros.put("hasta", hasta); parametros.put("id_cliente", id_cliente); parametros.put("neto", neto); parametros.put("imagen", imagen); JasperReport jr = (JasperReport) JRLoader.loadObjectFromFile(reporte_dir); JasperPrint jp = JasperFillManager.fillReport(jr, parametros, conexion); JasperViewer jv = new JasperViewer(jp, false); jv.setVisible(true); } catch (JRException ex) { MostrarError(ex, getNombreMetodo()); } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Listado_Movimientos_usuario_imprimir(String parcela, Date desde, Date hasta) { try { long neto = 0; Statement ST_Recepcion2 = conexion.createStatement(); ResultSet RS_Recepcion2 = ST_Recepcion2.executeQuery("" + "SELECT sum(total_neto_carga) " + "FROM recepcion " + "INNER JOIN cliente " + "ON recepcion.id_cliente = cliente.id_cliente " + "inner join granos_tipo " + "on recepcion.id_granos_tipo = granos_tipo.id_granos_tipo " + " where fecha >= '" + desde + "' " + " and fecha <= '" + hasta + "' " + "and recepcion.borrado_int != '1' " + "and recepcion.id_usuario = '" + id_usuario_buscar + "' " + "and movimiento = '1' "); while (RS_Recepcion2.next()) { neto = RS_Recepcion2.getInt(1); } Statement ST_Recepcion21 = conexion.createStatement(); ResultSet RS_Recepcion21 = ST_Recepcion21.executeQuery("" + "SELECT sum(total_neto_carga) " + "FROM recepcion " + "INNER JOIN cliente " + "ON recepcion.id_cliente = cliente.id_cliente " + "inner join granos_tipo " + "on recepcion.id_granos_tipo = granos_tipo.id_granos_tipo " + " where fecha >= '" + desde + "' " + " and fecha <= '" + hasta + "' " + "and recepcion.borrado_int != '1' " + "and recepcion.id_usuario = '" + id_usuario_buscar + "' " + "and movimiento = '2' "); while (RS_Recepcion21.next()) { neto = neto - RS_Recepcion21.getInt(1); } Map parametros = new HashMap(); parametros.put("desde", desde); parametros.put("hasta", hasta); parametros.put("id_usuario", id_usuario_buscar); parametros.put("neto", neto); String reporte_dir = path + "listado_movimientos_por_usuario.jasper"; JasperReport jr = (JasperReport) JRLoader.loadObjectFromFile(reporte_dir); JasperPrint jp = JasperFillManager.fillReport(jr, parametros, conexion); JasperViewer jv = new JasperViewer(jp, false); jv.setVisible(true); } catch (JRException | SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Listado_Movimientos_conductor_imprimir(String parcela, Date desde, Date hasta) { try { long neto = 0; Statement ST_Recepcion2 = conexion.createStatement(); ResultSet RS_Recepcion2 = ST_Recepcion2.executeQuery("" + "SELECT *, chofer.nombre as chonombre " + "FROM recepcion " + "INNER JOIN cliente " + "ON recepcion.id_cliente = cliente.id_cliente " + "INNER JOIN parcela " + "ON recepcion.id_parcela = parcela.id_parcela " + "INNER JOIN chofer " + "ON recepcion.id_chofer = chofer.id_chofer " + "inner join granos_tipo " + "on recepcion.id_granos_tipo = granos_tipo.id_granos_tipo " + " where fecha >= '" + desde + "' " + " and fecha <= '" + hasta + "' " + "and recepcion.borrado_int != '1' " + "and recepcion.id_chofer = '" + id_chofer + "'"); while (RS_Recepcion2.next()) { neto = neto + (RS_Recepcion2.getLong("peso_neto") * RS_Recepcion2.getLong("precio_del_flete") * RS_Recepcion2.getLong("porcentaje")) / 100; } Map parametros = new HashMap(); parametros.put("desde", desde); parametros.put("hasta", hasta); parametros.put("id_chofer", id_chofer); parametros.put("neto", neto); String reporte_dir = path + "listado_movimientos_por_conductor.jasper"; JasperReport jr = (JasperReport) JRLoader.loadObjectFromFile(reporte_dir); JasperPrint jp = JasperFillManager.fillReport(jr, parametros, conexion); JasperViewer jv = new JasperViewer(jp, false); jv.setVisible(true); } catch (JRException ex) { MostrarError(ex, getNombreMetodo()); } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } // // public static void Transportista_clear() { // id_transportista = 0; // Transportista_ABM.jTextField_ci.setText("0"); // Transportista_ABM.jTextField_ruc.setText(""); // Transportista_ABM.jTextField_telefono.setText(""); // Transportista_ABM.jTextField_direccion.setText(""); // Transportista_ABM.jTextField_nombre.setText(""); // } // // public static void Cliente_clear() { // id_cliente = 0; // Cliente.jTextField_nombre.setText(""); // Cliente.jTextField_direccion.setText(""); // Cliente.jTextField_ruc.setText(""); // Cliente.jTextField_telefono.setText(""); // Cliente.jTextField_nombre.requestFocus(); // } // // public static void Chofer_clear() { // id_chofer_nuevo = 0; // Conductor_ABM.jTextField_nombre.setText(""); // Conductor_ABM.jTextField_direccion.setText(""); // Conductor_ABM.jTextField_ci.setText(""); // Conductor_ABM.jTextField_telefono.setText(""); // Conductor_ABM.jTextField_nombre.requestFocus(); // } // // public static void Carreta_clear() { // id_carreta = 0; // Carreta_ABM.jTextField_marca.setText(""); // Carreta_ABM.jTextField_anho.setText(""); // Carreta_ABM.jTextField_chapa.setText(""); // Carreta_ABM.jTextField_modelo.setText(""); // Carreta_ABM.jTextField_marca.requestFocus(); // } public synchronized static void Transportista_guardar( String nombre, String ci, String ruc, String direccion, String telefono) { try { if ((nombre == null) && (nombre.length() < 1)) { JOptionPane.showMessageDialog(null, "Ingresar el Nombre"); } else if (id_transportista == 0) { int id = 0; Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("SELECT MAX(id_transportista) FROM transportista"); if (result.next()) { id = result.getInt(1) + 1; } PreparedStatement stUpdateProducto = conexion.prepareStatement("" + "INSERT INTO transportista VALUES(?,?,?,?,?,?,?,?)"); stUpdateProducto.setInt(1, id); stUpdateProducto.setString(2, nombre); stUpdateProducto.setString(3, ruc); stUpdateProducto.setString(4, ci); stUpdateProducto.setString(5, telefono); stUpdateProducto.setString(6, direccion); stUpdateProducto.setString(7, "-"); stUpdateProducto.setInt(8, 0); stUpdateProducto.executeUpdate(); JOptionPane.showMessageDialog(null, "Guardado correctamente"); } else { PreparedStatement st = conexion.prepareStatement( " UPDATE trasnportista " + " SET nombre ='" + nombre + "'," + " direccion ='" + direccion + "'," + " telefono ='" + telefono + "'," + " ruc ='" + ruc + "'," + " ci ='" + ci + "' " + " WHERE id_trasportista = '" + id_transportista + "'"); st.executeUpdate(); JOptionPane.showMessageDialog(null, "Guardado correctamente"); } } catch (NumberFormatException | SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Combustibles_uso_guardar(Date fecha, String litros, String descripcion) { try { Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("SELECT MAX(id_combustible_uso) FROM combustible_uso"); if (result.next()) { id_combustible_uso = result.getInt(1) + 1; } if (litros.length() > 0) { PreparedStatement stUpdateProducto = conexion.prepareStatement("" + "INSERT INTO combustible_uso VALUES(?,?,?,?,?,?,?)"); stUpdateProducto.setInt(1, id_combustible_uso); stUpdateProducto.setDate(2, util_Date_to_sql_date(fecha)); stUpdateProducto.setInt(3, Integer.parseInt(litros)); stUpdateProducto.setString(4, descripcion); stUpdateProducto.setInt(5, combustibles_uso_id_vehiculo); stUpdateProducto.setInt(6, combustible_uso_id_personal); stUpdateProducto.setInt(7, id_sucursal); stUpdateProducto.executeUpdate(); // Combustibles_uso_clear(); } else { JOptionPane.showMessageDialog(null, "Ingresa un valor en litros."); } } catch (NumberFormatException | SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Combustibles_venta_guardar(Date fecha, String litros, String descripcion, String precio) { try { if (id_combustible_venta == 0) { Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("SELECT MAX(id_combustible_venta) FROM combustible_venta"); if (result.next()) { id_combustible_venta = result.getInt(1) + 1; } PreparedStatement stUpdateProducto = conexion.prepareStatement("" + "INSERT INTO combustible_venta VALUES(?,?,?,?,?,?,?,?)"); stUpdateProducto.setInt(1, id_combustible_venta); stUpdateProducto.setDate(2, util_Date_to_sql_date(fecha)); stUpdateProducto.setInt(3, Integer.parseInt(litros)); stUpdateProducto.setString(4, descripcion); stUpdateProducto.setInt(5, combustible_venta_id_cliente); stUpdateProducto.setInt(6, id_sucursal); stUpdateProducto.setLong(7, Long.parseLong(precio)); stUpdateProducto.setLong(8, (Long.parseLong(litros) * Long.parseLong((precio)))); stUpdateProducto.executeUpdate(); JOptionPane.showMessageDialog(null, "Guardado correctamente."); } else { PreparedStatement st = conexion.prepareStatement( " UPDATE combustible_venta " + " SET id_cliente ='" + combustible_venta_id_cliente + "', " + " precio ='" + Long.parseLong(precio) + "', " + " fecha ='" + util_Date_to_sql_date(fecha) + "', " + " litros ='" + Integer.parseInt(litros) + "', " + " descripcion ='" + descripcion + "', " + " total ='" + Long.parseLong(litros) * Long.parseLong(precio) + "' " + " WHERE id_combustible_venta = '" + id_combustible_venta + "'"); st.executeUpdate(); JOptionPane.showMessageDialog(null, "Guardado correctamente"); } } catch (NumberFormatException | SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Contrato_guardar(String contrato, String toneladas, String premio, Date fecha) { try { if (id_contrato == 0) { Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("SELECT MAX(id_contrato) FROM contrato"); if (result.next()) { id_contrato = result.getInt(1) + 1; } PreparedStatement stUpdateProducto = conexion.prepareStatement("" + "INSERT INTO contrato VALUES(?,?,?,?,?,?,?,?,?)"); stUpdateProducto.setInt(1, id_contrato); stUpdateProducto.setLong(2, Long.parseLong(premio)); stUpdateProducto.setInt(3, id_contrato); stUpdateProducto.setDate(4, util_Date_to_sql_date(fecha)); stUpdateProducto.setDouble(5, Double.valueOf(toneladas)); stUpdateProducto.setInt(6, contratos_id_zafra); stUpdateProducto.setInt(7, contratos_id_cliente); stUpdateProducto.setInt(8, 1); stUpdateProducto.setString(9, "ACTIVO"); stUpdateProducto.executeUpdate(); JOptionPane.showMessageDialog(null, "Guardado correctamente"); } else { PreparedStatement st = conexion.prepareStatement( " UPDATE contrato " + " SET id_cliente ='" + contratos_id_cliente + "', " + " premio ='" + Long.parseLong(premio) + "', " + " nro ='" + Integer.parseInt(contrato) + "', " + " fecha ='" + util_Date_to_sql_date(fecha) + "', " + " tonelada ='" + Double.valueOf(toneladas) + "', " + " id_zafra ='" + contratos_id_zafra + "' " + " WHERE id_contrato = '" + id_contrato + "'"); st.executeUpdate(); JOptionPane.showMessageDialog(null, "Guardado correctamente"); } } catch (NumberFormatException | SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Zafra_guardar(String zafra) { try { if (id_zafra == 0) { Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("SELECT MAX(id_zafra) FROM zafra"); if (result.next()) { id_zafra = result.getInt(1) + 1; } PreparedStatement stUpdateProducto = conexion.prepareStatement("" + "INSERT INTO zafra VALUES(?,?)"); stUpdateProducto.setInt(1, id_zafra); stUpdateProducto.setString(2, zafra); stUpdateProducto.executeUpdate(); JOptionPane.showMessageDialog(null, "Guardado correctamente"); } else { PreparedStatement st = conexion.prepareStatement( " UPDATE zafra " + " SET zafra ='" + nombre + "' " + " WHERE id_zafra = '" + id_zafra + "'"); st.executeUpdate(); JOptionPane.showMessageDialog(null, "Guardado correctamente"); } } catch (NumberFormatException | SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Empleado_guardar( String nombre, String ci, String telefono, String descripcion, String salario) { try { if (id_empleado == 0) { Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("SELECT MAX(id_empleado) FROM empleado"); if (result.next()) { id_empleado = result.getInt(1) + 1; } PreparedStatement stUpdateProducto = conexion.prepareStatement("" + "INSERT INTO empleado VALUES(?,?,?,?,?,?,?,?)"); stUpdateProducto.setInt(1, id_empleado); stUpdateProducto.setString(2, nombre); stUpdateProducto.setString(3, ci); stUpdateProducto.setString(4, telefono); stUpdateProducto.setString(5, ""); stUpdateProducto.setString(6, descripcion); stUpdateProducto.setLong(7, Long.parseLong(salario.replace(".", ""))); stUpdateProducto.setInt(8, id_empleado_cargo); stUpdateProducto.executeUpdate(); JOptionPane.showMessageDialog(null, "Guardado correctamente"); } else { PreparedStatement st = conexion.prepareStatement( " UPDATE empleado " + " SET nombre ='" + nombre + "'," + " ci ='" + ci + "'," + " telefono ='" + telefono + "'," + " descripcion_del_trabajo ='" + descripcion + "'," + " id_empleado_cargo ='" + id_empleado_cargo + "'," + " salario ='" + Long.parseLong(salario.replace(".", "")) + "' " + " WHERE id_empleado = '" + id_empleado + "'"); st.executeUpdate(); JOptionPane.showMessageDialog(null, "Guardado correctamente"); } } catch (NumberFormatException | SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Camion_guardar( String marca, String modelo, String anho, String chapa) { try { if ((marca == null) && (marca.length() < 1) && (id_transportista > 0)) { JOptionPane.showMessageDialog(null, "Ingrese los datos"); } else if (id_camion == 0) { int id = 0; Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("SELECT MAX(id_camion) FROM camion"); if (result.next()) { id = result.getInt(1) + 1; } PreparedStatement stUpdateProducto = conexion.prepareStatement("" + "INSERT INTO camion VALUES(?,?,?,?,?,?,?,?)"); stUpdateProducto.setInt(1, id); stUpdateProducto.setString(2, marca); stUpdateProducto.setString(3, modelo); stUpdateProducto.setString(4, anho); stUpdateProducto.setString(5, chapa); stUpdateProducto.setString(6, "-"); stUpdateProducto.setInt(7, id_transportista); stUpdateProducto.setInt(8, 0); stUpdateProducto.executeUpdate(); JOptionPane.showMessageDialog(null, "Guardado correctamente"); } else { PreparedStatement st = conexion.prepareStatement( " UPDATE camion " + " SET marca ='" + marca + "'," + " modelo ='" + modelo + "'," + " anho ='" + anho + "'," + " id_transportista ='" + id_transportista + "'," + " chapa ='" + chapa + "' " + " WHERE id_camion = '" + id_camion + "'"); st.executeUpdate(); JOptionPane.showMessageDialog(null, "Guardado correctamente"); } // Camion_clear(); } catch (NumberFormatException | SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Tecnologia_guardar(String tecnologia) { try { if (id_tecnologia == 0) { Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("SELECT MAX(id_variedad) FROM variedad"); if (result.next()) { id_tecnologia = result.getInt(1) + 1; } PreparedStatement stUpdateProducto = conexion.prepareStatement("" + "INSERT INTO variedad VALUES(?,?,?)"); stUpdateProducto.setInt(1, id_tecnologia); stUpdateProducto.setString(2, tecnologia); stUpdateProducto.setInt(3, 1); // soja stUpdateProducto.executeUpdate(); JOptionPane.showMessageDialog(null, "Guardado correctamente"); } else { PreparedStatement st = conexion.prepareStatement( " UPDATE variedad " + " SET variedad ='" + tecnologia + "'," + " id_granos_tipo ='" + 1 + "' " + " WHERE id_variedad = '" + id_tecnologia + "'"); st.executeUpdate(); JOptionPane.showMessageDialog(null, "Guardado correctamente"); } } catch (NumberFormatException | SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Vehiculos_guardar( String tipo, String modelo, String descripcion) { try { if (id_vehiculo == 0) { Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("SELECT MAX(id_vehiculo) FROM vehiculo"); if (result.next()) { id_vehiculo = result.getInt(1) + 1; } PreparedStatement stUpdateProducto = conexion.prepareStatement("" + "INSERT INTO vehiculo VALUES(?,?,?,?,?)"); stUpdateProducto.setInt(1, id_vehiculo); stUpdateProducto.setString(2, tipo); stUpdateProducto.setString(3, modelo); stUpdateProducto.setString(4, ""); stUpdateProducto.setString(5, descripcion); stUpdateProducto.executeUpdate(); JOptionPane.showMessageDialog(null, "Guardado correctamente"); } else { PreparedStatement st = conexion.prepareStatement( " UPDATE vehiculo " + " SET tipo ='" + tipo + "'," + " modelo ='" + modelo + "'," + " descripcion ='" + descripcion + "' " + " WHERE id_vehiculo = '" + id_vehiculo + "'"); st.executeUpdate(); JOptionPane.showMessageDialog(null, "Guardado correctamente"); } } catch (NumberFormatException | SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Combustibles_guardar( String factura, String litros, Date fecha) { try { if (id_combustible == 0) { Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("SELECT MAX(id_combustible) FROM combustible"); if (result.next()) { id_combustible = result.getInt(1) + 1; } PreparedStatement stUpdateProducto = conexion.prepareStatement("" + "INSERT INTO combustible VALUES(?,?,?,?,?,?)"); stUpdateProducto.setInt(1, id_combustible); stUpdateProducto.setString(2, factura); stUpdateProducto.setDate(3, util_Date_to_sql_date(fecha)); stUpdateProducto.setLong(4, Long.parseLong(litros)); stUpdateProducto.setLong(5, 0); stUpdateProducto.setInt(6, id_sucursal); stUpdateProducto.executeUpdate(); JOptionPane.showMessageDialog(null, "Guardado correctamente"); } else { PreparedStatement st = conexion.prepareStatement( " UPDATE combustible " + " SET factura ='" + factura + "'," + " fecha ='" + util_Date_to_sql_date(fecha) + "'," + " litros ='" + Long.parseLong(litros) + "'," + " precio ='0' " + " WHERE id_combustible = '" + id_combustible + "'"); st.executeUpdate(); JOptionPane.showMessageDialog(null, "Guardado correctamente"); } //Camion_clear(); } catch (NumberFormatException | SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Zafra_guardar( String marca, String modelo, String anho, String chapa) { try { if ((marca == null) && (marca.length() < 1) && (id_transportista > 0)) { JOptionPane.showMessageDialog(null, "Ingrese los datos"); } else if (id_camion == 0) { int id = 0; Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("SELECT MAX(id_camion) FROM camion"); if (result.next()) { id = result.getInt(1) + 1; } PreparedStatement stUpdateProducto = conexion.prepareStatement("" + "INSERT INTO camion VALUES(?,?,?,?,?,?,?,?)"); stUpdateProducto.setInt(1, id); stUpdateProducto.setString(2, marca); stUpdateProducto.setString(3, modelo); stUpdateProducto.setString(4, anho); stUpdateProducto.setString(5, chapa); stUpdateProducto.setString(6, "-"); stUpdateProducto.setInt(7, id_transportista); stUpdateProducto.setInt(8, 0); stUpdateProducto.executeUpdate(); JOptionPane.showMessageDialog(null, "Guardado correctamente"); } else { PreparedStatement st = conexion.prepareStatement( " UPDATE camion " + " SET marca ='" + marca + "'," + " modelo ='" + modelo + "'," + " anho ='" + anho + "'," + " id_transportista ='" + id_transportista + "'," + " chapa ='" + chapa + "' " + " WHERE id_camion = '" + id_camion + "'"); st.executeUpdate(); JOptionPane.showMessageDialog(null, "Guardado correctamente"); } // Camion_clear(); } catch (NumberFormatException | SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Proveedor_guardar(String nombre, String telefono, String ruc, String direccion, String descripcion, String nombre_vendedor, String telefono_vendedor) { try { if (id_proveedor == 0) { Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("SELECT MAX(id_proveedor) FROM proveedor"); if (result.next()) { id_proveedor = result.getInt(1) + 1; } PreparedStatement stUpdateProducto = conexion.prepareStatement("" + "INSERT INTO proveedor VALUES(?,?,?,?,?,?,?,?)"); stUpdateProducto.setInt(1, id_proveedor); stUpdateProducto.setString(2, nombre); stUpdateProducto.setString(3, telefono); stUpdateProducto.setString(4, ruc); stUpdateProducto.setString(5, descripcion); stUpdateProducto.setString(6, direccion); stUpdateProducto.setString(7, nombre_vendedor); stUpdateProducto.setString(8, telefono_vendedor); stUpdateProducto.executeUpdate(); JOptionPane.showMessageDialog(null, "Guardado correctamente"); } else { PreparedStatement st = conexion.prepareStatement( " UPDATE proveedor " + " SET nombre ='" + nombre + "', " + " telefono ='" + telefono + "', " + " ruc ='" + ruc + "', " + " direccion ='" + direccion + "', " + " descripcion ='" + descripcion + "', " + " nombre_vendedor ='" + nombre_vendedor + "', " + " telefono_vendedor ='" + telefono_vendedor + "' " + " WHERE id_proveedor = '" + id_proveedor + "'"); st.executeUpdate(); JOptionPane.showMessageDialog(null, "Actualizado correctamente"); } } catch (NumberFormatException | SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Parcela_guardar( String parcela, String precio, String porcentaje, String has) { try { if (id_parcela == 0) { int id = 0; Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("SELECT MAX(id_parcela) FROM parcela"); if (result.next()) { id_parcela = result.getInt(1) + 1; } PreparedStatement stUpdateProducto = conexion.prepareStatement("" + "INSERT INTO parcela VALUES(?,?,?,?,?)"); stUpdateProducto.setInt(1, id_parcela); stUpdateProducto.setString(2, parcela); stUpdateProducto.setLong(3, Long.parseLong(precio)); stUpdateProducto.setInt(4, Integer.parseInt(porcentaje)); stUpdateProducto.setInt(5, Integer.parseInt(has)); stUpdateProducto.executeUpdate(); JOptionPane.showMessageDialog(null, "Guardado correctamente"); } else { PreparedStatement st = conexion.prepareStatement( " UPDATE parcela " + " SET parcela ='" + parcela + "'," + " precio_del_flete ='" + Long.parseLong(precio) + "', " + " has ='" + Integer.parseInt(has) + "' " + " WHERE id_parcela = '" + id_parcela + "'"); st.executeUpdate(); JOptionPane.showMessageDialog(null, "Guardado correctamente"); } } catch (NumberFormatException | SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Configuracion_guardar( String anho, String empresa, String telefono, String ruc, String direccion, String dolar) { try { PreparedStatement st = conexion.prepareStatement( " UPDATE configuracion " + " SET anho ='" + anho + "', " + " telefono ='" + telefono + "', " + " ruc ='" + ruc + "', " + " dolar ='" + dolar + "', " + " direccion ='" + direccion + "', " + " empresa ='" + empresa + "' " + " "); st.executeUpdate(); PreparedStatement ps2 = conexion.prepareStatement("select * from configuracion "); ResultSet rs2 = ps2.executeQuery(); if (rs2.next()) { titulo = rs2.getString("empresa") + " - " + nombre; empresa = rs2.getString("empresa").trim(); empresa_datos = "RUC. " + rs2.getString("ruc").trim() + " - Telf." + rs2.getString("telefono").trim() + " - Dir." + rs2.getString("direccion").trim(); } JOptionPane.showMessageDialog(null, "Actualizado correctamente"); } catch (NumberFormatException | SQLException ex) { JOptionPane.showMessageDialog(null, "Complete todos los campos. "); } } public synchronized static void Cliente_guardar( String nombre, String direccion, String ruc, String telefono) { try { Conexion.Verificar_conexion(); if ((nombre == null) && (nombre.length() < 1)) { JOptionPane.showMessageDialog(null, "Ingrese los datos"); } else if (id_cliente == 0) { int id = 0; Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("SELECT MAX(id_cliente) FROM cliente"); if (result.next()) { id = result.getInt(1) + 1; } PreparedStatement stUpdateProducto = conexion.prepareStatement("" + "INSERT INTO cliente VALUES(?,?,?,?,?,?,?,?)"); stUpdateProducto.setInt(1, id); stUpdateProducto.setString(2, nombre); stUpdateProducto.setString(3, direccion); stUpdateProducto.setString(4, telefono); stUpdateProducto.setString(5, ""); stUpdateProducto.setString(6, "-"); stUpdateProducto.setString(7, ruc); stUpdateProducto.setInt(8, 0); stUpdateProducto.executeUpdate(); JOptionPane.showMessageDialog(null, "Guardado correctamente"); } else { PreparedStatement st = conexion.prepareStatement( " UPDATE cliente " + " SET nombre ='" + nombre + "'," + " direccion ='" + direccion + "'," + " telefono ='" + telefono + "'," + " ruc ='" + ruc + "' " + " WHERE id_cliente = '" + id_cliente + "'"); st.executeUpdate(); JOptionPane.showMessageDialog(null, "Guardado correctamente"); } // Cliente_clear(); } catch (NumberFormatException | SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Producto_guardar( String descripcion, String precio, String ubicacion, String obs, String iva) { try { if (precio.length() > 0) { } else { precio = "0"; } if (iva.length() > 0) { } else { iva = "0"; } if (descripcion.length() > 0) { if (id_producto == 0) { int id = 0; Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("SELECT MAX(id_producto) FROM productos"); if (result.next()) { id = result.getInt(1) + 1; } PreparedStatement stUpdateProducto = conexion.prepareStatement("" + "INSERT INTO productos VALUES(?,?,?,?,?,?,?,?,?,?)"); stUpdateProducto.setInt(1, id); stUpdateProducto.setInt(2, productos_id_proveedor); stUpdateProducto.setString(3, descripcion); stUpdateProducto.setDouble(4, Double.parseDouble(precio)); stUpdateProducto.setInt(5, Integer.parseInt(iva)); stUpdateProducto.setInt(6, 0); stUpdateProducto.setInt(7, 0); stUpdateProducto.setString(8, ubicacion); stUpdateProducto.setString(9, obs); stUpdateProducto.setInt(10, 0); stUpdateProducto.executeUpdate(); JOptionPane.showMessageDialog(null, "Guardado correctamente"); } else { PreparedStatement st = conexion.prepareStatement( " UPDATE productos " + " SET nombre ='" + descripcion + "', " + " precio ='" + Long.parseLong(precio.replace(".", "")) + "', " + " obs ='" + obs + "'," + " iva ='" + Integer.parseInt(iva) + "', " + " ubicacion ='" + ubicacion + "', " + " id_proveedor ='" + productos_id_proveedor + "' " + " WHERE id_producto = '" + id_producto + "'"); st.executeUpdate(); JOptionPane.showMessageDialog(null, "Guardado correctamente"); } } else { JOptionPane.showMessageDialog(null, "Complete los campos."); } } catch (NumberFormatException | SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Chofer_guradar( String nombre, String direccion, String ci, String telefono) { try { if ((nombre == null) && (nombre.length() < 1)) { JOptionPane.showMessageDialog(null, "Ingrese los datos"); } else if (id_chofer_nuevo == 0) { Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("SELECT MAX(id_chofer) FROM chofer"); if (result.next()) { id_chofer_nuevo = result.getInt(1) + 1; } PreparedStatement stUpdateProducto = conexion.prepareStatement("" + "INSERT INTO chofer VALUES(?,?,?,?,?,?,?)"); stUpdateProducto.setInt(1, id_chofer_nuevo); stUpdateProducto.setString(2, nombre); stUpdateProducto.setString(3, ci); stUpdateProducto.setString(4, telefono); stUpdateProducto.setString(5, direccion); stUpdateProducto.setString(6, "-"); stUpdateProducto.setInt(7, 0); stUpdateProducto.executeUpdate(); JOptionPane.showMessageDialog(null, "Guardado correctamente"); } else { PreparedStatement st = conexion.prepareStatement( " UPDATE chofer " + " SET nombre ='" + nombre + "'," + " direccion ='" + direccion + "'," + " telefono ='" + telefono + "'," + " ci ='" + ci + "' " + " WHERE id_chofer = '" + id_chofer_nuevo + "'"); st.executeUpdate(); JOptionPane.showMessageDialog(null, "Guardado correctamente"); } // Chofer_clear(); } catch (NumberFormatException | SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Carreta_guradar( String marca, String modelo, String chapa, String anho) { try { if ((marca == null) && (marca.length() < 1)) { JOptionPane.showMessageDialog(null, "Ingrese los datos"); } else if (id_carreta == 0) { int id = 0; Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("SELECT MAX(id_carreta) FROM carreta"); if (result.next()) { id = result.getInt(1) + 1; } PreparedStatement stUpdateProducto = conexion.prepareStatement("" + "INSERT INTO carreta VALUES(?,?,?,?,?,?,?)"); stUpdateProducto.setInt(1, id); stUpdateProducto.setString(2, marca); stUpdateProducto.setString(3, modelo); stUpdateProducto.setString(4, anho); stUpdateProducto.setString(5, chapa); stUpdateProducto.setString(6, "-"); stUpdateProducto.setInt(7, 0); stUpdateProducto.executeUpdate(); JOptionPane.showMessageDialog(null, "Guardado correctamente"); } else { PreparedStatement st = conexion.prepareStatement( " UPDATE carreta " + " SET marca ='" + marca + "'," + " modelo ='" + modelo + "'," + " chapa ='" + chapa + "'," + " anho ='" + anho + "' " + " WHERE id_carreta = '" + id_carreta + "'"); st.executeUpdate(); JOptionPane.showMessageDialog(null, "Guardado correctamente"); } // Carreta_clear(); } catch (NumberFormatException | SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Empleado_cargo_guardar( String cargo) { try { if (id_empleado_cargo == 0) { Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("SELECT MAX(id_empleado_cargo) FROM empleado_cargo"); if (result.next()) { id_empleado_cargo = result.getInt(1) + 1; } PreparedStatement stUpdateProducto = conexion.prepareStatement("" + "INSERT INTO empleado_cargo VALUES(?,?)"); stUpdateProducto.setInt(1, id_empleado_cargo); stUpdateProducto.setString(2, cargo); stUpdateProducto.executeUpdate(); JOptionPane.showMessageDialog(null, "Guardado correctamente"); } else { PreparedStatement st = conexion.prepareStatement( " UPDATE empleado_cargo " + " SET cargo ='" + cargo + "'," + " WHERE id_empleado_cargo = '" + id_empleado_cargo + "'"); st.executeUpdate(); JOptionPane.showMessageDialog(null, "Guardado correctamente"); } } catch (NumberFormatException | SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Compras_proveedor_update() { try { PreparedStatement st = conexion.prepareStatement( " UPDATE facturas_compra " + " SET id_proveedor ='" + compras_id_proveedor + "' " + " WHERE id_facturas_compra = '" + id_facturas_compras + "'"); st.executeUpdate(); System.out.println("Proveedor actualizado"); } catch (NumberFormatException | SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Compras_update_total() { try { float total = 0; Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("SELECT SUM(precio) FROM facturas_compra_detalle where id_facturas_compra = '" + id_facturas_compras + "'"); if (result.next()) { total = result.getFloat(1); } PreparedStatement st = conexion.prepareStatement( " UPDATE facturas_compra " + " SET total ='" + total + "' " + " WHERE id_facturas_compra = '" + id_facturas_compras + "'"); st.executeUpdate(); } catch (NumberFormatException | SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Compras_factura_update(String factura, Date fecha) { try { PreparedStatement st = conexion.prepareStatement( " UPDATE facturas_compra " + " SET numero ='" + factura + "', fecha = '" + util_Date_to_sql_date(fecha) + " ' " + " WHERE id_facturas_compra = '" + id_facturas_compras + "'"); st.executeUpdate(); } catch (NumberFormatException | SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static void Compras_fecha_update(Date fecha) { try { if (fecha != null) { PreparedStatement st = conexion.prepareStatement( " UPDATE facturas_compra " + " SET fecha ='" + util_Date_to_sql_date(fecha) + "' " + " WHERE id_facturas_compra = '" + id_facturas_compras + "'"); st.executeUpdate(); System.out.println("Fecha actualizada"); } } catch (NumberFormatException | SQLException ex) { MostrarError(ex, getNombreMetodo()); } } // // public static void Camion_clear() { // id_transportista = 0; // Camion_ABM.jTextField_marca.setText(""); // Camion_ABM.jTextField_modelo.setText(""); // Camion_ABM.jTextField_anho.setText(""); // Camion_ABM.jTextField_chapa.setText(""); // Camion_ABM.jButton_borrar.setVisible(false); // } // // public synchronized static void Recepcion_motivo_selected() { // DefaultTableModel tm = (DefaultTableModel) Recepcion_ABM.jTable_motivo.getModel(); // recepcion_id_motivo = Integer.parseInt(String.valueOf(tm.getValueAt(Recepcion_ABM.jTable_motivo.getSelectedRow(), 0))); // Recepcion_ABM.jTextField_motivo.setText(String.valueOf(tm.getValueAt(Recepcion_ABM.jTable_motivo.getSelectedRow(), 1))); // } // // public synchronized static void Productos_aplicacion_abm_productos_selected() { // DefaultTableModel tm = (DefaultTableModel) Productos_aplicacion_ABM.jTable_productos.getModel(); // productos_aplicacion_abm_id_producto = Integer.parseInt(String.valueOf(tm.getValueAt(Productos_aplicacion_ABM.jTable_productos.getSelectedRow(), 0))); // Productos_aplicacion_ABM.jTextField_producto.setText(String.valueOf(tm.getValueAt(Productos_aplicacion_ABM.jTable_productos.getSelectedRow(), 1))); // } // // public synchronized static void TablaAD_concepto_selected() { // DefaultTableModel tm = (DefaultTableModel) TablaAD.jTable_concepto.getModel(); // tabla_ad_id_concepto = Integer.parseInt(String.valueOf(tm.getValueAt(TablaAD.jTable_concepto.getSelectedRow(), 0))); // TablaAD.jTextField_concepto.setText(String.valueOf(tm.getValueAt(TablaAD.jTable_concepto.getSelectedRow(), 1))); // } // // public synchronized static void Productos_aplicacion_selected() { // DefaultTableModel tm = (DefaultTableModel) Productos_aplicacion_ABM.jTable_buscar.getModel(); // id_producto_aplicacion = Integer.parseInt(String.valueOf(tm.getValueAt(Productos_aplicacion_ABM.jTable_buscar.getSelectedRow(), 0))); // // } // // public synchronized static void Productos_aplicacion_abm_zafra_selected() { // DefaultTableModel tm = (DefaultTableModel) Productos_aplicacion_ABM.jTable_zafra.getModel(); // Productos_aplicacion_abm_id_zafra = Integer.parseInt(String.valueOf(tm.getValueAt(Productos_aplicacion_ABM.jTable_zafra.getSelectedRow(), 0))); // Productos_aplicacion_ABM.jTextField_zafra.setText(String.valueOf(tm.getValueAt(Productos_aplicacion_ABM.jTable_zafra.getSelectedRow(), 1))); // } // // public synchronized static void Recepcion_motivo_descuento_selected() { // DefaultTableModel tm = (DefaultTableModel) Recepcion_ABM.jTable_motivo_de_descuento.getModel(); // recepcion_id_motivo_de_descuento = Integer.parseInt(String.valueOf(tm.getValueAt(Recepcion_ABM.jTable_motivo_de_descuento.getSelectedRow(), 0))); // Recepcion_ABM.jTextField_motivo_descuento.setText(String.valueOf(tm.getValueAt(Recepcion_ABM.jTable_motivo_de_descuento.getSelectedRow(), 1))); // } // // public synchronized static void Recepcion_detalle_selected() { // DefaultTableModel tm = (DefaultTableModel) Recepcion_ABM.jTable_detalle.getModel(); // recepcion_id_recepcion_detalle = Integer.parseInt(String.valueOf(tm.getValueAt(Recepcion_ABM.jTable_detalle.getSelectedRow(), 0))); // } // // public synchronized static void Productos_aplicacion_detalle_selected() { // DefaultTableModel tm = (DefaultTableModel) Productos_aplicacion_ABM.jTable_detalle.getModel(); // productos_aplicacion_detalle_id_producto_aplicacion_detalle = Integer.parseInt(String.valueOf(tm.getValueAt(Productos_aplicacion_ABM.jTable_detalle.getSelectedRow(), 0))); // } // // public synchronized static void Compras_selected() { // DefaultTableModel tm = (DefaultTableModel) Compras.jTable_buscar.getModel(); // id_facturas_compras = Integer.parseInt(String.valueOf(tm.getValueAt(Compras.jTable_buscar.getSelectedRow(), 0))); // } // // public synchronized static void Compras_detalle_selected() { // DefaultTableModel tm = (DefaultTableModel) Compras.jTable1.getModel(); // id_facturas_compras_detalle = Integer.parseInt(String.valueOf(tm.getValueAt(Compras.jTable1.getSelectedRow(), 0))); // } // // public synchronized static void Recibo_de_dinero_recibos_selected() { // DefaultTableModel tm = (DefaultTableModel) Recibo_de_dinero.jTable_recibos.getModel(); // id_recibo = Integer.parseInt(String.valueOf(tm.getValueAt(Recibo_de_dinero.jTable_recibos.getSelectedRow(), 0))); // } // // public synchronized static void Recibo_de_dinero_cliente_selected() { // DefaultTableModel tm = (DefaultTableModel) Recibo_de_dinero.jTable_cliente.getModel(); // recibo_de_dinero_id_cliente = Integer.parseInt(String.valueOf(tm.getValueAt(Recibo_de_dinero.jTable_cliente.getSelectedRow(), 0))); // Recibo_de_dinero.jTextField_cliente.setText(String.valueOf(tm.getValueAt(Recibo_de_dinero.jTable_cliente.getSelectedRow(), 1)).trim()); // } // // public synchronized static void Recibo_de_dinero_moneda_selected() { // DefaultTableModel tm = (DefaultTableModel) Recibo_de_dinero.jTable_moneda.getModel(); // recibo_de_dinero_id_moneda = Integer.parseInt(String.valueOf(tm.getValueAt(Recibo_de_dinero.jTable_moneda.getSelectedRow(), 0))); // Recibo_de_dinero.jTextField_moneda.setText(String.valueOf(tm.getValueAt(Recibo_de_dinero.jTable_moneda.getSelectedRow(), 1)).trim()); // } // // public synchronized static void Recibo_de_dinero_banco_selected() { // DefaultTableModel tm = (DefaultTableModel) Recibo_de_dinero.jTable_banco.getModel(); // recibo_de_dinero_id_banco = Integer.parseInt(String.valueOf(tm.getValueAt(Recibo_de_dinero.jTable_banco.getSelectedRow(), 0))); // Recibo_de_dinero.jTextField_banco.setText(String.valueOf(tm.getValueAt(Recibo_de_dinero.jTable_banco.getSelectedRow(), 1)).trim()); // } // // public synchronized static void Producto_selected() { // DefaultTableModel tm = (DefaultTableModel) Productos_listado.jTable1.getModel(); // id_producto = Integer.parseInt(String.valueOf(tm.getValueAt(Productos_listado.jTable1.getSelectedRow(), 0))); // } // // public synchronized static void TablaAD_tipo_selected() { // DefaultTableModel tm = (DefaultTableModel) TablaAD.jTable_tipo.getModel(); // tabla_ad_id_tipo = Integer.parseInt(String.valueOf(tm.getValueAt(TablaAD.jTable_tipo.getSelectedRow(), 0))); // TablaAD.jTextField_tipo.setText(String.valueOf(tm.getValueAt(TablaAD.jTable_tipo.getSelectedRow(), 1))); // } // // public synchronized static void Liquidaciones_multiples_moneda_selected() { // DefaultTableModel tm = (DefaultTableModel) Liquidaciones_multiples.jTable_moneda.getModel(); // id_moneda = Integer.parseInt(String.valueOf(tm.getValueAt(Liquidaciones_multiples.jTable_moneda.getSelectedRow(), 0))); // Liquidaciones_multiples.jTextField_moneda.setText(String.valueOf(tm.getValueAt(Liquidaciones_multiples.jTable_moneda.getSelectedRow(), 1))); // } // // public synchronized static void Liquidaciones_multiples_recepcion_jtable_selected() { // DefaultTableModel tm = (DefaultTableModel) Liquidaciones_multiples.jTable_recepciones.getModel(); // liquidaciones_multiples_id_recepcion = Integer.parseInt(String.valueOf(tm.getValueAt(Liquidaciones_multiples.jTable_recepciones.getSelectedRow(), 0))); // } // // public synchronized static void Liquidaciones_multiples_seleccionado_jtable_selected() { // DefaultTableModel tm = (DefaultTableModel) Liquidaciones_multiples.jTable_seleccionadas.getModel(); // liquidaciones_multiples_id_recepcion = Integer.parseInt(String.valueOf(tm.getValueAt(Liquidaciones_multiples.jTable_seleccionadas.getSelectedRow(), 0))); // } // // public synchronized static void Sueldo_detalle_selected() { // DefaultTableModel tm = (DefaultTableModel) Personales_pagos_ABM.jTable_detalle.getModel(); // id_sueldo_detalle = Integer.parseInt(String.valueOf(tm.getValueAt(Personales_pagos_ABM.jTable_detalle.getSelectedRow(), 0))); // } // // public synchronized static void Personales_suledo_selected() { // DefaultTableModel tm = (DefaultTableModel) Personales_pagos_ABM.jTable_sueldos.getModel(); // id_sueldo = Integer.parseInt(String.valueOf(tm.getValueAt(Personales_pagos_ABM.jTable_sueldos.getSelectedRow(), 0))); // } // // public synchronized static void Personales_pagos_concepto_selected() { // DefaultTableModel tm = (DefaultTableModel) Personales_pagos_ABM.jTable_concepto.getModel(); // personales_pagos_id_concepto = Integer.parseInt(String.valueOf(tm.getValueAt(Personales_pagos_ABM.jTable_concepto.getSelectedRow(), 0))); // Personales_pagos_ABM.jTextField_concepto.setText(String.valueOf(tm.getValueAt(Personales_pagos_ABM.jTable_concepto.getSelectedRow(), 1))); // } // // public synchronized static void Personales_pagos_empleado_selected() { // DefaultTableModel tm = (DefaultTableModel) Personales_pagos_ABM.jTable_empleado.getModel(); // personales_pagos_id_empleado = Integer.parseInt(String.valueOf(tm.getValueAt(Personales_pagos_ABM.jTable_empleado.getSelectedRow(), 0))); // Personales_pagos_ABM.jTextField_empleado.setText(String.valueOf(tm.getValueAt(Personales_pagos_ABM.jTable_empleado.getSelectedRow(), 1))); // } // // public synchronized static void Personales_pago_mes_selected() { // DefaultTableModel tm = (DefaultTableModel) Personales_pagos_ABM.jTable_mes.getModel(); // personales_pago_id_mes = Integer.parseInt(String.valueOf(tm.getValueAt(Personales_pagos_ABM.jTable_mes.getSelectedRow(), 0))); // Personales_pagos_ABM.jTextField_mes.setText(String.valueOf(tm.getValueAt(Personales_pagos_ABM.jTable_mes.getSelectedRow(), 1))); // } // // public synchronized static void Consultas_seleccionar_selected() { // DefaultTableModel tm = (DefaultTableModel) Consultas.jTable_movimientos.getModel(); // consultas_id_recepcion = Integer.parseInt(String.valueOf(tm.getValueAt(Consultas.jTable_movimientos.getSelectedRow(), 0))); // } // // public synchronized static void Conultas_estado_selected() { // DefaultTableModel tm = (DefaultTableModel) Consultas.jTable_estado.getModel(); // consultas_id_estado = Integer.parseInt(String.valueOf(tm.getValueAt(Consultas.jTable_estado.getSelectedRow(), 0))); // Consultas.jTextField_estado.setText(String.valueOf(tm.getValueAt(Consultas.jTable_estado.getSelectedRow(), 1))); // } // // public synchronized static void Consultas_seleccionado_selected() { // DefaultTableModel tm = (DefaultTableModel) Consultas.jTable_seleccionados.getModel(); // consultas_id_recepcion = Integer.parseInt(String.valueOf(tm.getValueAt(Consultas.jTable_seleccionados.getSelectedRow(), 0))); // } // // public synchronized static void Consultas_cliente_selected() { // DefaultTableModel tm = (DefaultTableModel) Consultas.jTable_clientes.getModel(); // consultas_id_cliente = Integer.parseInt(String.valueOf(tm.getValueAt(Consultas.jTable_clientes.getSelectedRow(), 0))); // Consultas.jTextField_cliente.setText(String.valueOf(tm.getValueAt(Consultas.jTable_clientes.getSelectedRow(), 1))); // } // // public synchronized static void Compras_proveedor_selected() { // DefaultTableModel tm = (DefaultTableModel) Compras.jTable_proverdor.getModel(); // compras_id_proveedor = Integer.parseInt(String.valueOf(tm.getValueAt(Compras.jTable_proverdor.getSelectedRow(), 0))); // Compras.jT_Proveedor.setText(String.valueOf(tm.getValueAt(Compras.jTable_proverdor.getSelectedRow(), 1))); // } // // public synchronized static void Tecnologia_selected() { // DefaultTableModel tm = (DefaultTableModel) Tecnologia.jTable_tecnologia.getModel(); // id_tecnologia = Integer.parseInt(String.valueOf(tm.getValueAt(Tecnologia.jTable_tecnologia.getSelectedRow(), 0))); // Tecnologia.jTextField_tecnologia.setText(String.valueOf(tm.getValueAt(Tecnologia.jTable_tecnologia.getSelectedRow(), 1))); // Tecnologia.jTextField_tipo_de_grano.setText(String.valueOf(tm.getValueAt(Tecnologia.jTable_tecnologia.getSelectedRow(), 2))); // } // // public synchronized static void Compras_productos_selected() { // DefaultTableModel tm = (DefaultTableModel) Compras.jTable_producto.getModel(); // compras_id_producto = Integer.parseInt(String.valueOf(tm.getValueAt(Compras.jTable_producto.getSelectedRow(), 0))); // Compras.jTextField_producto.setText(String.valueOf(tm.getValueAt(Compras.jTable_producto.getSelectedRow(), 1))); // } // // public synchronized static void Contratos_recepcion_selected() { // DefaultTableModel tm = (DefaultTableModel) Contratos_recepcion.jTable_contratos.getModel(); // contratos_recepcion_id_contrato = Integer.parseInt(String.valueOf(tm.getValueAt(Contratos_recepcion.jTable_contratos.getSelectedRow(), 0))); // } // // public synchronized static void Ventas_detalle_selected() { // DefaultTableModel tm = (DefaultTableModel) Ventas.jTable_detalle.getModel(); // id_venta_detalle = Integer.parseInt(String.valueOf(tm.getValueAt(Ventas.jTable_detalle.getSelectedRow(), 0))); // } // // public synchronized static void Ventas_moneda_selected() { // DefaultTableModel tm = (DefaultTableModel) Ventas.jTable_moneda.getModel(); // ventas_id_moneda = Integer.parseInt(String.valueOf(tm.getValueAt(Ventas.jTable_moneda.getSelectedRow(), 0))); // Ventas.jTextField_moneda.setText(String.valueOf(tm.getValueAt(Ventas.jTable_moneda.getSelectedRow(), 1))); // } // // public synchronized static void Ventas_cliente_selected() { // DefaultTableModel tm = (DefaultTableModel) Ventas.jTable_cliente.getModel(); // ventas_id_cliente = Integer.parseInt(String.valueOf(tm.getValueAt(Ventas.jTable_cliente.getSelectedRow(), 0))); // Ventas.jTextField_cliente.setText(String.valueOf(tm.getValueAt(Ventas.jTable_cliente.getSelectedRow(), 1))); // } // // public synchronized static void Ventas_buscar_selected() { // DefaultTableModel tm = (DefaultTableModel) Ventas.jTable_ventas.getModel(); // id_venta = Integer.parseInt(String.valueOf(tm.getValueAt(Ventas.jTable_ventas.getSelectedRow(), 0))); // } // // public synchronized static void Ventas_producto_selected() { // DefaultTableModel tm = (DefaultTableModel) Ventas.jTable_productos.getModel(); // ventas_id_producto = Integer.parseInt(String.valueOf(tm.getValueAt(Ventas.jTable_productos.getSelectedRow(), 0))); // Ventas.jTextField_producto.setText(String.valueOf(tm.getValueAt(Ventas.jTable_productos.getSelectedRow(), 1))); // Ventas.jTextField_precio.setText(String.valueOf(tm.getValueAt(Ventas.jTable_productos.getSelectedRow(), 2))); // Ventas.jTextField_unidad.setText("1"); // } // // public synchronized static void Combustible_uso_detalle_selected() { // DefaultTableModel tm = (DefaultTableModel) Combustible_uso.jTable_combustible_uso.getModel(); // id_combustible_uso_selected = Integer.parseInt(String.valueOf(tm.getValueAt(Combustible_uso.jTable_combustible_uso.getSelectedRow(), 0))); // } // // public synchronized static void Listado_recepciones_sucursal_selected() { // DefaultTableModel tm = (DefaultTableModel) Listado_recepciones.jTable_sucursal.getModel(); // id_sucursal_selected = Integer.parseInt(String.valueOf(tm.getValueAt(Listado_recepciones.jTable_sucursal.getSelectedRow(), 0))); // Listado_recepciones.jTextField_sucursal.setText(String.valueOf(tm.getValueAt(Listado_recepciones.jTable_sucursal.getSelectedRow(), 1))); // } // // public synchronized static void Configuracion_sucursal_selected() { // DefaultTableModel tm = (DefaultTableModel) Configuracion.jTable_sucursal.getModel(); // configuracion_id_sucursal_selected = Integer.parseInt(String.valueOf(tm.getValueAt(Configuracion.jTable_sucursal.getSelectedRow(), 0))); // Configuracion.jTextField_sucursal.setText(String.valueOf(tm.getValueAt(Configuracion.jTable_sucursal.getSelectedRow(), 1))); // Configuracion.jTextField_numero.setText(String.valueOf(tm.getValueAt(Configuracion.jTable_sucursal.getSelectedRow(), 2))); // } // // public synchronized static void Vehiculos_selected() { // DefaultTableModel tm = (DefaultTableModel) Vehiculo.jTable_vehiculos.getModel(); // id_vehiculo = Integer.parseInt(String.valueOf(tm.getValueAt(Vehiculo.jTable_vehiculos.getSelectedRow(), 0))); // } // // public synchronized static void Combustibles_uso_selected() { // DefaultTableModel tm = (DefaultTableModel) Combustible_uso.jTable_vehiculo.getModel(); // combustibles_uso_id_vehiculo = Integer.parseInt(String.valueOf(tm.getValueAt(Combustible_uso.jTable_vehiculo.getSelectedRow(), 0))); // Combustible_uso.jTextField_vehiculo.setText( // String.valueOf(tm.getValueAt(Combustible_uso.jTable_vehiculo.getSelectedRow(), 1)) // + " " + String.valueOf(tm.getValueAt(Combustible_uso.jTable_vehiculo.getSelectedRow(), 2)) // + " " + String.valueOf(tm.getValueAt(Combustible_uso.jTable_vehiculo.getSelectedRow(), 3))); // } // // public synchronized static void Contrato_recepcion_zafra_selected() { // DefaultTableModel tm = (DefaultTableModel) Contratos_recepcion.jTable_zafra.getModel(); // contrato_recepcion_id_zafra = Integer.parseInt(String.valueOf(tm.getValueAt(Contratos_recepcion.jTable_zafra.getSelectedRow(), 0))); // Contratos_recepcion.jTextField_zafra.setText(String.valueOf(tm.getValueAt(Contratos_recepcion.jTable_zafra.getSelectedRow(), 1))); // } // // public synchronized static void Contrato_recepcion_cliente_selected() { // DefaultTableModel tm = (DefaultTableModel) Contratos_recepcion.jTable_cliente.getModel(); // contrato_recepcion_id_cliente = Integer.parseInt(String.valueOf(tm.getValueAt(Contratos_recepcion.jTable_cliente.getSelectedRow(), 0))); // Contratos_recepcion.jTextField_cliente.setText(String.valueOf(tm.getValueAt(Contratos_recepcion.jTable_cliente.getSelectedRow(), 1))); // } // // public synchronized static void Recepcion_zafra_selected() { // DefaultTableModel tm = (DefaultTableModel) Recepcion_ABM.jTable_zafra.getModel(); // recepcion_id_zafra = Integer.parseInt(String.valueOf(tm.getValueAt(Recepcion_ABM.jTable_zafra.getSelectedRow(), 0))); // Recepcion_ABM.jTextField_zafra.setText(String.valueOf(tm.getValueAt(Recepcion_ABM.jTable_zafra.getSelectedRow(), 1))); // } // // public synchronized static void Uso_de_Productos_listado_parcela_selected() { // DefaultTableModel tm = (DefaultTableModel) Uso_de_productos_listado.jTable_parcela.getModel(); // uso_de_productos_listado_id_parcela = Integer.parseInt(String.valueOf(tm.getValueAt(Uso_de_productos_listado.jTable_parcela.getSelectedRow(), 0))); // Uso_de_productos_listado.jTextField_parcela.setText(String.valueOf(tm.getValueAt(Uso_de_productos_listado.jTable_parcela.getSelectedRow(), 1))); // } // // public synchronized static void Uso_de_Productos_listado_zafra_selected() { // DefaultTableModel tm = (DefaultTableModel) Uso_de_productos_listado.jTable_zafra.getModel(); // uso_de_productos_listado_id_zafra = Integer.parseInt(String.valueOf(tm.getValueAt(Uso_de_productos_listado.jTable_zafra.getSelectedRow(), 0))); // Uso_de_productos_listado.jTextField_zafra.setText(String.valueOf(tm.getValueAt(Uso_de_productos_listado.jTable_zafra.getSelectedRow(), 1))); // } // // public synchronized static void Uso_de_Productos_listado_cultivo_selected() { // DefaultTableModel tm = (DefaultTableModel) Uso_de_productos_listado.jTable_cultivo.getModel(); // uso_de_productos_listado_id_cultivo = Integer.parseInt(String.valueOf(tm.getValueAt(Uso_de_productos_listado.jTable_cultivo.getSelectedRow(), 0))); // Uso_de_productos_listado.jTextField_cultivo.setText(String.valueOf(tm.getValueAt(Uso_de_productos_listado.jTable_cultivo.getSelectedRow(), 1))); // } // // public synchronized static void Recepcion_variedad_selected() { // DefaultTableModel tm = (DefaultTableModel) Recepcion_ABM.jTable_variedad.getModel(); // recepcion_id_variedad = Integer.parseInt(String.valueOf(tm.getValueAt(Recepcion_ABM.jTable_variedad.getSelectedRow(), 0))); // Recepcion_ABM.jTextField_variedad.setText(String.valueOf(tm.getValueAt(Recepcion_ABM.jTable_variedad.getSelectedRow(), 1))); // } // // public synchronized static void Recepcion_remitente_selected() { // DefaultTableModel tm = (DefaultTableModel) Recepcion_ABM.jTable_remitente.getModel(); // recepcion_id_remitente = Integer.parseInt(String.valueOf(tm.getValueAt(Recepcion_ABM.jTable_remitente.getSelectedRow(), 0))); // Recepcion_ABM.jTextField_remitente.setText(String.valueOf(tm.getValueAt(Recepcion_ABM.jTable_remitente.getSelectedRow(), 1))); // } // // public synchronized static void Contrato_zafra_selected() { // DefaultTableModel tm = (DefaultTableModel) Contratos.jTable_zafra.getModel(); // contratos_id_zafra = Integer.parseInt(String.valueOf(tm.getValueAt(Contratos.jTable_zafra.getSelectedRow(), 0))); // Contratos.jTextField_zafra.setText(String.valueOf(tm.getValueAt(Contratos.jTable_zafra.getSelectedRow(), 1))); // } // // public synchronized static void Contrato_cliente_selected() { // DefaultTableModel tm = (DefaultTableModel) Contratos.jTable_cliente.getModel(); // contratos_id_cliente = Integer.parseInt(String.valueOf(tm.getValueAt(Contratos.jTable_cliente.getSelectedRow(), 0))); // Contratos.jTextField_cliente.setText(String.valueOf(tm.getValueAt(Contratos.jTable_cliente.getSelectedRow(), 1))); // } // // public synchronized static void Listado_recepciones_pendientes_cliente_selected() { // DefaultTableModel tm = (DefaultTableModel) Listado_recepciones_pendientes.jTable_cliente.getModel(); // listado_recepcion_pendiente_id_cliente = Integer.parseInt(String.valueOf(tm.getValueAt(Listado_recepciones_pendientes.jTable_cliente.getSelectedRow(), 0))); // Listado_recepciones_pendientes.jTextField_cliente.setText(String.valueOf(tm.getValueAt(Listado_recepciones_pendientes.jTable_cliente.getSelectedRow(), 1))); // } // // public synchronized static void Transportista_selected() { // DefaultTableModel tm = (DefaultTableModel) Transportista_listado.jTable1.getModel(); // String selected = String.valueOf(tm.getValueAt(Transportista_listado.jTable1.getSelectedRow(), 0)); // id_transportista = Integer.parseInt(selected.replace(".", "")); // } // // public synchronized static void Camion_selected() { // DefaultTableModel tm = (DefaultTableModel) Camion_listado.jTable1.getModel(); // String selected = String.valueOf(tm.getValueAt(Camion_listado.jTable1.getSelectedRow(), 0)); // id_camion = Integer.parseInt(selected.replace(".", "")); // } // // public synchronized static void Parcela_selected() { // DefaultTableModel tm = (DefaultTableModel) Parcela_listado.jTable1.getModel(); // id_parcela = Integer.parseInt(String.valueOf(tm.getValueAt(Parcela_listado.jTable1.getSelectedRow(), 0))); // } // // public synchronized static void Recepcion_Parcela_selected() { // DefaultTableModel tm = (DefaultTableModel) Recepcion_Parcela_listado.jTable1.getModel(); // id_parcela = Integer.parseInt(String.valueOf(tm.getValueAt(Recepcion_Parcela_listado.jTable1.getSelectedRow(), 0))); // Recepcion_ABM.jTextField_parcela.setText(String.valueOf(tm.getValueAt(Recepcion_Parcela_listado.jTable1.getSelectedRow(), 1))); // } // // public synchronized static void Listados_Parcela_selected() { // DefaultTableModel tm = (DefaultTableModel) Listados_Parcela_listado.jTable1.getModel(); // id_parcela = Integer.parseInt(String.valueOf(tm.getValueAt(Listados_Parcela_listado.jTable1.getSelectedRow(), 0))); // Listado_recepciones_parcela.jTextField_parcela.setText(String.valueOf(tm.getValueAt(Listados_Parcela_listado.jTable1.getSelectedRow(), 1))); // } // // public synchronized static void Recepcion_Camion_selected() { // DefaultTableModel tm = (DefaultTableModel) Recepcion_Camion_listado.jTable1.getModel(); // String selected = String.valueOf(tm.getValueAt(Recepcion_Camion_listado.jTable1.getSelectedRow(), 0)); // id_camion = Integer.parseInt(selected.replace(".", "")); // Recepcion_ABM.jTextField_camion.setText(String.valueOf(tm.getValueAt(Recepcion_Camion_listado.jTable1.getSelectedRow(), 4))); // } // // public synchronized static void Recepcion_Moneda_selected() { // DefaultTableModel tm = (DefaultTableModel) Recepcion_Moneda_listado.jTable1.getModel(); // String selected = String.valueOf(tm.getValueAt(Recepcion_Moneda_listado.jTable1.getSelectedRow(), 0)); // id_moneda = Integer.parseInt(selected.replace(".", "")); // Recepcion_ABM.jTextField_moneda.setText(String.valueOf(tm.getValueAt(Recepcion_Moneda_listado.jTable1.getSelectedRow(), 1))); // } // //// public synchronized static void Recepcion_granos_tipo_selected() { //// DefaultTableModel tm = (DefaultTableModel) Recepcion_productos_tipo.jTable1.getModel(); //// id_granos_tipo = Integer.parseInt(String.valueOf(tm.getValueAt(Recepcion_productos_tipo.jTable1.getSelectedRow(), 0))); //// Recepcion_ABM.jTextField_tipo.setText(String.valueOf(tm.getValueAt(Recepcion_productos_tipo.jTable1.getSelectedRow(), 1))); //// } // public synchronized static void Recepcion_tipo_selected() { // DefaultTableModel tm = (DefaultTableModel) Recepcion_ABM.jTable_tipo.getModel(); // id_granos_tipo = Integer.parseInt(String.valueOf(tm.getValueAt(Recepcion_ABM.jTable_tipo.getSelectedRow(), 0))); // Recepcion_ABM.jTextField_tipo.setText(String.valueOf(tm.getValueAt(Recepcion_ABM.jTable_tipo.getSelectedRow(), 1))); // } // // public synchronized static void Recepcion_habilitar_detalle() { //// if (id_granos_tipo == 1) { //// Recepcion_ABM.jPanel_Soja.setVisible(true); //// Recepcion_ABM.jPanel_canola.setVisible(false); //// Recepcion_ABM.jPanel_trigo.setVisible(false); //// } //// if (id_granos_tipo == 2) { //// Recepcion_ABM.jPanel_Soja.setVisible(false); //// Recepcion_ABM.jPanel_canola.setVisible(true); //// Recepcion_ABM.jPanel_trigo.setVisible(false); //// } //// if (id_granos_tipo == 3) { //// Recepcion_ABM.jPanel_Soja.setVisible(false); //// Recepcion_ABM.jPanel_canola.setVisible(false); //// Recepcion_ABM.jPanel_trigo.setVisible(true); //// } // } // // public synchronized static void Recepcion_selected() { // DefaultTableModel tm = (DefaultTableModel) Recepcion_listado.jTable1.getModel(); // String selected = String.valueOf(tm.getValueAt(Recepcion_listado.jTable1.getSelectedRow(), 0)); // id_recepcion = Integer.parseInt(selected.replace(".", "")); // } // // public synchronized static void Cliente_selected() { // DefaultTableModel tm = (DefaultTableModel) Cliente_listado.jTable1.getModel(); // String selected = String.valueOf(tm.getValueAt(Cliente_listado.jTable1.getSelectedRow(), 0)); // id_cliente = Integer.parseInt(selected.replace(".", "")); // } // // public synchronized static void Personales_selected() { // DefaultTableModel tm = (DefaultTableModel) Personales_listado.jTable1.getModel(); // id_empleado = Integer.parseInt(String.valueOf(tm.getValueAt(Personales_listado.jTable1.getSelectedRow(), 0))); // } // // public synchronized static void Empleado_cargo_selected() { // DefaultTableModel tm = (DefaultTableModel) Cargo_listado.jTable1.getModel(); // id_empleado_cargo = Integer.parseInt(String.valueOf(tm.getValueAt(Cargo_listado.jTable1.getSelectedRow(), 0))); // Cargo_ABM.jTextField_cargo.setText(String.valueOf(tm.getValueAt(Cargo_listado.jTable1.getSelectedRow(), 1))); // } // // public synchronized static void Personales_cargo_selected() { // DefaultTableModel tm = (DefaultTableModel) Personales_Cargo_listado.jTable1.getModel(); // id_empleado_cargo = Integer.parseInt(String.valueOf(tm.getValueAt(Personales_Cargo_listado.jTable1.getSelectedRow(), 0))); // Personales_ABM.jTextField_cargo.setText(String.valueOf(tm.getValueAt(Personales_Cargo_listado.jTable1.getSelectedRow(), 1))); // } // // public synchronized static void Producto_proveedor_selected() { // DefaultTableModel tm = (DefaultTableModel) Producto_proveedor_listado.jTable1.getModel(); // productos_id_proveedor = Integer.parseInt(String.valueOf(tm.getValueAt(Producto_proveedor_listado.jTable1.getSelectedRow(), 0))); // Productos.jTextField_proveedor.setText(String.valueOf(tm.getValueAt(Producto_proveedor_listado.jTable1.getSelectedRow(), 1))); // } // // public synchronized static void Receciones_listado_Cliente_selected() { // DefaultTableModel tm = (DefaultTableModel) Listado_recepciones_Cliente_buscar.jTable1.getModel(); // id_cliente = Integer.parseInt(String.valueOf(tm.getValueAt(Listado_recepciones_Cliente_buscar.jTable1.getSelectedRow(), 0))); // Listado_recepciones_cliente.jTextField_cliente.setText(String.valueOf(tm.getValueAt(Listado_recepciones_Cliente_buscar.jTable1.getSelectedRow(), 1))); // } // // public synchronized static void Receciones_listado_Usuario_selected() { // DefaultTableModel tm = (DefaultTableModel) Listado_recepciones_Usuario_buscar.jTable1.getModel(); // id_usuario_buscar = Integer.parseInt(String.valueOf(tm.getValueAt(Listado_recepciones_Usuario_buscar.jTable1.getSelectedRow(), 0))); // Listado_recepciones_usuario.jTextField_usuario.setText(String.valueOf(tm.getValueAt(Listado_recepciones_Usuario_buscar.jTable1.getSelectedRow(), 1))); // } // // public synchronized static void Recepcion_Cliente_selected() { // DefaultTableModel tm = (DefaultTableModel) Recepcion_Cliente_listado.jTable1.getModel(); // String selected = String.valueOf(tm.getValueAt(Recepcion_Cliente_listado.jTable1.getSelectedRow(), 0)); // id_cliente = Integer.parseInt(selected.replace(".", "")); // Recepcion_ABM.jTextField_cliente.setText(String.valueOf(tm.getValueAt(Recepcion_Cliente_listado.jTable1.getSelectedRow(), 1))); // //Recepcion_ABM.jTextField_ruc.setText(String.valueOf(tm.getValueAt(Recepcion_Cliente_listado.jTable1.getSelectedRow(), 2))); // //Recepcion_ABM.jTextField_telefono.setText(String.valueOf(tm.getValueAt(Recepcion_Cliente_listado.jTable1.getSelectedRow(), 3))); // } // // public synchronized static void Chofer_selected() { // DefaultTableModel tm = (DefaultTableModel) Conductor_listado.jTable1.getModel(); // String selected = String.valueOf(tm.getValueAt(Conductor_listado.jTable1.getSelectedRow(), 0)); // id_chofer_nuevo = Integer.parseInt(selected.replace(".", "")); // } // // public synchronized static void Listado_recepciones_Conductor_selected() { // DefaultTableModel tm = (DefaultTableModel) Listados_recepciones_Chofer_listado.jTable1.getModel(); // id_chofer = Integer.parseInt(String.valueOf(tm.getValueAt(Listados_recepciones_Chofer_listado.jTable1.getSelectedRow(), 0))); // Listado_recepciones_personales.jTextField_conductor.setText(String.valueOf(tm.getValueAt(Listados_recepciones_Chofer_listado.jTable1.getSelectedRow(), 1))); // } // // public synchronized static void Recepcion_Chofer_selected() { // DefaultTableModel tm = (DefaultTableModel) Recepcion_Chofer_listado.jTable1.getModel(); // String selected = String.valueOf(tm.getValueAt(Recepcion_Chofer_listado.jTable1.getSelectedRow(), 0)); // id_chofer = Integer.parseInt(selected.replace(".", "")); // Recepcion_ABM.jTextField_chofer.setText(String.valueOf(tm.getValueAt(Recepcion_Chofer_listado.jTable1.getSelectedRow(), 1))); // } // // public synchronized static void Carreta_selected() { // DefaultTableModel tm = (DefaultTableModel) Carreta_listado.jTable1.getModel(); // String selected = String.valueOf(tm.getValueAt(Carreta_listado.jTable1.getSelectedRow(), 0)); // id_carreta = Integer.parseInt(selected.replace(".", "")); // } // // public synchronized static void Proveedor_selected() { // DefaultTableModel tm = (DefaultTableModel) Proveedor_listado.jTable1.getModel(); //// id_proveedor = String.valueOf(tm.getValueAt(Proveedor_listado.jTable1.getSelectedRow(), 0)); // } // // public synchronized static void Recepcion_Carreta_selected() { // DefaultTableModel tm = (DefaultTableModel) Recepcion_Carreta_listado.jTable1.getModel(); // String selected = String.valueOf(tm.getValueAt(Recepcion_Carreta_listado.jTable1.getSelectedRow(), 0)); // id_carreta = Integer.parseInt(selected.replace(".", "")); // Recepcion_ABM.jTextField_carreta.setText(String.valueOf(tm.getValueAt(Recepcion_Carreta_listado.jTable1.getSelectedRow(), 3))); // } // // public synchronized static void Camion_Transportista_selected() { // DefaultTableModel tm = (DefaultTableModel) Camion_transportista_listado.jTable1.getModel(); // String selected = String.valueOf(tm.getValueAt(Camion_transportista_listado.jTable1.getSelectedRow(), 0)); // id_transportista = Integer.parseInt(selected.replace(".", "")); // Camion_ABM.jTextField_transportista.setText(String.valueOf(tm.getValueAt(Camion_transportista_listado.jTable1.getSelectedRow(), 1))); // } // // public synchronized static void Contrato_selected() { // DefaultTableModel tm = (DefaultTableModel) Contratos.jTable_contratos.getModel(); // id_contrato = Integer.parseInt(String.valueOf(tm.getValueAt(Contratos.jTable_contratos.getSelectedRow(), 0))); // } // // public synchronized static void Combustibles_uso_personal_selected() { // DefaultTableModel tm = (DefaultTableModel) Combustible_uso.jTable_personales.getModel(); // combustible_uso_id_personal = Integer.parseInt(String.valueOf(tm.getValueAt(Combustible_uso.jTable_personales.getSelectedRow(), 0))); // Combustible_uso.jTextField_personal.setText(String.valueOf(tm.getValueAt(Combustible_uso.jTable_personales.getSelectedRow(), 1))); // } // // public synchronized static void Combustibles_venta_clientes_selected() { // DefaultTableModel tm = (DefaultTableModel) Combustible_venta.jTable_clientes.getModel(); // combustible_venta_id_cliente = Integer.parseInt(String.valueOf(tm.getValueAt(Combustible_venta.jTable_clientes.getSelectedRow(), 0))); // Combustible_venta.jTextField_cliente.setText(String.valueOf(tm.getValueAt(Combustible_venta.jTable_clientes.getSelectedRow(), 1))); // } // // public synchronized static void Ticket_selected() { // DefaultTableModel tm = (DefaultTableModel) Tickets.jTable1.getModel(); // id_ticket = Integer.parseInt(String.valueOf(tm.getValueAt(Tickets.jTable1.getSelectedRow(), 0))); // } // // public synchronized static void Productos_aplicacion_parcela_selected() { // DefaultTableModel tm = (DefaultTableModel) Productos_aplicacion_ABM.jTable_parcela.getModel(); // productos_aplicacion_id_parcela = Integer.parseInt(String.valueOf(tm.getValueAt(Productos_aplicacion_ABM.jTable_parcela.getSelectedRow(), 0))); // Productos_aplicacion_ABM.jTextField_parcela.setText(String.valueOf(tm.getValueAt(Productos_aplicacion_ABM.jTable_parcela.getSelectedRow(), 1))); // } // // public synchronized static void Productos_aplicacion_cultivo_selected() { // DefaultTableModel tm = (DefaultTableModel) Productos_aplicacion_ABM.jTable_cultivo.getModel(); // productos_aplicacion_id_cultivo = Integer.parseInt(String.valueOf(tm.getValueAt(Productos_aplicacion_ABM.jTable_cultivo.getSelectedRow(), 0))); // Productos_aplicacion_ABM.jTextField_cultivo.setText(String.valueOf(tm.getValueAt(Productos_aplicacion_ABM.jTable_cultivo.getSelectedRow(), 1))); // } // // public static void Transportistas_editar() { // try { // String sql = "select * " // + "from transportista " // + "where id_transportista ='" + id_transportista + "' "; // Statement ST_Productos = conexion.createStatement(); // ResultSet RS_Productos = ST_Productos.executeQuery(sql); // while (RS_Productos.next()) { // Transportista_ABM.jTextField_nombre.setText(RS_Productos.getString("nombre").trim()); // if (RS_Productos.getString("ci") != null) { // Transportista_ABM.jTextField_ci.setText(RS_Productos.getString("ci").trim()); // } // if (RS_Productos.getString("ruc") != null) { // Transportista_ABM.jTextField_ruc.setText(RS_Productos.getString("ruc").trim()); // } // if (RS_Productos.getString("telefono") != null) { // Transportista_ABM.jTextField_telefono.setText(RS_Productos.getString("telefono").trim()); // } // if (RS_Productos.getString("direccion") != null) { // Transportista_ABM.jTextField_direccion.setText(RS_Productos.getString("direccion").trim()); // } // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Producto_editar() { // try { // String sql = "select *, proveedor.nombre as pro_nombre " // + "from productos " // + "inner join proveedor on proveedor.id_proveedor = productos.id_proveedor " // + "where id_producto ='" + id_producto + "' "; // Statement ST_Productos = conexion.createStatement(); // ResultSet RS_Productos = ST_Productos.executeQuery(sql); // while (RS_Productos.next()) { // // productos_id_proveedor = RS_Productos.getInt("id_proveedor"); // Productos.jTextField_descripcion.setText(RS_Productos.getString("nombre").trim()); //// Productos.jTextField_iva.setText(RS_Productos.getString("iva")); // Productos.jTextField_precio.setText(RS_Productos.getString("precio")); // Productos.jTextField_observaciones.setText(RS_Productos.getString("obs")); // Productos.jTextField_proveedor.setText(RS_Productos.getString("pro_nombre").trim()); // Productos.jTextField_ubicacion.setText(RS_Productos.getString("ubicacion")); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Vehiculos_traer_datos() { // try { // String sql = "select * " // + "from vehiculo " // + "where id_vehiculo ='" + id_vehiculo + "' "; // Statement ST_Productos = conexion.createStatement(); // ResultSet RS_Productos = ST_Productos.executeQuery(sql); // while (RS_Productos.next()) { // // if (RS_Productos.getString("marca") != null) { // Vehiculo.jTextField_tipo.setText(RS_Productos.getString("marca").trim()); // } // if (RS_Productos.getString("modelo") != null) { // Vehiculo.jTextField_modelo.setText(RS_Productos.getString("modelo").trim()); // } // if (RS_Productos.getString("descripcion") != null) { // Vehiculo.jTextField_descripcion.setText(RS_Productos.getString("descripcion").trim()); // } // // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void productos_aplicaion_traer_datos() { // try { // String sql = "select * " // + "from producto_aplicacion " // + "inner join granos_tipo on granos_tipo.id_granos_tipo = producto_aplicacion.id_granos_tipo " // + "inner join zafra on zafra.id_zafra = producto_aplicacion.id_zafra " // + "inner join parcela on parcela.id_parcela = producto_aplicacion.id_parcela " // + "where id_producto_aplicacion ='" + id_producto_aplicacion + "'" // + ""; // Statement ST = conexion.createStatement(); // ResultSet RS = ST.executeQuery(sql); // while (RS.next()) { // Productos_aplicacion_ABM.jDateChooser_fecha.setDate(RS.getDate("fecha")); // Productos_aplicacion_ABM.jTextField_cultivo.setText(RS.getString("tipo").trim()); // Productos_aplicacion_ABM.jTextField_parcela.setText(RS.getString("parcela").trim()); // Productos_aplicacion_ABM.jTextField_zafra.setText(RS.getString("zafra").trim()); // // productos_aplicacion_id_tipo = RS.getInt("tipo_aplicacion"); // if (productos_aplicacion_id_tipo == 1) { // Productos_aplicacion_ABM.jTextField_tipo.setText("APLICACION"); // } else { // Productos_aplicacion_ABM.jTextField_tipo.setText("SIEMBRA"); // } // // productos_aplicacion_id_cultivo = RS.getInt("id_granos_tipo"); // productos_aplicacion_id_parcela = RS.getInt("id_parcela"); // Productos_aplicacion_abm_id_zafra = RS.getInt("id_zafra"); // // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // } // } // // public static void Sueldo_traer_datos() { // try { // String sql = "select * " // + "from sueldo " // + "inner join mes on mes.id_mes = sueldo.id_mes " // + "inner join empleado on empleado.id_empleado = sueldo.id_empleado " // + "where id_sueldo ='" + id_sueldo + "' "; // Statement ST = conexion.createStatement(); // ResultSet RS = ST.executeQuery(sql); // while (RS.next()) { // // personales_pago_id_mes = RS.getInt("id_mes"); // personales_pagos_id_empleado = RS.getInt("id_empleado"); // // Personales_pagos_ABM.jTextField_mes.setText(RS.getString("mes").trim()); // Personales_pagos_ABM.jTextField_anho.setText(RS.getString("anho").trim()); // Personales_pagos_ABM.jTextField_empleado.setText(RS.getString("nombre").trim()); // Personales_pagos_ABM.jTextField_dias_trabajados.setText(RS.getString("dias").trim()); // Personales_pagos_ABM.jTextField_total.setText(RS.getString("total").trim()); // Personales_pagos_ABM.jDateChooser_inicio.setDate(RS.getDate("fecha")); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Combustible_venta_traer_datos() { // try { // String sql = "select * " // + "from combustible_venta " // + "inner join cliente on cliente.id_cliente = combustible_venta.id_cliente " // + "where id_combustible_venta ='" + id_combustible_venta + "' " // + ""; // Statement ST_Productos = conexion.createStatement(); // ResultSet RS_Productos = ST_Productos.executeQuery(sql); // while (RS_Productos.next()) { // Combustible_venta.jTextField_cliente.setText(RS_Productos.getString("nombre").trim()); // Combustible_venta.jTextField_descripcion.setText(RS_Productos.getString("descripcion")); // Combustible_venta.jTextField_litros.setText(RS_Productos.getString("litros")); // Combustible_venta.jTextField_precio.setText(RS_Productos.getString("precio")); // Combustible_venta.jTextField_total.setText(RS_Productos.getString("total")); // Combustible_venta.jDateChooser_fecha.setDate(RS_Productos.getDate("fecha")); // combustible_venta_id_cliente = RS_Productos.getInt("id_cliente"); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Camion_editar() { // try { // String sql = "select * " // + "from camion " // + "inner join transportista on transportista.id_transportista = camion.id_transportista " // + "where id_camion ='" + id_camion + "' "; // Statement ST_Productos = conexion.createStatement(); // ResultSet RS_Productos = ST_Productos.executeQuery(sql); // while (RS_Productos.next()) { // Camion_ABM.jTextField_marca.setText(RS_Productos.getString("marca").trim()); // id_transportista = RS_Productos.getInt("id_transportista"); // Camion_ABM.jTextField_transportista.setText(RS_Productos.getString("nombre").trim()); // if (RS_Productos.getString("modelo") != null) { // Camion_ABM.jTextField_modelo.setText(RS_Productos.getString("modelo").trim()); // } // if (RS_Productos.getString("anho") != null) { // Camion_ABM.jTextField_anho.setText(RS_Productos.getString("anho").trim()); // } // if (RS_Productos.getString("chapa") != null) { // Camion_ABM.jTextField_chapa.setText(RS_Productos.getString("chapa").trim()); // } // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Parcela_editar() { // try { // String sql = "select * " // + "from parcela " // + "where id_parcela ='" + id_parcela + "' "; // Statement ST_Productos = conexion.createStatement(); // ResultSet RS_Productos = ST_Productos.executeQuery(sql); // while (RS_Productos.next()) { // Parcela_ABM.jTextField_parcela.setText(RS_Productos.getString("parcela").trim()); // if (RS_Productos.getString("precio_del_flete") != null) { // Parcela_ABM.jTextField_precio.setText(RS_Productos.getString("porcentaje").trim()); // } // if (RS_Productos.getString("porcentaje") != null) { // Parcela_ABM.jTextField_porcentaje.setText(RS_Productos.getString("porcentaje").trim()); // } // if (RS_Productos.getString("has") != null) { // Parcela_ABM.jTextField_has.setText(RS_Productos.getString("has").trim()); // } // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Cliente_editar() { // try { // String sql = "select * " // + "from cliente " // + "where id_cliente ='" + id_cliente + "' "; // Statement ST_Productos = conexion.createStatement(); // ResultSet RS_Productos = ST_Productos.executeQuery(sql); // while (RS_Productos.next()) { // Cliente.jTextField_nombre.setText(RS_Productos.getString("nombre").trim()); // id_cliente = RS_Productos.getInt("id_cliente"); // if (RS_Productos.getString("telefono") != null) { // Cliente.jTextField_telefono.setText(RS_Productos.getString("telefono").trim()); // } // if (RS_Productos.getString("direccion") != null) { // Cliente.jTextField_direccion.setText(RS_Productos.getString("direccion").trim()); // } // if (RS_Productos.getString("ruc") != null) { // Cliente.jTextField_ruc.setText(RS_Productos.getString("ruc").trim()); // } // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Personales_editar() { // try { // String sql = "select * " // + "from empleado " // + "where id_empleado ='" + id_empleado + "' "; // Statement ST_Productos = conexion.createStatement(); // ResultSet RS_Productos = ST_Productos.executeQuery(sql); // while (RS_Productos.next()) { // // if (RS_Productos.getString("nombre") != null) { // Personales_ABM.jTextField_nombre.setText(RS_Productos.getString("nombre").trim()); // } // if (RS_Productos.getString("ci") != null) { // Personales_ABM.jTextField_ci.setText(RS_Productos.getString("ci").trim()); // } // if (RS_Productos.getString("telefono") != null) { // Personales_ABM.jTextField_telefono.setText(RS_Productos.getString("telefono").trim()); // } // if (RS_Productos.getString("descripcion_del_trabajo") != null) { // Personales_ABM.jTextField_trabajo.setText(RS_Productos.getString("descripcion_del_trabajo").trim()); // } // if (RS_Productos.getString("salario") != null) { // Personales_ABM.jTextField_salario.setText(getSepararMiles(RS_Productos.getString("salario").trim())); // } // id_empleado_cargo = RS_Productos.getInt("id_empleado_cargo"); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Chofer_editar() { // try { // String sql = "select * " // + "from chofer " // + "where id_chofer ='" + id_chofer_nuevo + "' "; // Statement ST_Productos = conexion.createStatement(); // ResultSet RS_Productos = ST_Productos.executeQuery(sql); // while (RS_Productos.next()) { // Conductor_ABM.jTextField_nombre.setText(RS_Productos.getString("nombre").trim()); // id_chofer = RS_Productos.getInt("id_chofer"); // if (RS_Productos.getString("telefono") != null) { // Conductor_ABM.jTextField_telefono.setText(RS_Productos.getString("telefono").trim()); // } // if (RS_Productos.getString("direccion") != null) { // Conductor_ABM.jTextField_direccion.setText(RS_Productos.getString("direccion").trim()); // } // if (RS_Productos.getString("ci") != null) { // Conductor_ABM.jTextField_ci.setText(RS_Productos.getString("ci").trim()); // } // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // // public static void Carreta_editar() { // try { // String sql = "select * " // + "from carreta " // + "where id_carreta ='" + id_carreta + "' "; // Statement ST_Productos = conexion.createStatement(); // ResultSet RS_Productos = ST_Productos.executeQuery(sql); // while (RS_Productos.next()) { // Carreta_ABM.jTextField_marca.setText(RS_Productos.getString("marca").trim()); // id_carreta = RS_Productos.getInt("id_carreta"); // if (RS_Productos.getString("modelo") != null) { // Carreta_ABM.jTextField_modelo.setText(RS_Productos.getString("modelo").trim()); // } // if (RS_Productos.getString("anho") != null) { // Carreta_ABM.jTextField_anho.setText(RS_Productos.getString("anho").trim()); // } // if (RS_Productos.getString("chapa") != null) { // Carreta_ABM.jTextField_chapa.setText(RS_Productos.getString("chapa").trim()); // } // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } public synchronized static java.sql.Date util_Date_to_sql_date(Date fecha) { java.sql.Date fecha_sql_date = null; if (fecha != null) { java.util.Date utilDate = fecha; fecha_sql_date = new java.sql.Date(utilDate.getTime()); } return fecha_sql_date; } public synchronized static boolean getIngresar() { boolean entro = false; try { Metodos.nombre = Logueo.jTextField1.getText(); char[] arrayC = Logueo.jPasswordField1.getPassword(); String pass = new String(arrayC); //Conexion.Verificar_conexion(); PreparedStatement ps = conexion.prepareStatement("" + "select * " + "from usuario " + "inner join sucursal on sucursal.id_sucursal = usuario.id_sucursal " + "where nombre ='" + nombre + "' and contrasenha = '" + pass + "'" + ""); ResultSet rs = ps.executeQuery(); if (rs.next()) { nombre = rs.getString("nombre_real").trim(); id_usuario = rs.getInt("id_usuario"); id_sucursal = rs.getInt("id_sucursal"); sucursal = rs.getString("sucursal"); privilegio = rs.getInt("privilegio"); PreparedStatement ps2 = conexion.prepareStatement("select * from configuracion "); ResultSet rs2 = ps2.executeQuery(); if (rs2.next()) { titulo = rs2.getString("empresa") + " - " + nombre; empresa = rs2.getString("empresa").trim(); empresa_datos = "RUC. " + rs2.getString("ruc").trim() + " - Telf." + rs2.getString("telefono").trim() + " - Dir." + rs2.getString("direccion").trim(); } // Configuracion_inicial(); ubicacion_proyecto = new File("").getAbsolutePath(); ubicacion_reportes = new File("").getAbsolutePath(); Metodos.imagen = ubicacion_reportes + "\\reportes\\logo.jpg"; Metodos.path = ubicacion_reportes + "\\reportes\\"; if (ismac == true) { Metodos.imagen = ubicacion_reportes + "//reportes//logo.jpg"; Metodos.path = ubicacion_reportes + "//reportes//"; } entro = true; // new Principal().setVisible(true); } if (entro == false) { JOptionPane.showMessageDialog(null, "Error de usuario y/o contraseña."); } } catch (SQLException ex) { JOptionPane.showMessageDialog(null, ex); MostrarError(ex, getNombreMetodo()); } return entro; } public synchronized static boolean isNumericDouble(String cadena) { try { Double.parseDouble(cadena); return true; } catch (NumberFormatException nfe) { return false; } } public synchronized static boolean isNumeric(String cadena) { try { Long.parseLong(cadena); return true; } catch (NumberFormatException nfe) { return false; } } public synchronized static String getSepararMiles(String txtprec) { String valor = txtprec; int largo = valor.length(); if (largo > 8) { valor = valor.substring(largo - 9, largo - 6) + "." + valor.substring(largo - 6, largo - 3) + "." + valor.substring(largo - 3, largo); } else if (largo > 7) { valor = valor.substring(largo - 8, largo - 6) + "." + valor.substring(largo - 6, largo - 3) + "." + valor.substring(largo - 3, largo); } else if (largo > 6) { valor = valor.substring(largo - 7, largo - 6) + "." + valor.substring(largo - 6, largo - 3) + "." + valor.substring(largo - 3, largo); } else if (largo > 5) { valor = valor.substring(largo - 6, largo - 3) + "." + valor.substring(largo - 3, largo); } else if (largo > 4) { valor = valor.substring(largo - 5, largo - 3) + "." + valor.substring(largo - 3, largo); } else if (largo > 3) { valor = valor.substring(largo - 4, largo - 3) + "." + valor.substring(largo - 3, largo); } txtprec = valor; return valor; } public static void Aplicacion_productos_tipo_update(int valor, int app) { try { if (app == 0) { PreparedStatement st = conexion.prepareStatement("" + "UPDATE producto_aplicacion " + "SET tipo_aplicacion ='" + valor + "', " + "aplicacion = '0' " + "WHERE id_producto_aplicacion = '" + id_producto_aplicacion + "'"); st.executeUpdate(); } else { PreparedStatement st = conexion.prepareStatement("" + "UPDATE producto_aplicacion " + "SET tipo_aplicacion ='" + valor + "' " + "WHERE id_producto_aplicacion = '" + id_producto_aplicacion + "'"); st.executeUpdate(); } } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } static void Personales_pagos_guardar(String dias_trabajados, Date fecha, String importe, String anho) { try { if (id_sueldo == 0) { Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("SELECT MAX(id_sueldo) FROM sueldo"); if (result.next()) { id_sueldo = result.getInt(1) + 1; } PreparedStatement stUpdateProducto = conexion.prepareStatement("INSERT INTO sueldo VALUES(?,?,?,?,?,?,?)"); stUpdateProducto.setInt(1, id_sueldo); stUpdateProducto.setInt(2, personales_pagos_id_empleado); stUpdateProducto.setInt(3, personales_pago_id_mes); stUpdateProducto.setDate(4, util_Date_to_sql_date(hoy)); stUpdateProducto.setDouble(5, Double.parseDouble(dias_trabajados)); stUpdateProducto.setLong(6, 0); stUpdateProducto.setLong(7, Long.parseLong(anho)); stUpdateProducto.executeUpdate(); } else { PreparedStatement st = conexion.prepareStatement("" + "UPDATE sueldo " + "SET id_empleado ='" + personales_pagos_id_empleado + "', " + "id_mes ='" + personales_pago_id_mes + "', " + "fecha ='" + util_Date_to_sql_date(hoy) + "', " + "anho ='" + Long.parseLong(anho) + "', " + "dias ='" + Double.parseDouble(dias_trabajados) + "' " + "WHERE id_sueldo = '" + id_sueldo + "'"); st.executeUpdate(); if (personales_pagos_id_concepto != 0) { Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("SELECT MAX(id_sueldo_detalle) FROM sueldo_detalle"); if (result.next()) { id_sueldo_detalle = result.getInt(1) + 1; } PreparedStatement stUpdateProducto = conexion.prepareStatement("INSERT INTO sueldo_detalle VALUES(?,?,?,?)"); stUpdateProducto.setInt(1, id_sueldo_detalle); stUpdateProducto.setLong(2, Long.parseLong(importe.replace(".", ""))); stUpdateProducto.setInt(3, id_sueldo); stUpdateProducto.setInt(4, personales_pagos_id_concepto); stUpdateProducto.executeUpdate(); personales_pagos_id_concepto = 0; } } Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("" + "SELECT SUM(importe) " + "FROM sueldo_detalle " + "where id_sueldo = '" + id_sueldo + "'"); if (result.next()) { PreparedStatement st = conexion.prepareStatement("" + "UPDATE sueldo " + "SET total ='" + result.getLong(1) + "' " + "WHERE id_sueldo = '" + id_sueldo + "'"); st.executeUpdate(); } } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } static void Venta_imprimir() { try { long cinco = 0; long diez = 0; Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("SELECT SUM(cinco) FROM venta_detalle where id_venta = '" + id_venta + "'"); if (result.next()) { cinco = result.getLong(1); } st1 = conexion.createStatement(); result = st1.executeQuery("SELECT SUM(diez) FROM venta_detalle where id_venta = '" + id_venta + "'"); if (result.next()) { diez = result.getLong(1); } int dolar = 1; st1 = conexion.createStatement(); result = st1.executeQuery("SELECT * FROM venta where id_venta = '" + id_venta + "' and id_moneda = '2'"); if (result.next()) { dolar = result.getInt("dolar"); } JasperReport jr = null; Map parametros = new HashMap(); String path = Metodos.ubicacion_proyecto + "\\reportes\\factura.jasper"; // ubicacion_proyecto = ubicacion_proyecto.replace("\\", "\\\\"); parametros.put("direccion", ubicacion_proyecto + "\\\\reportes\\\\factura_detalle"); parametros.put("cinco", (cinco / 21) * dolar); parametros.put("diez", (diez / 11) * dolar); parametros.put("total", ((diez / 11) + (cinco / 21)) * dolar); parametros.put("total_total", ((diez + cinco) * dolar)); parametros.put("total_letras", Numero_a_String((diez + cinco) * dolar)); parametros.put("id_venta", id_venta); jr = (JasperReport) JRLoader.loadObjectFromFile(path); JasperPrint jp = JasperFillManager.fillReport(jr, parametros, conexion); JasperViewer jv = new JasperViewer(jp, false); jv.setVisible(true); } catch (JRException ex) { MostrarError(ex, getNombreMetodo()); } catch (SQLException | ClassNotFoundException ex) { MostrarError(ex, getNombreMetodo()); } } static void Venta_imprimir_comprobante() { try { long cinco = 0; long diez = 0; Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("SELECT SUM(cinco) FROM venta_detalle where id_venta = '" + id_venta + "'"); if (result.next()) { cinco = result.getLong(1); } st1 = conexion.createStatement(); result = st1.executeQuery("SELECT SUM(diez) FROM venta_detalle where id_venta = '" + id_venta + "'"); if (result.next()) { diez = result.getLong(1); } int dolar = 1; // st1 = conexion.createStatement(); // result = st1.executeQuery("SELECT * FROM venta where id_venta = '" + id_venta + "' and id_moneda = '2'"); // if (result.next()) { // dolar = result.getInt("dolar"); // } JasperReport jr = null; Map parametros = new HashMap(); String path = Metodos.ubicacion_proyecto + "\\reportes\\factura_con_logo.jasper"; // ubicacion_proyecto = ubicacion_proyecto.replace("\\", "\\\\"); parametros.put("direccion", ubicacion_proyecto + "\\\\reportes\\\\factura_detalle"); parametros.put("cinco", (cinco / 21) * dolar); parametros.put("diez", (diez / 11) * dolar); parametros.put("total", ((diez / 11) + (cinco / 21)) * dolar); parametros.put("total_total", ((diez + cinco) * dolar)); parametros.put("total_letras", Numero_a_String((diez + cinco) * dolar)); parametros.put("id_venta", id_venta); jr = (JasperReport) JRLoader.loadObjectFromFile(path); JasperPrint jp = JasperFillManager.fillReport(jr, parametros, conexion); JasperViewer jv = new JasperViewer(jp, false); jv.setVisible(true); } catch (JRException ex) { MostrarError(ex, getNombreMetodo()); } catch (SQLException | ClassNotFoundException ex) { MostrarError(ex, getNombreMetodo()); } } static void Ventas_update_total() { try { double total = 0; long total_long = 0; Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("" + "SELECT * " + "FROM venta_detalle " + "where id_venta = '" + id_venta + "'"); while (result.next()) { total = result.getDouble("exentas") + result.getDouble("cinco") + result.getDouble("diez") + total; } total_long = (long) total; PreparedStatement st = conexion.prepareStatement("" + "UPDATE venta " + "SET total = '" + total_long + "' " + "WHERE id_venta = '" + id_venta + "'"); st.executeUpdate(); // Ventas.jTextField_total.setText(String.valueOf(total_long)); } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public synchronized static String Numero_a_String(long numeroINT) throws ClassNotFoundException, SQLException { Numero_a_Letra NumLetra = new Numero_a_Letra(); String cantidad_string = Long.toString(numeroINT); String aRemplazar = NumLetra.Convertir(cantidad_string, true); String remplazado = aRemplazar.replace("0", ""); return remplazado; } static void Generar_pagare() { try { Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("SELECT MAX(id_pagare) FROM pagares"); if (result.next()) { id_pagare = result.getInt(1) + 1; } st1 = conexion.createStatement(); result = st1.executeQuery("SELECT * FROM venta where id_venta = '" + id_venta + "'"); if (result.next()) { id_cliente = result.getInt("id_cliente"); } PreparedStatement stUpdateProducto = conexion.prepareStatement("INSERT INTO pagares VALUES(?,?,?,?,?)"); stUpdateProducto.setInt(1, id_pagare); stUpdateProducto.setDate(2, util_Date_to_sql_date(hoy)); stUpdateProducto.setDate(3, util_Date_to_sql_date(hoy)); stUpdateProducto.setInt(4, id_cliente); stUpdateProducto.setInt(5, id_venta); stUpdateProducto.executeUpdate(); } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } // static void Recibo_de_dinero_clientes_jtable(String buscar) { // try { // dtm = (DefaultTableModel) Recibo_de_dinero.jTable_cliente.getModel(); // for (int j = 0; j < Recibo_de_dinero.jTable_cliente.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select * " // + "from cliente " // + "where nombre ilike '%" + buscar + "%'"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Recibo_de_dinero.jTable_cliente.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // static void Recibo_de_dinero_bancos_jtable() { // try { // dtm = (DefaultTableModel) Recibo_de_dinero.jTable_banco.getModel(); // for (int j = 0; j < Recibo_de_dinero.jTable_banco.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select * " // + "from banco " // + ""); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Recibo_de_dinero.jTable_banco.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } static void Recibo_de_dinero_guardar(String cheque, String concepto, String dinero, Date fecha) { try { Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("SELECT MAX(id_recibo) FROM recibo"); if (result.next()) { id_recibo = result.getInt(1) + 1; } PreparedStatement stUpdateProducto = conexion.prepareStatement("INSERT INTO recibo VALUES(?,?,?,?,?,?,?,?)"); stUpdateProducto.setInt(1, id_recibo); stUpdateProducto.setInt(2, recibo_de_dinero_id_cliente); stUpdateProducto.setDate(3, util_Date_to_sql_date(fecha)); stUpdateProducto.setInt(4, recibo_de_dinero_id_moneda); stUpdateProducto.setString(5, concepto); stUpdateProducto.setInt(6, recibo_de_dinero_id_banco); stUpdateProducto.setString(7, cheque); stUpdateProducto.setLong(8, Long.parseLong(dinero.replace(".", ""))); stUpdateProducto.executeUpdate(); JOptionPane.showMessageDialog(null, "Guardado correctamente."); } catch (SQLException ex) { JOptionPane.showMessageDialog(null, "Verifique los datos." + ex); } } // static void Recibo_de_dinero_moneda_jtable() { // try { // dtm = (DefaultTableModel) Recibo_de_dinero.jTable_moneda.getModel(); // for (int j = 0; j < Recibo_de_dinero.jTable_moneda.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select * " // + "from moneda " // + "order by moneda"); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Recibo_de_dinero.jTable_moneda.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } static void Compras_detalle_guardar(String precio, String unidades, int id_moneda) { try { Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("SELECT MAX(id_facturas_compra_detalle) FROM facturas_compra_detalle"); if (result.next()) { id_facturas_compras_detalle = result.getInt(1) + 1; } PreparedStatement stUpdateProducto = conexion.prepareStatement("INSERT INTO facturas_compra_detalle VALUES(?,?,?,?,?,?,?)"); stUpdateProducto.setInt(1, id_facturas_compras_detalle); stUpdateProducto.setInt(2, id_facturas_compras); stUpdateProducto.setLong(3, Long.parseLong(unidades)); stUpdateProducto.setLong(4, Long.parseLong(precio)); stUpdateProducto.setLong(5, 0); stUpdateProducto.setInt(6, 1); stUpdateProducto.setInt(7, compras_id_producto); stUpdateProducto.executeUpdate(); } catch (SQLException ex) { JOptionPane.showMessageDialog(null, "Verifique los datos." + ex); } } static void Recepcion_update_descuento() { try { long total_descuento = 0; long peso_neto = 0; Statement st1 = conexion.createStatement(); ResultSet result = st1.executeQuery("SELECT SUM(descuento) FROM recepcion_detalle where id_recepcion = '" + id_recepcion + "'"); if (result.next()) { total_descuento = result.getLong(1); } st1 = conexion.createStatement(); result = st1.executeQuery("SELECT * FROM recepcion where id_recepcion = '" + id_recepcion + "'"); if (result.next()) { peso_neto = result.getLong("peso_neto"); } double total_neto_carga = peso_neto - total_descuento; long tnc = (long) total_neto_carga; long total_desc = (long) total_descuento; PreparedStatement st2 = conexion.prepareStatement("" + "UPDATE recepcion " + "SET total_descuento ='" + total_desc + "', " + "total_neto_carga ='" + tnc + "' " + "WHERE id_recepcion = '" + id_recepcion + "'"); st2.executeUpdate(); } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } public static void Backup_online() { try { Conexion.conexion_online_activar(); Statement st2 = null; Statement st = Conexion.conexion.createStatement(); st2 = Conexion.conexion_online.createStatement(); st2.executeUpdate("delete from venta_detalle"); st2 = Conexion.conexion_online.createStatement(); st2.executeUpdate("delete from venta"); st2 = Conexion.conexion_online.createStatement(); st2.executeUpdate("delete from recepcion_detalle"); st2 = Conexion.conexion_online.createStatement(); st2.executeUpdate("delete from recepcion"); st2 = Conexion.conexion_online.createStatement(); st2.executeUpdate("delete from recibo"); st2 = Conexion.conexion_online.createStatement(); st2.executeUpdate("delete from contrato"); st2 = Conexion.conexion_online.createStatement(); st2.executeUpdate("delete from cliente"); ResultSet rs = st.executeQuery("SELECT * FROM cliente order by id_cliente "); while (rs.next()) { PreparedStatement st3 = Conexion.conexion_online.prepareStatement("INSERT INTO cliente VALUES(?,?,?,?,?, ?,?,?,?)"); st3.setInt(1, rs.getInt(1)); st3.setString(2, rs.getString(2)); st3.setString(3, rs.getString(3)); st3.setString(4, rs.getString(4)); st3.setString(5, rs.getString(5)); st3.setString(6, rs.getString(6)); st3.setString(7, rs.getString(7)); st3.setInt(8, rs.getInt(8)); st3.setInt(9, rs.getInt(9)); st3.executeUpdate(); } JOptionPane.showMessageDialog(null, "Copia de seguridad realizada exitosamente."); } catch (SQLException ex) { MostrarError(ex, getNombreMetodo()); } } // static void Obtener_has_de_parcela(int productos_aplicacion_id_parcela) { // Statement st; // try { // st = Conexion.conexion.createStatement(); // ResultSet rs = st.executeQuery("" // + "SELECT * FROM parcela " // + "where id_parcela = '" + productos_aplicacion_id_parcela + "' "); // while (rs.next()) { // Productos_aplicacion_ABM.jTextField_has.setText(rs.getString("has")); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // } // } // public static void Uso_de_productos_listado_parcela_jtable(String buscar) { // try { // // Conexion.Verificar_conexion(); // // dtm = (DefaultTableModel) Uso_de_productos_listado.jTable_parcela.getModel(); // for (int j = 0; j < Uso_de_productos_listado.jTable_parcela.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_parcela, parcela " // + "from parcela " // + "where parcela ilike '%" + buscar + "%'" // + "order by parcela" // + ""); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Uso_de_productos_listado.jTable_parcela.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // public static void Uso_de_productos_listado_zafra_jtable() { // try { // // Conexion.Verificar_conexion(); // // dtm = (DefaultTableModel) Uso_de_productos_listado.jTable_zafra.getModel(); // for (int j = 0; j < Uso_de_productos_listado.jTable_zafra.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_zafra, zafra " // + "from zafra " // + "order by zafra" // + ""); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Uso_de_productos_listado.jTable_zafra.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } // public static void Uso_de_productos_listado_cultivo_jtable() { // try { // // Conexion.Verificar_conexion(); // // dtm = (DefaultTableModel) Uso_de_productos_listado.jTable_cultivo.getModel(); // for (int j = 0; j < Uso_de_productos_listado.jTable_cultivo.getRowCount(); j++) { // dtm.removeRow(j); // j -= 1; // } // PreparedStatement ps2 = conexion.prepareStatement("" // + "select id_granos_tipo, tipo " // + "from granos_tipo " // + "order by granos_tipo" // + ""); // ResultSet rs2 = ps2.executeQuery(); // rsm = rs2.getMetaData(); // ArrayList<Object[]> data2 = new ArrayList<>(); // while (rs2.next()) { // Object[] rows = new Object[rsm.getColumnCount()]; // for (int i = 0; i < rows.length; i++) { // rows[i] = rs2.getObject(i + 1).toString().trim(); // } // data2.add(rows); // } // dtm = (DefaultTableModel) Uso_de_productos_listado.jTable_cultivo.getModel(); // for (int i = 0; i < data2.size(); i++) { // dtm.addRow(data2.get(i)); // } // } catch (SQLException ex) { // MostrarError(ex, getNombreMetodo()); // // } // } public static class Numero_a_Letra { private final String[] UNIDADES = {"", "un ", "dos ", "tres ", "cuatro ", "cinco ", "seis ", "siete ", "ocho ", "nueve "}; private final String[] DECENAS = {"diez ", "once ", "doce ", "trece ", "catorce ", "quince ", "dieciseis ", "diecisiete ", "dieciocho ", "diecinueve", "veinte ", "treinta ", "cuarenta ", "cincuenta ", "sesenta ", "setenta ", "ochenta ", "noventa "}; private final String[] CENTENAS = {"", "ciento ", "doscientos ", "trecientos ", "cuatrocientos ", "quinientos ", "seiscientos ", "setecientos ", "ochocientos ", "novecientos "}; public Numero_a_Letra() { } public String Convertir(String numero, boolean mayusculas) { String literal = ""; String parte_decimal; //si el numero utiliza (.) en lugar de (,) -> se reemplaza numero = numero.replace(".", ","); //si el numero no tiene parte decimal, se le agrega ,00 if (numero.indexOf(",") == -1) { numero = numero + ",0"; } //se valida formato de entrada -> 0,00 y 999 999 999,00 if (Pattern.matches("\\d{1,9},\\d{1,2}", numero)) { //se divide el numero 0000000,00 -> entero y decimal String Num[] = numero.split(","); //de da formato al numero decimal parte_decimal = Num[1] + ""; //se convierte el numero a literal if (Integer.parseInt(Num[0]) == 0) {//si el valor es cero literal = "cero "; } else if (Integer.parseInt(Num[0]) > 999999) {//si es millon literal = getMillones(Num[0]); } else if (Integer.parseInt(Num[0]) > 999) {//si es miles literal = getMiles(Num[0]); } else if (Integer.parseInt(Num[0]) > 99) {//si es centena literal = getCentenas(Num[0]); } else if (Integer.parseInt(Num[0]) > 9) {//si es decena literal = getDecenas(Num[0]); } else {//sino unidades -> 9 literal = getUnidades(Num[0]); } //devuelve el resultado en mayusculas o minusculas if (mayusculas) { return (literal + parte_decimal).toUpperCase(); } else { return (literal + parte_decimal); } } else {//error, no se puede convertir return literal = null; } } /* funciones para convertir los numeros a literales */ private String getUnidades(String numero) {// 1 - 9 //si tuviera algun 0 antes se lo quita -> 09 = 9 o 009=9 String num = numero.substring(numero.length() - 1); return UNIDADES[Integer.parseInt(num)]; } private String getDecenas(String num) {// 99 int n = Integer.parseInt(num); if (n < 10) {//para casos como -> 01 - 09 return getUnidades(num); } else if (n > 19) {//para 20...99 String u = getUnidades(num); if (u.equals("")) { //para 20,30,40,50,60,70,80,90 return DECENAS[Integer.parseInt(num.substring(0, 1)) + 8]; } else { return DECENAS[Integer.parseInt(num.substring(0, 1)) + 8] + "y " + u; } } else {//numeros entre 11 y 19 return DECENAS[n - 10]; } } private String getCentenas(String num) {// 999 o 099 if (Integer.parseInt(num) > 99) {//es centena if (Integer.parseInt(num) == 100) {//caso especial return " cien "; } else { return CENTENAS[Integer.parseInt(num.substring(0, 1))] + getDecenas(num.substring(1)); } } else {//por Ej. 099 //se quita el 0 antes de convertir a decenas return getDecenas(Integer.parseInt(num) + ""); } } private String getMiles(String numero) {// 999 999 //obtiene las centenas String c = numero.substring(numero.length() - 3); //obtiene los miles String m = numero.substring(0, numero.length() - 3); String n = ""; //se comprueba que miles tenga valor entero if (Integer.parseInt(m) > 0) { n = getCentenas(m); return n + "mil " + getCentenas(c); } else { return "" + getCentenas(c); } } private String getMillones(String numero) { //000 000 000 //se obtiene los miles String miles = numero.substring(numero.length() - 6); //se obtiene los millones String millon = numero.substring(0, numero.length() - 6); String n = ""; int mill = Integer.parseInt(millon); if (millon.length() > 1) { n = getCentenas(millon) + "millones "; } else { if (mill == 1) { n = getCentenas(millon) + "millon "; } if (mill > 1) { n = getCentenas(millon) + "millones "; } } return n + getMiles(miles); } } }
package calc; import static org.testng.Assert.assertEquals; import org.testng.annotations.Test; public class FibonacciTest { @Test public void testFibonacci() { Fibonacci myFibonacci = new Fibonacci(); assertEquals(myFibonacci.fibonacci(0), 0); assertEquals(myFibonacci.fibonacci(1), 1); assertEquals(myFibonacci.fibonacci(2), 1); assertEquals(myFibonacci.fibonacci(3), 2); assertEquals(myFibonacci.fibonacci(4), 3); assertEquals(myFibonacci.fibonacci(5), 5); } }
execute(registers, memory) { EFlags flags = registers.getEFlags(); if( flags.getCarryFlag().equals("1") ) { flags.setCarryFlag("0"); } else if ( flags.getCarryFlag().equals("0") ) { flags.setCarryFlag("1"); } }
package com.nikvay.saipooja_patient.view.adapter; import android.content.Context; import android.content.res.Resources; import android.support.v7.widget.CardView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.TextView; import com.nikvay.saipooja_patient.Interface.SelectDoctorInterface; import com.nikvay.saipooja_patient.R; import com.nikvay.saipooja_patient.model.ServiceModel; import java.util.ArrayList; public class CustomSpinnerServiceAdapter extends ArrayAdapter<ServiceModel> { private Context context; private ArrayList<ServiceModel> data; public Resources res; ServiceModel serviceModel =null; LayoutInflater inflater; CardView card_view; private SelectDoctorInterface selectServiceId; String service_id; public CustomSpinnerServiceAdapter(Context mContext, int textViewResourceId, ArrayList<ServiceModel> serviceNameArrayList, Resources res) { super(mContext, textViewResourceId, serviceNameArrayList); /********** Take passed values **********/ context = mContext; data = serviceNameArrayList; res = res; /*********** Layout inflator to call external xml layout () **********************/ inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } @Override public View getDropDownView(int position, View convertView, ViewGroup parent) { return getCustomView(position, convertView, parent); } @Override public View getView(int position, View convertView, ViewGroup parent) { return getCustomView(position, convertView, parent); } private View getCustomView(final int position, View convertView, ViewGroup parent) { View view = inflater.inflate(R.layout.activity_spinner_custom_adapter, parent, false); /***** Get each Model object from Arraylist ********/ serviceModel = null; serviceModel = (ServiceModel) data.get(position); TextView ServiceName = (TextView)view.findViewById(R.id.textServiceName); TextView ServiceDesc = (TextView)view.findViewById(R.id.textServiceDesc); card_view = view.findViewById(R.id.card_view); ImageView companyLogo = (ImageView)view.findViewById(R.id.image); if(position==0){ card_view.setVisibility(View.GONE); // Default selected Spinner item ServiceName.setText("Please select Service"); ServiceDesc.setText(""); } else { // Set values for spinner each row ServiceName.setText(serviceModel.getS_name()); ServiceDesc.setText(serviceModel.getDescription()); card_view.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { selectServiceId = (SelectDoctorInterface) context; service_id =data.get(position).getService_id(); selectServiceId.selectedServiceId(service_id); } }); } return view; } }
package com.ola.cabbooking.dto; import lombok.AccessLevel; import lombok.Getter; import lombok.Setter; import java.io.Serializable; @Getter @Setter public class AddressDto implements Serializable { @Getter(AccessLevel.NONE) @Setter(AccessLevel.NONE) private static final long serialVersionUID = 1L; private long id; //private String addressId; private String city; private String country; private String streetName; private String postalCode; private String type; }
package plp.orientadaObjetos1.declaracao.procedimento; import plp.expressions2.memory.VariavelJaDeclaradaException; import plp.expressions2.memory.VariavelNaoDeclaradaException; import plp.orientadaObjetos1.comando.Procedimento; import plp.orientadaObjetos1.excecao.declaracao.ClasseJaDeclaradaException; import plp.orientadaObjetos1.excecao.declaracao.ClasseNaoDeclaradaException; import plp.orientadaObjetos1.excecao.declaracao.ProcedimentoJaDeclaradoException; import plp.orientadaObjetos1.excecao.declaracao.ProcedimentoNaoDeclaradoException; import plp.orientadaObjetos1.expressao.leftExpression.Id; import plp.orientadaObjetos1.memoria.AmbienteCompilacaoOO1; /** * Interface que representa uma declaração de Procedimento. */ public interface DecProcedimento { /** * Retorna o procedimento a ser declarado na Declaração da Classe * @param id o identificador da declaracao de procedimento * @return o procedimento da declaração */ public Procedimento getProcedimento(Id nomeProcedimento) throws ProcedimentoNaoDeclaradoException; /** * Verifica se a declaração está bem tipada, ou seja, se a * expressão de inicialização está bem tipada. * @param ambiente o ambiente que contem o mapeamento entre identificadores * e seus tipos. * @return <code>true</code> se os tipos da declaração são válidos; * <code>false</code> caso contrario. */ public boolean checaTipo(AmbienteCompilacaoOO1 ambiente) throws VariavelJaDeclaradaException, VariavelNaoDeclaradaException, ProcedimentoJaDeclaradoException, ProcedimentoNaoDeclaradoException, ClasseNaoDeclaradaException,ClasseJaDeclaradaException; }
package com.example.demo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.core.env.Environment; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/") public class MyController { @Autowired private Environment env; @Value("${lucky-word}") private String luckyWord; private static final Logger logger=LoggerFactory.getLogger(MyController.class); @RequestMapping("/microservice-client") public String becomelucky() { logger.info("The server running in the port number is...."+env.getProperty("local.server.port")); return "your lucky word is:"+luckyWord; } }
package DTO; public class ColorDTO { private String colname; private String coltype; private String R; private String G; private String B; private String C; private String M; private String Y; private String K; public String getColname() { return colname; } public void setColname(String colname) { this.colname = colname; } public String getColtype() { return coltype; } public void setColtype(String coltype) { this.coltype = coltype; } public String getR() { return R; } public void setR(String r) { R = r; } public String getG() { return G; } public void setG(String g) { G = g; } public String getB() { return B; } public void setB(String b) { B = b; } public String getC() { return C; } public void setC(String c) { C = c; } public String getM() { return M; } public void setM(String m) { M = m; } public String getY() { return Y; } public void setY(String y) { Y = y; } public String getK() { return K; } public void setK(String k) { K = k; } }
/** * Created by jiang on 16/9/6. */ public class Test02 { public void b(){ } }
package com.tencent.mm.plugin.bottle.ui; import android.view.View; import android.widget.ImageView; import android.widget.TextView; public class a$a { public ImageView eCl; public TextView eTm; public TextView hkS; public TextView hkT; public ImageView hkU; public TextView hkV; public View hkW; public TextView hkX; }
import java.io.IOException; import java.net.*; //TestApp <peer_ap> <sub_protocol> <opnd_1> <opnd_2> public class TestApp { private static int port; private static String host; private static DatagramSocket clientSocket; private static InetAddress address; public static void main(String[] args) { String peerAccessPoint = args[0]; //host:port String operation = args[1].toUpperCase(); //operation if(!peerAccessPoint.contains(":")) { host = "localhost"; port = Integer.parseInt(peerAccessPoint); } else { host = peerAccessPoint.split(":")[0]; port = Integer.parseInt(peerAccessPoint.split(":")[1]); } try { address = InetAddress.getByName(host); clientSocket = new DatagramSocket(); } catch(SocketException e) { System.out.println("Error opening Socket in port " + port); e.printStackTrace(); } catch(UnknownHostException e) { System.out.println("Unknown host " + host); e.printStackTrace(); } switch(operation) { case Utils.BACKUP: checkUsage(operation, args); requestBackup(args[2], Integer.parseInt(args[3])); break; case Utils.RESTORE: checkUsage(operation, args); requestRestore(args[2]); break; case Utils.DELETE: checkUsage(operation, args); requestDelete(args[2]); break; case Utils.STATE: checkUsage(operation, args); requestState(); break; case Utils.RECLAIM: checkUsage(operation, args); requestReclaim(Integer.parseInt(args[2])); break; default: checkUsage("none", null); break; } clientSocket.close(); } private static void requestBackup(String filePath, int replicationDegree) { communicate("BACKUP "+filePath + " " + replicationDegree); } private static void requestRestore(String filePath) { communicate("RESTORE "+filePath + " "); } private static void requestDelete(String filePath) { communicate("DELETE "+filePath+" "); } private static void requestReclaim(int diskSpaceInKB) { communicate("RECLAIM "+diskSpaceInKB); } private static void requestState() { communicate("STATE "); } private static void communicate(String requestString) { // extracted method from request backup (might be helpful for other requests - less duplicated code) byte[] outgoingBuffer = requestString.getBytes(); byte[] incomingBuffer = new byte[256]; DatagramPacket requestPacket = new DatagramPacket(outgoingBuffer,outgoingBuffer.length, address, port); DatagramPacket responsePacket = new DatagramPacket(incomingBuffer, incomingBuffer.length); try { clientSocket.send(requestPacket); clientSocket.receive(responsePacket); System.out.println(Utils.byteArrayToString(responsePacket.getData())); //print answer } catch(IOException e) { e.printStackTrace(); } } private static void checkUsage(String operation, String[] testAppArgs) { switch(operation) { case Utils.BACKUP: if(testAppArgs.length != 4) printUsage(operation); break; case Utils.RESTORE: case Utils.RECLAIM: case Utils.DELETE: /* if(testAppArgs.length != 3) printUsage(operation);*/ break; case Utils.STATE: if(testAppArgs.length != 2) printUsage(operation); break; default: printUsage(operation); break; } } private static void printUsage(String operation) { switch(operation) { case Utils.BACKUP: System.out.println("\nUse 4 arguments for 'BACKUP' operation"); System.out.println("Follow this format:"); System.out.println("<Peer Access Point> BACKUP <Path to file> <Replication Degree>\n"); System.out.println("Examples:"); System.out.println("java TestApp 1923 backup path/to/file.pdf 2"); System.exit(-2); break; case Utils.RESTORE: System.out.println("\nUse 3 arguments for 'RESTORE' operation"); System.out.println("Follow this format:"); System.out.println("<Peer Access Point> RESTORE <Path to file>\n"); System.out.println("Examples:"); System.out.println("java TestApp 1923 restore path/to/file.pdf"); System.exit(-3); break; case Utils.DELETE: System.out.println("\nUse 3 arguments for 'DELETE' operation"); System.out.println("Follow this format:"); System.out.println("<Peer Access Point> DELETE <Path to file>\n"); System.out.println("Examples:"); System.out.println("java TestApp 1923 delete path/to/file.pdf"); System.exit(-4); break; case Utils.RECLAIM: System.out.println("\nUse 3 arguments for 'RECLAIM' operation"); System.out.println("Follow this format:"); System.out.println("<Peer Access Point> RECLAIM <Max disk space used (in KByte)>\n"); System.out.println("Examples:"); System.out.println("java TestApp 1923 reclaim 0"); System.exit(-5); break; case Utils.STATE: System.out.println("\nUse 2 arguments for 'STATE' operation"); System.out.println("Follow this format:"); System.out.println("<Peer Access Point> STATE\n"); System.out.println("Examples:"); System.out.println("java TestApp 1923 state"); System.exit(-6); break; default: System.out.println("\nInvalid requested operation."); System.out.println("Available operations:"); System.out.println("- Backup"); System.out.println("- Restore"); System.out.println("- Delete"); System.out.println("- Reclaim"); System.out.println("- State"); System.out.println("Found: " + operation); System.exit(-1); break; } } }
package com.example.practica311.ui.home; import androidx.lifecycle.LiveData; import androidx.lifecycle.MutableLiveData; import androidx.lifecycle.ViewModel; public class HomeViewModel extends ViewModel { private MutableLiveData<String> mText,nText,oText,qText,rText; public HomeViewModel() { mText = new MutableLiveData<>(); mText.setValue("Los elefantes o elefántidos " + "son una familia de mamíferos placentarios del " + "orden Proboscidea. Antiguamente se clasificaban," + " junto con otros mamíferos de piel gruesa, en el orden," + " ahora inválido, de los paquidermos. Existen hoy en día tres " + "especies y diversas subespecies"); nText=new MutableLiveData<>(); nText.setValue("El tigre es una de las especies de la subfamilia de los" + " panterinos pertenecientes al género Panthera. Se encuentra solamente en " + "el continente asiático; es un predador carnívoro y es la especie de félido más " + "grande del mundo junto con el león pudiendo alcanzar ambos un tamaño comparable " + "al de los fósiles de félidos de mayor tamaño."); oText=new MutableLiveData<>(); oText.setValue("Megaptera novaeangliae, también llamada yubarta o ballena jorobada es una " + "especie de cetáceo misticeto de la familia Balaenopteridae. Es uno de los rorcuales más " + "grandes, los adultos tienen una longitud de 12 a 16 m y un peso aproximado de 36.000 kg. La " + "especie posee una forma corporal distintiva, con aletas pectorales largas y cabeza nudosa. Es " + "un animal acrobático que con frecuencia se impulsa sobre la superficie para luego golpear el agua"); qText=new MutableLiveData<>(); qText.setValue("El ornitorrinco (Ornithorhynchus anatinus) es una especie de mamífero semiacuático " + "endémico del este de Australia y de la isla de Tasmania. Es una de las cinco especies —junto con " + "las cuatro de equidna— que perviven en la actualidad del orden de los monotremas, grupo que reúne" + " a los únicos mamíferos actuales que ponen huevos en lugar de dar a luz crías vivas."); rText=new MutableLiveData<>(); rText.setValue("Los delfines (Delphinidae), llamados también delfines oceánicos para distinguirlos de los " + "platanistoideos o delfines de río, son una familia de cetáceos odontocetos muy heterogénea, que " + "comprende 37 especies actuales. Miden entre 2 y 8 metros de largo, con el cuerpo fusiforme y la " + "cabeza de gran tamaño, el hocico alargado y solo un espiráculo en la parte superior de la cabeza"); } public LiveData<String> getText() { return mText; } }
/** * */ package pl.zezulka.game.rockpaperscissors.controller; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; import pl.zezulka.game.rockpaperscissors.core.IChoiceStrategy; import pl.zezulka.game.rockpaperscissors.service.IGameService; import pl.zezulka.game.rockpaperscissors.state.CurrentGame; /** * @author ania * */ @Controller @RequestMapping("/game") public class GameController { private static final Logger LOGGER = LoggerFactory.getLogger(GameController.class); private CurrentGame currentGame; private IGameService gameService; private IChoiceStrategy rockChoice; private IChoiceStrategy randomChoice; public GameController(IGameService gameService, @Qualifier("rockChoice") IChoiceStrategy rockChoice, @Qualifier("randomChoice") IChoiceStrategy randomChoice, CurrentGame currentGame) { super(); this.gameService = gameService; this.rockChoice = rockChoice; this.randomChoice = randomChoice; this.currentGame = currentGame; } @GetMapping() public ModelAndView game() { ModelAndView modelAndView = new ModelAndView("game"); modelAndView.addObject("rounds", currentGame.getGame().getRounds()); return modelAndView; } @PostMapping("/play") public String play() { LOGGER.info("Round played"); gameService.play(currentGame.getGame(), randomChoice.selectChoice(), rockChoice.selectChoice()); return "redirect:/game"; } @PostMapping("/restart") public String restart() { currentGame.restart(); return "redirect:/game"; } }
package Model; import Model.Exceptions.IllegalValueException; import java.util.Scanner; /** * Created by AndyTsang on 2017-08-25. */ public abstract class Converter { private String convertFrom; private String convertTo; private Double value; private Scanner input; public Converter(){ this.convertFrom = ""; this.convertTo = ""; this.value = 0.0; this.input = new Scanner(System.in); } public String getFrom(){ return convertFrom; } public String getTo(){ return convertTo; } public Double getValue(){ return value; } public void giveInput(){ System.out.println("Enter unit to convert from: "); this.convertFrom = input.nextLine(); System.out.println("Enter unit to convert to: "); this.convertTo = input.nextLine(); System.out.println("Enter the amount to convert: "); this.value = input.nextDouble(); input.nextLine(); } public abstract void unitsInfo(); public abstract double convert() throws IllegalValueException; public abstract boolean isValidUnit(String from, String to); }
package a.service; import java.util.HashMap; import java.util.List; import java.util.Map; import org.mybatis.spring.SqlSessionTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service public class JoinService { @Autowired SqlSessionTemplate template; public boolean register(Map map) { Map rst = new HashMap<>(); map.put("lv", 0); int r = template.insert("member.insertOne", map); /* * selectList로 뽑을 경우, null로 체크할 수 없다. * 이유는 List가 무조건 만들어지기 때문이다. 이 경우, size가 0이냐 아니냐로 체크해야 한다. * */ return r==1 ; } public Map errorChk(Map map) { Map error = new HashMap<>(); Map id = template.selectOne("member.checkId", (String)map.get("id")); Map mail = template.selectOne("member.checkMail", (String)map.get("mail")); if(id != null) error.put("id", "이미 존재하는 ID 입니다."); if(mail != null) error.put("mail", "이미 존재하는 e-mail 입니다."); return error; } public boolean mailChk(String mail) { Map map = template.selectOne("member.checkMail", mail); boolean rst = false; if(map == null) rst = true; return rst; } public boolean idChk(String id) { Map map = template.selectOne("member.checkId", id); boolean rst = false; if(map == null) rst = true; return rst; } }
package com.tencent.mm.pluginsdk.ui.chat; import com.tencent.mm.R; import com.tencent.mm.bp.a; class ChatFooter$16 implements Runnable { final /* synthetic */ ChatFooter qMv; ChatFooter$16(ChatFooter chatFooter) { this.qMv = chatFooter; } public final void run() { if (ChatFooter.D(this.qMv) != null) { ChatFooter.D(this.qMv).dismiss(); ChatFooter.E(this.qMv).setVisibility(0); ChatFooter.F(this.qMv).setVisibility(8); ChatFooter.G(this.qMv).setVisibility(8); ChatFooter.w(this.qMv).setVisibility(8); ChatFooter.v(this.qMv).setVisibility(0); } ChatFooter.r(this.qMv).setBackgroundDrawable(a.f(this.qMv.getContext(), R.g.record_shape_normal)); ChatFooter.r(this.qMv).setText(R.l.chatfooter_presstorcd); ChatFooter.d(this.qMv, false); ChatFooter.c(this.qMv, false); } }
import java.util.ArrayList; import java.util.List; public class Main { private static int globalCounter = 0; private static final Object obj = new Object(); public static void main(String[] args) { List<Thread> threads = new ArrayList<>(); ThreadGroup group = new ThreadGroup("Group1"); for (int i = 1; i<=1000; i++) { Thread t = new Thread(group, new MyThread()); t.start(); threads.add(t); } group.interrupt(); threads.forEach(t -> { try { t.join(); } catch (InterruptedException e) { e.printStackTrace(); } }); System.out.println("Total = " + globalCounter); } static class MyThread implements Runnable { @Override public void run() { try { Thread.sleep(99999); } catch (InterruptedException e) { } synchronized (obj) { globalCounter++; } // int localCounter = globalCounter; // localCounter = localCounter + 1; // globalCounter = localCounter; } private static void staticIncrement() { synchronized (MyThread.class) { } } private void increment() { synchronized (this) { } } } }
package edu.courtneyrae23berkeley.represent; import android.app.Service; import android.content.Intent; import android.os.Bundle; import android.os.IBinder; import android.os.SystemClock; import android.util.Log; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.wearable.MessageApi; import com.google.android.gms.wearable.Node; import com.google.android.gms.wearable.NodeApi; import com.google.android.gms.wearable.Wearable; import java.util.ArrayList; /** * Created by court_000 on 2/28/2016. */ public class PhoneToWatchService extends Service { private GoogleApiClient mApiClient; ArrayList<String> repNames; ArrayList<String> parties; ArrayList<String> repNums; ArrayList<String> rep_sen; String votes; String location; String stateVotes; @Override public void onCreate() { super.onCreate(); //initialize the googleAPIClient for message passing mApiClient = new GoogleApiClient.Builder( this ) .addApi( Wearable.API ) .addConnectionCallbacks(new GoogleApiClient.ConnectionCallbacks() { @Override public void onConnected(Bundle connectionHint) { } @Override public void onConnectionSuspended(int cause) { } }) .build(); } @Override public void onDestroy() { super.onDestroy(); mApiClient.disconnect(); } @Override public int onStartCommand(Intent intent, int flags, int startId) { // Which cat do we want to feed? Grab this info from INTENT // which was passed over when we called startService Bundle b = intent.getExtras(); repNames = b.getStringArrayList("repNames"); repNums = b.getStringArrayList("repNums"); rep_sen = b.getStringArrayList("Rep_Sen"); parties = b.getStringArrayList("parties"); location = b.getString("location"); votes = b.getString("votes"); stateVotes = b.getString("stateVotes"); Log.d("T", "in PhoneToWatch!!"); // Send the message with the cat name new Thread(new Runnable() { @Override public void run() { //first, connect to the apiclient mApiClient.connect(); String repDel = ""; String partyDel = ""; String repNumDel = ""; String repOrSen = ""; for (int i = 0; i < repNames.size(); i++) { repDel = repDel + repNames.get(i) + ","; } sendMessage("/sendName", repDel); for (int i = 0; i < rep_sen.size(); i++) { repOrSen = repOrSen + rep_sen.get(i) + ","; } sendMessage("/sendRepSen", repOrSen); for (int i = 0; i < parties.size(); i++) { partyDel = partyDel + parties.get(i) + ","; } sendMessage("/sendParty", partyDel); for (int i = 0; i < repNums.size(); i++) { repNumDel = repNumDel + repNums.get(i) + ","; } sendMessage("/sendNums", repNumDel); sendMessage("/sendVotes", votes); sendMessage("/sendStateVotes", stateVotes); sendMessage("/location", location); try { Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } sendMessage("/startMain", ""); } }).start(); return START_STICKY; } @Override //remember, all services need to implement an IBinder public IBinder onBind(Intent intent) { return null; } private void sendMessage( final String path, final String text ) { //one way to send message: start a new thread and call .await() //see watchtophoneservice for another way to send a message new Thread( new Runnable() { @Override public void run() { NodeApi.GetConnectedNodesResult nodes = Wearable.NodeApi.getConnectedNodes( mApiClient ).await(); for(Node node : nodes.getNodes()) { //we find 'nodes', which are nearby bluetooth devices (aka emulators) //send a message for each of these nodes (just one, for an emulator) MessageApi.SendMessageResult result = Wearable.MessageApi.sendMessage( mApiClient, node.getId(), path, text.getBytes() ).await(); //4 arguments: api client, the node ID, the path (for the listener to parse), //and the message itself (you need to convert it to bytes.) } } }).start(); } }
package lando.systems.ld36.entities; import com.badlogic.gdx.utils.Array; import lando.systems.ld36.ai.StateMachine; import lando.systems.ld36.ai.Transition; import lando.systems.ld36.ai.conditions.NearScreenCondition; import lando.systems.ld36.ai.states.ChaseAvoidState; import lando.systems.ld36.ai.states.WaitState; import lando.systems.ld36.levels.Level; import lando.systems.ld36.utils.Assets; public class SDHard extends SDMedium { public SDHard(Level level, float x, float y) { super(level, x, y); walkAnimation = Assets.sdWalkHard; attackAnimation = Assets.sdAttackHard; tex = walkAnimation.getKeyFrame(timer); health = maxHealth = 10; attackPower = 30; } public void initializeStates(){ // States enemy can have WaitState wait = new WaitState(this); ChaseAvoidState chase = new ChaseAvoidState(this); // Conditions NearScreenCondition nearCond = new NearScreenCondition(level.screen.camera, this); // Transitions Array<Transition> transitions = new Array<Transition>(); transitions.add(new Transition(wait, nearCond, chase)); // Create State Machine stateMachine = new StateMachine(wait, transitions); addDieState(); } }
/* * UserController.java * This file was last modified at 2018.12.03 20:05 by Victor N. Skurikhin. * $Id$ * This is free and unencumbered software released into the public domain. * For more information, please refer to <http://unlicense.org> */ package ru.otus.db.dao.jdbc; import ru.otus.db.Executor; import ru.otus.db.ResultHandler; import ru.otus.exeptions.ExceptionSQL; import ru.otus.exeptions.ExceptionThrowable; import ru.otus.models.UserEntity; import javax.sql.DataSource; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Consumer; public class UserController extends AbstractController<UserEntity, Long> { public static final String SELECT_ALL = "SELECT id, login, password FROM users"; public static final String SELECT_BY_ID = SELECT_ALL + " WHERE id = ?"; public static final String INSERT = "INSERT INTO users (id, login, password) VALUES (?, ?, ?)"; public static final String UPDATE = "UPDATE users SET login = ?, password = ? WHERE id = ?"; public static final String DELETE = "DELETE FROM users WHERE id = ?"; UserController(DataSource dataSource) { super(dataSource); } private UserEntity setUserEntity(UserEntity entity, ResultSet resultSet) throws ExceptionSQL { try { entity.setId(resultSet.getLong("id")); entity.setLogin(resultSet.getString("login")); entity.setPassword(resultSet.getString("password")); } catch (SQLException e) { throw new ExceptionSQL(e); } return entity; } private UserEntity getUserEntity(ResultSet resultSet) throws ExceptionSQL { UserEntity entity = new UserEntity(); setUserEntity(entity, resultSet); return entity; } @Override public List<UserEntity> getAll() throws ExceptionThrowable { try { return getArrayListAll(SELECT_ALL, this::getUserEntity); } catch (SQLException | ExceptionSQL e) { throw new ExceptionThrowable(e); } } @Override public UserEntity getEntityById(Long id) throws ExceptionThrowable { AtomicBoolean exists = new AtomicBoolean(false); final UserEntity result = new UserEntity(); ResultHandler handler = resultSet -> { if (resultSet.next()) { UserController.this.setUserEntity(result, resultSet); exists.set(true); } }; execQueryEntityById(SELECT_BY_ID, handler, getConsumerLongId(id)); return exists.get() ? result : null; } public Consumer<PreparedStatement> getConsumerInsertUserEntity(UserEntity entity) { return preparedStatement -> { try { preparedStatement.setLong(1, entity.getId()); preparedStatement.setString(2, entity.getLogin()); preparedStatement.setString(3, entity.getPassword()); } catch (SQLException e) { throw new ExceptionSQL(e); } }; } public Consumer<PreparedStatement> getConsumerUpdateUserEntity(UserEntity entity) { return preparedStatement -> { try { preparedStatement.setString(1, entity.getLogin()); preparedStatement.setString(2, entity.getPassword()); preparedStatement.setLong(3, entity.getId()); } catch (SQLException e) { throw new ExceptionSQL(e); } }; } @Override public UserEntity update(UserEntity entity) throws ExceptionThrowable { try { Executor executor = new Executor(getDataSource().getConnection()); if (executor.execUpdate(UPDATE, getConsumerUpdateUserEntity(entity)) < 1) { throw new SQLException("Error SQL update!"); } return entity; } catch (SQLException | ExceptionSQL e) { throw new ExceptionThrowable(e); } } @Override public boolean delete(Long id) throws ExceptionThrowable { return delete(DELETE, id); } @Override public boolean create(UserEntity entity) throws ExceptionThrowable { try { Executor executor = new Executor(getDataSource().getConnection()); int count = executor.execUpdate(INSERT, getConsumerInsertUserEntity(entity)); return count > 0; } catch (SQLException | ExceptionSQL e) { throw new ExceptionThrowable(e); } } } /* vim: syntax=java:fileencoding=utf-8:fileformat=unix:tw=78:ts=4:sw=4:sts=4:et */ //EOF
package com.tencent.mm.vfs; import java.io.FilterOutputStream; public final class e extends FilterOutputStream { public e(b bVar) { super(d.b(bVar.aMJ, bVar.cBU())); } }
package app0511.chat; import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.JTextField; public class ChatClientA extends JFrame{ JButton bt_open;//대화 상대방을 띄우기 위한 버튼 JTextArea area; JScrollPane scroll; JTextField t_input; JButton bt; public ChatClientA() { //생성 bt_open=new JButton("열기"); area=new JTextArea(); scroll=new JScrollPane(area); t_input=new JTextField(20); bt=new JButton("전송"); //스타일,레이아웃 this.setLayout(new FlowLayout()); scroll.setPreferredSize(new Dimension(280,280)); area.setBackground(new Color(250,255,0)); //조립 this.add(bt_open); this.add(scroll);//area를 scroll이 잡아먹기 때문에 scroll만 부착해도 됨! this.add(t_input); this.add(bt); //이벤트 리스너와의 연결 //특히 이벤트리스너가 연결된 컴포넌트를 가리켜 이벤트 소스라 한다! ClientAEvent ce=null;//지역변수는 자옫응로 초기화되지 않으므로, 개발자가 반드시 초기화하는 습관을 가져야함 bt.addActionListener(ce=new ClientAEvent()); bt_open.addActionListener(ce); t_input.addKeyListener(ce); //ce에 t_input 전달하기 ce.setT_input(t_input);//call by reference ce.setArea(area); ce.setBt(bt); ce.setBt_open(bt_open); //보여주기 this.setBounds(300, 100, 350, 400); this.setVisible(true); this.setDefaultCloseOperation(EXIT_ON_CLOSE); } public static void main(String[] args) { new ChatClientA(); } }
package com.appsnipp.homedesign2.Activity; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import androidx.fragment.app.Fragment; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.Color; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.util.Log; import android.view.MenuItem; import android.view.View; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.TextView; import com.appsnipp.homedesign2.Adapter.NewsArrayAdapter; import com.appsnipp.homedesign2.Entity.News; import com.appsnipp.homedesign2.R; import com.bumptech.glide.Glide; import com.bumptech.glide.request.target.SimpleTarget; import com.bumptech.glide.request.transition.Transition; import com.google.android.material.bottomnavigation.BottomNavigationView; import com.google.firebase.database.ChildEventListener; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import java.util.ArrayList; import java.util.UUID; public class NewsActivity extends AppCompatActivity { private static final int MODE_DARK = 0; private static final int MODE_LIGHT = 1; DatabaseReference reference; BottomNavigationView bottomNavigationView; public ArrayList<News> _newsList; private NewsArrayAdapter _newsArrayAdapter; News _selectedNews; private ListView _newsListView; private TextView _selectedNewsDate; private TextView _selectedNewsTitle; private TextView _selectedNewsShortDes; private TextView _selectedNewsAuthorName; private ImageView _selectedNewsAuthorImage; private BottomNavigationView _bottomNavigationView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_news); initComponents(); _newsList = new ArrayList<>(); // initData(); loadData(); setUpBottomNav(); } private void initData() { FirebaseDatabase database = FirebaseDatabase.getInstance(); reference = database.getReference("News"); String uniqueID = UUID.randomUUID().toString(); News news1 = new News(uniqueID,"Aug. 14, 2020, at 12:37 p.m", "Keto-Friendly Sweeteners", "Elaine K. Howley", "These sugar-alternatives are compatible with the ketogenic diet.", "", "", "https://health.usnews.com/wellness/food/articles/keto-friendly-sweeteners"); reference.push().setValue(news1); } private void setUpBottomNav() { bottomNavigationView = findViewById(R.id.navigation); bottomNavigationView.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener); bottomNavigationView.setSelectedItemId(R.id.navigation1); } private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener = new BottomNavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(@NonNull MenuItem item) { Fragment fragment; switch (item.getItemId()) { case R.id.navigation1: return true; case R.id.navigation2: Intent news = new Intent(NewsActivity.this, DietActivity.class); startActivity(news); return true; case R.id.navigation3: Intent home = new Intent(NewsActivity.this, MainActivity.class); startActivity(home); return true; case R.id.navigation4: Intent songs = new Intent(NewsActivity.this, ListSongActivity.class); startActivity(songs); return true; case R.id.navigation5: Intent setting = new Intent(NewsActivity.this, SettingActivity.class); startActivity(setting); return true; } return false; } }; public void loadData() { FirebaseDatabase database = FirebaseDatabase.getInstance(); DatabaseReference ref = database.getReference("News"); ref.keepSynced(true); setUpNewsListView(); _newsArrayAdapter.notifyDataSetChanged(); // if (!_newsList.isEmpty() && _newsList != null) { // _selectedNews = _newsList.get(0); // setUpStartingSelectedNews(_selectedNews); // } ref.addChildEventListener(new ChildEventListener() { @Override public void onChildAdded(@NonNull DataSnapshot snapshot, @Nullable String previousChildName) { News theNew = snapshot.getValue(News.class); _newsList.add(theNew); _newsArrayAdapter.notifyDataSetChanged(); if (_newsList.size() > 0) { _selectedNews = _newsList.get(0); setUpStartingSelectedNews(_selectedNews); } _newsList.trimToSize(); } @Override public void onChildChanged(@NonNull DataSnapshot snapshot, @Nullable String previousChildName) { News news = snapshot.getValue(News.class); for (int i = 0; i < _newsList.size(); ++i) { if (_newsList.get(i).getId().equals(news.getId())) { _newsList.set(i, news); _newsArrayAdapter.notifyDataSetChanged(); break; } _newsArrayAdapter.notifyDataSetChanged(); } } @Override public void onChildRemoved(@NonNull DataSnapshot snapshot) { News news = snapshot.getValue(News.class); for (News item : _newsList) { if (item.getId().equals(news.getId())) { _newsList.remove(item); _newsArrayAdapter.notifyDataSetChanged(); break; } _newsArrayAdapter.notifyDataSetChanged(); } } @Override public void onChildMoved(@NonNull DataSnapshot snapshot, @Nullable String previousChildName) { } @Override public void onCancelled(@NonNull DatabaseError error) { } }); // _newsList.add(new News("Aug. 20, 2020, at 12:06 p.m", // "Orlando Hospital Cook Honors Health Care Heroes With Portraits", // "K. Aleisha Fetters", // "The self-taught artist used a special technique to burn the images of six health workers into plywood.\n", // "sss", // "kkk", // "https://health.usnews.com/hospital-heroes/articles/orlando-hospital-cook-honors-health-care-heroes-with-portraits")); // _newsList.add(new News("Aug. 19, 2020, at 2:52 p.m.", // "Noom vs. Mediterranean Diet: What's the Difference?", // "Elaine K. Howley", // "Both take a holistic approach to being and eating healthy.", // R.drawable.author_3, // R.drawable.background_3, // "https://health.usnews.com/wellness/compare-diets/articles/noom-vs-mediterranean-diet-whats-the-difference")); // // _newsList.add(new News("Aug. 17, 2020, at 2:23 p.m.", // "8 Healthy Drinks Rich in Electrolytes", // "Ruben Castaneda", // "The self-taught artist used a special technique to burn the images of six health workers into plywood.\n", // R.drawable.author_4, // R.drawable.background_4, // "https://health.usnews.com/wellness/slideshows/healthy-drinks-rich-in-electrolytes")); // // _newsList.add(new News("Feb. 20, 2020, at 12:06 p.m", // "Does coffee raise blood pressure?", // "Louisa Richards", // "Research about coffee and blood pressure is conflicting. It seems that how often a person drinks coffee could influence its effect on blood pressure", // R.drawable.author_1, // R.drawable.background_1, // "https://www.medicalnewstoday.com/articles/does-coffee-raise-blood-pressure#does-it")); // // _newsList.add(new News("Aug. 20, 2020, at 4:02 p.m", // "Good Fats vs. Bad Fats for Healthy Heart", // "David Levine", // "Knowing the difference can make all the difference in cardiovascular health.", // R.drawable.author_7, // R.drawable.background_7, // "https://health.usnews.com/wellness/articles/good-fats-vs-bad-fats-healthy-heart")); // // _newsList.add(new News("Aug. 14, 2020, at 11:58 a.m.", // "Is Your Quarantine Diet Hurting Your Health?", // "Heidi Godman", // "Eating the wrong foods can increase your risks for weight gain and chronic disease.", // R.drawable.author_5, // R.drawable.background_5, // "https://health.usnews.com/wellness/food/articles/is-your-quarantine-diet-hurting-your-health")); // // _newsList.add(new News("Aug. 14, 2020, at 12:37 p.m", // "Keto-Friendly Sweeteners", // "Elaine K. Howley", // "These sugar-alternatives are compatible with the ketogenic diet.", // R.drawable.author_6, // R.drawable.background_6, // "https://health.usnews.com/wellness/food/articles/keto-friendly-sweeteners")); // Log.d("UAA", "onDataChange: " + _newsList.size()); // if (!_newsList.isEmpty()) { // _selectedNews = _newsList.get(0); // } } private void setUpNewsListView() { _newsListView = findViewById(R.id.newsListView); _newsArrayAdapter = new NewsArrayAdapter(this, R.layout.news_row_layout, _newsList); _newsArrayAdapter.setOnNewsClickInterface(new NewsArrayAdapter.OnNewsClickInterface() { @Override public void onNewsAdapterClick(News selectedNews) { _selectedNews = selectedNews; setUpStartingSelectedNews(selectedNews); } }); _newsListView.setAdapter(_newsArrayAdapter); } private void setUpStartingSelectedNews(News selectedNews) { _selectedNewsShortDes.setText(selectedNews.getShortDes()); _selectedNewsAuthorName.setText(selectedNews.getAuthor()); _selectedNewsDate.setText(selectedNews.getDate()); _selectedNewsTitle.setText(selectedNews.getTitle()); Glide.with(getApplicationContext()) .load(selectedNews.getAuthorPhotoId()) .into(_selectedNewsAuthorImage); final LinearLayout selectedNewsWrapper = findViewById(R.id.selectedNewsWrapper); if (selectedNews.getShortDes().length() > 40) { Glide.with(getApplicationContext()) .load(selectedNews.getBackgroundPhotoId()) .into(new SimpleTarget<Drawable>() { @Override public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) { selectedNewsWrapper.setBackground(resource); } }); } } private void initComponents() { _selectedNewsAuthorImage = findViewById(R.id.selectedNewsAuthorImage); _selectedNewsAuthorName = findViewById(R.id.selectedNewsAuthorName); _selectedNewsTitle = findViewById(R.id.selectedNewsTitle); _selectedNewsDate = findViewById(R.id.selectedNewsDate); _selectedNewsShortDes = findViewById(R.id.selectedNewsShortDes); } public void startingNews_onClick(View view) { Intent intent = new Intent(NewsActivity.this, WebViewActivity.class); intent.putExtra("url", _selectedNews.getUri()); startActivity(intent); } }
import java.util.Scanner; public class Problem5_43 { public static void main(String[] args) { int count = 0;//Count the number of combinations //Display all possible combination for //numbers from 1 to 7 for(int number1 = 1; number1 <= 7; number1 ++) { for(int number2 = number1 + 1; number2 <= 7; number2 ++) { System.out.println(number1 + " " + number2); count++; } } //Display output System.out.println("The total number of all combinations is " +count); } }
package fr.doranco.ecommerce.metier; import java.util.List; import java.util.Set; import javax.persistence.Convert; import fr.doranco.ecommerce.entity.dto.AdresseDto; import fr.doranco.ecommerce.entity.pojo.Adresse; import fr.doranco.ecommerce.entity.pojo.Utilisateur; import fr.doranco.ecommerce.model.dao.AdresseDao; import fr.doranco.ecommerce.model.dao.IAdresseDao; import fr.doranco.ecommerce.model.dao.UtilisateurDao; public class AdresseMetier implements IAdresseMetier { IAdresseDao adresseDao = new AdresseDao(); public AdresseMetier() { } @Override public void addAdresse(AdresseDto adresseDto, Integer idUtilisateur) throws Exception { Adresse adresse = new Adresse(); adresse.setNumero(Integer.parseInt(adresseDto.getNumero())); adresse.setRue(adresseDto.getRue().toUpperCase()); adresse.setVille(adresseDto.getVille().toUpperCase()); adresse.setCodePostal(adresseDto.getCodePostal()); UtilisateurDao utilisateurDao = new UtilisateurDao(); Utilisateur utilisateur = utilisateurDao.get(Utilisateur.class, idUtilisateur); adresse.setUtilisateur(utilisateur); adresseDao.add(adresse); } @Override public Adresse getAdresseById(Integer id) throws Exception { return adresseDao.get(Adresse.class, id); } @Override public void updateAdresse(AdresseDto adresseDto) throws Exception { Adresse adresse = new Adresse(); adresseDao.update(adresse); } @Override public void removeAdresse(Adresse adresse) throws Exception { adresseDao.remove(adresse); } @Override public List<Adresse> getAdressesUtilisateur(Integer idUtilisateur) throws Exception { return adresseDao.getAdressesUtilisateur(idUtilisateur); } }
package ctci.ArraysAndStrings; /** * Created by jtomjob on 7/12/2017. */ public class isSubString { public static void main(String[] args) { String s1 = "waterbottle"; String s2 = "erbottlewathhh"; isSubString f = new isSubString(); boolean result = f.SubString(s1+s1,s2); System.out.println(result); } public boolean SubString(String s1, String s2){ if(s1.length()/2 == s2.length() && s2.length()>0){ if(s1.contains(s2)){ return true; } } return false; } }
package com.wentongwang.mysports.views.activity.splash; import com.wentongwang.mysports.base.BaseView; /** * Created by Wentong WANG on 2017/3/27. */ public interface SplashView extends BaseView { void goToLogin(); void goToHomeActivity(); }
package ba.bitcamp.LabS12D04.vjezbe.xpath; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.util.LinkedList; public class PersonTest { public static void main(String[] args) { Person a = new Person("Neldin", "Dzekovic", 22); a.addChild(new Person("Edin", "Dzeko", 3)); a.addChild(new Person("Edina", "Dzeko", 2)); Person b = new Person("Haris", "Arifovic", 23); b.addChild(new Person("Neldin", "Arifovic", 5)); b.addChild(new Person("Benjamin", "Arifovic", 4)); b.addChild(new Person("Amra", "Arifovic", 3)); Person c = new Person("Naida", "Dervishalidovic", 29); Person d = new Person("Mustafa", "Ademovic", 22); d.addChild(new Person("Amer", "Ademovic", 3)); d.addChild(new Person("Adnan", "Ademovic", 3)); d.addChild(new Person("Abid", "Ademovic", 2)); d.addChild(new Person("Amar", "Ademovic", 2)); d.addChild(new Person("Armin", "Ademovic", 2)); d.addChild(new Person("Asim", "Ademovic", 1)); Person e = new Person("Gordan", "Sajevic", 25); e.addChild(new Person("Lasko", "Sajevic", 7)); e.addChild(new Person("Karlovacko", "Sajevic", 7)); e.addChild(new Person("Sarajevsko", "Sajevic", 7)); // System.out.println(a.toString()); // System.out.println(b.toString()); // System.out.println(c.toString()); // System.out.println(d.toString()); // System.out.println(e.toString()); LinkedList<Person> people = new LinkedList<Person>(); people.add(a); people.add(b); people.add(c); people.add(d); people.add(e); try { Person.personToXMl(people, new FileOutputStream("./XML/people.xml")); } catch (FileNotFoundException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } }
package kr.or.ddit.basic; import java.util.*; /* * 문제) 학번, 이름, 국어점수, 영어점수, 수학점수, 총점, 등수를 멤버로 갖는 * Student클래스를 만든다. * 생성자는 학번, 이름, 국어, 영어, 수학 점수만 매개변수로 받아서 처리한다. * * 이 Student객체들은 List에 저장하여 관리한다. * List에 저장된 데이터들을 학번의 오름차순으로 정렬하여 출력하는 부분과 총점의 역순으로 정렬하는 부분을 프로그램 하시오. * (총점이 같으면 학번의 내림차순으로 정렬되도록 한다.) * (학번 정렬기준은 Student클래스 자체에서 제공하도록 하고, 총점 정렬기준은 외부클래스에서 제공하도록 한다.) */ public class T08_StudentTest { public static void main(String[] args) { List<Student> memList = new ArrayList<Student>(); memList.add(new Student(102,"성춘향", 40, 65, 55)); memList.add(new Student(109,"이순신", 95, 80, 75)); memList.add(new Student(104,"변학도", 65, 70, 82)); memList.add(new Student(101,"홍길동", 80, 45, 65)); memList.add(new Student(106,"고길동", 45, 65, 80)); for (int i =0; i<memList.size(); i++) { memList.get(i).setRank(1); for (int j=0; j<memList.size(); j++) { if(memList.get(i).getSum() < memList.get(j).getSum()) { memList.get(i).setRank(memList.get(i).getRank() +1) ; } } } System.out.println("정렬 전"); for(Student mem : memList) { System.out.println(mem); } System.out.println("-------------------------------"); Collections.sort(memList); //정렬하기 System.out.println("정렬 후"); for(Student mem : memList) { System.out.println(mem); } System.out.println("-------------------------------"); Collections.sort(memList, new SortSumDesc()); System.out.println("총점 내림차순 정렬 후"); for(Student mem : memList) { System.out.println(mem); } System.out.println("-------------------------------"); } } class SortSumDesc implements Comparator<Student>{ @Override public int compare(Student mem1, Student mem2) { if(mem1.getSum() > mem2.getSum()) { return -1; }else if(mem1.getSum() == mem2.getSum()) { return Integer.compare(mem1.getNum(), mem2.getNum())*-1; //등수가 같을 때 학번내림차순정렬 }else { return 1; } // return new Integer(mem1.getSum()).compareTo(mem2.getSum())*-1; } } class Student implements Comparable<Student>{ private int num; //학번 private String name; //이름 private int kor; //국어점수 private int eng; //영어점수 private int math; //수학점수 private int sum; //총점 private int rank; //등수 public Student(int num, String name, int kor, int eng, int math) { super(); this.num = num; this.name = name; this.kor = kor; this.eng = eng; this.math = math; this.sum = kor+eng+math; } public int getNum() { return num; } public void setNum(int num) { this.num = num; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getKor() { return kor; } public void setKor(int kor) { this.kor = kor; } public int getEng() { return eng; } public void setEng(int eng) { this.eng = eng; } public int getMath() { return math; } public void setMath(int math) { this.math = math; } public int getSum() { return sum; } public void setSum(int sum) { this.sum = sum; } public int getRank() { return rank; } public void setRank(int rank) { this.rank = rank; } @Override public String toString() { return "Member[학번=" + num + ", 이름=" + name + ", 국어=" + kor + ", 영어=" + eng + ", 수학=" + math + ", 총점=" + sum + ", 등수=" + rank + "]"; } @Override public int compareTo(Student mem) { return Integer.compare(getNum(), mem.getNum()); } }
package Commons; public class SourcePath { public static final String ROOM_CSV = "src/Data/Room.csv"; public static final String HOUSE_CSV = "src/Data/House.csv"; public static final String VILLA_CSV = "src/Data/Villa.csv"; public static final String CUSTOMER_CSV = "src/Data/Customer.csv"; public static final String BOOKING_CSV = "src/Data/Booking.csv"; public static final String EMPLOYEE_CSV = "src/Data/Employee.csv"; public static final String COMMA = ","; public static final char LINE_BREAKER = '\n'; public static final String ARR_CUSTOMER_TXT = "src/Data/arrCustomer.txt"; public static final String ARR_VILLA_TXT = "src/Data/arrVilla.txt"; public static final String ARR_HOUSE_TXT = "src/Data/arrHouse.txt"; public static final String ARR_ROOM_TXT = "src/Data/arrRoom.txt"; public static final String ARR_BOOKING_TXT = "src/Data/arrBooking.txt"; public static final String TREE_EMPLOYEE_TXT = "src/Data/treeEmployee.txt"; public static final String TICKET_TXT = "src/Data/Ticket.txt"; }
package com.tencent.mm.plugin.wallet_core.ui; import android.app.Dialog; import android.content.Intent; import android.os.Bundle; import android.text.TextUtils; import android.view.KeyEvent; import android.view.View.OnLongClickListener; import android.widget.LinearLayout; import android.widget.ScrollView; import android.widget.TextView; import android.widget.Toast; import com.tencent.mm.ab.l; import com.tencent.mm.bg.d; import com.tencent.mm.g.a.al; import com.tencent.mm.g.a.io; import com.tencent.mm.kernel.g; import com.tencent.mm.model.am; import com.tencent.mm.model.am.b; import com.tencent.mm.plugin.report.service.h; import com.tencent.mm.plugin.wallet_core.c.n; import com.tencent.mm.plugin.wallet_core.c.y; import com.tencent.mm.plugin.wallet_core.c.z; import com.tencent.mm.plugin.wallet_core.id_verify.util.RealnameGuideHelper; import com.tencent.mm.plugin.wallet_core.model.Orders; import com.tencent.mm.plugin.wallet_core.model.Orders.Commodity; import com.tencent.mm.plugin.wallet_core.model.Orders.Promotions; import com.tencent.mm.plugin.wallet_core.model.o; import com.tencent.mm.plugin.wxpay.a$b; import com.tencent.mm.plugin.wxpay.a$f; import com.tencent.mm.plugin.wxpay.a$g; import com.tencent.mm.plugin.wxpay.a.i; import com.tencent.mm.pluginsdk.wallet.PayInfo; import com.tencent.mm.sdk.b.c; import com.tencent.mm.sdk.platformtools.bi; import com.tencent.mm.sdk.platformtools.x; import com.tencent.mm.storage.aa; import com.tencent.mm.storage.ab; import com.tencent.mm.ui.base.MaxListView; import com.tencent.mm.ui.base.a; import com.tencent.mm.wallet_core.c.j; import com.tencent.mm.wallet_core.c.q; import com.tencent.mm.wallet_core.ui.e; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; @a(3) public class WalletOrderInfoOldUI extends WalletOrderInfoUI { protected boolean bHS = true; protected boolean bHT = false; protected boolean bHU = false; protected String gtX = null; protected String lJJ; private c lLY = new 5(this); protected String lPn = null; protected String mAppId = ""; private String mBW; protected PayInfo mCn; public Orders pfb; protected boolean ptd = false; private HashMap<String, b> pti = new HashMap(); protected String ptj; public Set<String> pvK = null; public List<Commodity> pvL = null; private boolean pwA = false; public b.a pwB = new 6(this); private OnLongClickListener pwC = new 11(this); private c pwg = new 3(this); protected LinearLayout pwr = null; protected TextView pws = null; protected TextView pwt = null; public a pwu = null; protected String pwv = null; protected HashMap<String, TextView> pww = new HashMap(); protected c pwx; protected Map<Long, String> pwy = new HashMap(); private d pwz; protected final int getLayoutId() { return a$g.wallet_order_info; } private void Wj() { int i = 1; com.tencent.mm.wallet_core.c af = com.tencent.mm.wallet_core.a.af(this); this.mCn = (PayInfo) this.sy.getParcelable("key_pay_info"); this.lJJ = this.sy.getString("key_trans_id"); this.sy.getInt("key_pay_type", -1); x.i("MicroMsg.WalletOrderInfoOldUI", "mTransId %s", new Object[]{this.lJJ}); this.pfb = bQo(); if (this.pfb != null) { ux(0); c(this.pfb); if (!(af == null || this.pfb == null || this.mCn == null)) { boolean z; this.mAppId = this.mCn.appId; boolean cCT = af.cCT(); com.tencent.mm.plugin.wallet_core.e.c.b(this, this.sy, 7); int i2 = this.sy.getInt("key_support_bankcard", 1) == 2 ? 2 : 1; h hVar = h.mEJ; Object[] objArr = new Object[7]; objArr[0] = Integer.valueOf(this.mCn.bVY); if (this.mCn.bVY == 3) { z = true; } else { z = false; } objArr[1] = Boolean.valueOf(z); if (!cCT) { i = 2; } objArr[2] = Integer.valueOf(i); objArr[3] = Integer.valueOf(q.cDg()); objArr[4] = Integer.valueOf((int) (this.pfb.mBj * 100.0d)); objArr[5] = this.pfb.lNV; objArr[6] = Integer.valueOf(i2); hVar.h(10691, objArr); } if (!((o.bOW().bPs() || af == null || !af.cCT()) && com.tencent.mm.model.q.GO())) { com.tencent.mm.model.q.GP(); } if (this.pfb == null || this.pfb.ppf == null || this.pfb.ppf.size() <= 0) { x.l("MicroMsg.WalletOrderInfoOldUI", "mOrders info is Illegal!", new Object[0]); com.tencent.mm.ui.base.h.a(this.mController.tml, i.wallet_order_info_err, 0, new 1(this)); } else { this.pvL = this.pfb.ppf; this.lJJ = ((Commodity) this.pvL.get(0)).bOe; if (!(this.mCn == null || af == null || (!af.cCS() && !af.cCT()))) { bQp(); } } if (this.lJJ == null) { boolean booleanValue; Object obj = g.Ei().DT().get(aa.a.sQv, Boolean.valueOf(false)); if (obj != null) { booleanValue = ((Boolean) obj).booleanValue(); } else { booleanValue = false; } if (booleanValue) { x.i("MicroMsg.WalletOrderInfoOldUI", "has show the finger print auth guide!"); return; } com.tencent.mm.wallet_core.c af2 = com.tencent.mm.wallet_core.a.af(this); Bundle bundle = new Bundle(); if (af2 != null) { bundle = af2.jfZ; } if (TextUtils.isEmpty(bundle.getString("key_pwd1"))) { x.i("MicroMsg.WalletOrderInfoOldUI", "pwd is empty, not show the finger print auth guide!"); return; } this.pwA = false; if (af2 != null) { af2.a(this, "fingerprint", ".ui.FingerPrintAuthTransparentUI", bundle); return; } return; } return; } x.l("MicroMsg.WalletOrderInfoOldUI", "mOrders info is Illegal!", new Object[0]); com.tencent.mm.ui.base.h.a(this.mController.tml, i.wallet_order_info_err, 0, new 4(this)); } public void onCreate(Bundle bundle) { super.onCreate(bundle); ux(4); this.pvK = new HashSet(); Wj(); initView(); jr(1979); com.tencent.mm.sdk.b.a.sFg.b(this.pwg); com.tencent.mm.sdk.b.a.sFg.b(this.lLY); this.pwA = false; } protected final boolean brH() { return false; } public Orders bQo() { return (Orders) this.sy.getParcelable("key_orders"); } public void bQp() { a(new y(bNs(), 21), true, true); } public void Pt(String str) { a(new z(str), true, true); } protected final void cr(String str, int i) { a(new z(str, i), true, true); } protected final void a(Promotions promotions) { a(new n(promotions, bNs(), this.lJJ, promotions.poF), true, false); } private void c(Orders orders) { this.pvK.clear(); if (orders == null || orders.ppf == null) { x.w("MicroMsg.WalletOrderInfoOldUI", "hy: orders is null"); return; } for (Commodity commodity : orders.ppf) { if (commodity.poW == 2 && !bi.oW(commodity.ppx)) { x.d("MicroMsg.WalletOrderInfoOldUI", "hy: has username and is force recommend"); this.pvK.add(commodity.ppx); } } } protected final void initView() { setMMTitle(i.wallet_order_info_ui_title); showHomeBtn(false); enableBackMenu(false); String string = getString(i.app_finish); if (this.mCn == null || this.mCn.bVY != 2) { if (!(this.pfb == null || bi.oW(this.pfb.ppq))) { string = this.pfb.ppq; } } else if (!bi.oW(this.mCn.pCO)) { string = getString(i.app_back) + this.mCn.pCO; } else if (!(bi.oW(this.mCn.appId) || bi.oW(com.tencent.mm.pluginsdk.model.app.g.q(this, this.mCn.appId)))) { string = getString(i.app_back) + com.tencent.mm.pluginsdk.model.app.g.q(this, this.mCn.appId); } addTextOptionMenu(0, string, new 7(this)); this.pwr = (LinearLayout) findViewById(a$f.wallet_order_info_result_ll); this.pws = (TextView) findViewById(a$f.wallet_order_info_result); this.pwt = (TextView) findViewById(a$f.wallet_order_info_link_act); MaxListView maxListView = (MaxListView) findViewById(a$f.wallet_order_info); this.pwu = new a(this); maxListView.setAdapter(this.pwu); bQq(); bQr(); ((ScrollView) findViewById(a$f.wallet_sv)).pageScroll(33); } public final void bQq() { if (this.pfb != null) { int i; this.pvL = this.pfb.ppf; for (Commodity commodity : this.pvL) { if ("1".equals(commodity.lNO)) { i = 0; break; } } i = 1; this.pwr.setVisibility(0); this.pws.setVisibility(0); if (i == 0) { this.pws.setText(i.wallet_order_info_result_wait); } else if (!bi.oW(this.pfb.poY) && !bi.oW(this.pfb.poY.trim())) { this.pws.setText(this.pfb.poY); } else if (this.pfb.pjA != 1) { this.pws.setText(i.wallet_order_info_result_success_international); } else { this.pws.setText(i.wallet_order_info_result_success); } } } protected final void a(String str, d dVar) { bQb(); this.pwz = dVar; e.r(this, str, 1); this.pwA = false; } protected final void Ps(String str) { bQb(); e.l(this, str, false); this.pwA = false; } public final void bQb() { int i = 0; if (!this.ptd) { io ioVar = new io(); ioVar.bRY.bRZ = 4; io.a aVar = ioVar.bRY; if (this.sy.getBoolean("intent_pay_end", false)) { i = -1; } aVar.bjW = i; com.tencent.mm.sdk.b.a.sFg.m(ioVar); this.ptd = true; } } public final void M(ab abVar) { if (abVar != null && ((int) abVar.dhP) != 0) { String BK = abVar.BK(); x.d("MicroMsg.WalletOrderInfoOldUI", "call back from contactServer nickName " + BK + " username: " + abVar.field_username); if (this.pvL != null && this.pvL.size() > 0) { for (Commodity commodity : this.pvL) { commodity.lNW = BK; } this.pwu.notifyDataSetChanged(); } this.gtX = abVar.field_username; } } public void onDestroy() { super.onDestroy(); com.tencent.mm.sdk.b.a.sFg.c(this.pwg); com.tencent.mm.sdk.b.a.sFg.c(this.lLY); js(1979); } public void done() { if (this.sy.containsKey("key_realname_guide_helper")) { RealnameGuideHelper realnameGuideHelper = (RealnameGuideHelper) this.sy.getParcelable("key_realname_guide_helper"); if (realnameGuideHelper != null) { Bundle bundle = new Bundle(); bundle.putString("realname_verify_process_jump_activity", ".ui.WalletOrderInfoOldUI"); bundle.putString("realname_verify_process_jump_plugin", "wallet_core"); boolean b = realnameGuideHelper.b(this, bundle, new 8(this)); this.sy.remove("key_realname_guide_helper"); if (!b) { bQn(); return; } return; } return; } bQn(); } public final void bQn() { bQb(); this.pwA = false; al alVar = new al(); alVar.bHN.bHO = true; com.tencent.mm.sdk.b.a.sFg.m(alVar); Bundle bundle = new Bundle(); bundle.putInt("intent_pay_end_errcode", this.sy.getInt("intent_pay_end_errcode")); bundle.putString("intent_pay_app_url", this.sy.getString("intent_pay_app_url")); bundle.putBoolean("intent_pay_end", this.sy.getBoolean("intent_pay_end")); x.i("MicroMsg.WalletOrderInfoOldUI", "pay done...feedbackData errCode:" + this.sy.getInt("intent_pay_end_errcode")); for (String str : this.pvK) { if (!bi.oW(str)) { x.i("MicroMsg.WalletOrderInfoOldUI", "hy: doing netscene subscribe...appName: %s", new Object[]{str}); if (this.pfb == null || this.mCn == null) { g.Eh().dpP.a(new j(str), 0); } else { g.Eh().dpP.a(new j(str, this.pfb.bOd, this.pfb.ppf.size() > 0 ? ((Commodity) this.pfb.ppf.get(0)).bOe : "", this.mCn.bVY, this.mCn.bVU, this.pfb.poW), 0); } } h.mEJ.h(13033, new Object[]{Integer.valueOf(2), str, "", "", ""}); } com.tencent.mm.wallet_core.a.j(this, bundle); if (this.pfb != null && !bi.oW(this.pfb.ixy)) { String e = e(this.pfb.ixy, this.pfb.bOd, this.pfb.ppf.size() > 0 ? ((Commodity) this.pfb.ppf.get(0)).bOe : "", this.mCn.hvl, this.mCn.fky); x.d("MicroMsg.WalletOrderInfoOldUI", "url = " + e); Intent intent = new Intent(); intent.putExtra("rawUrl", e); intent.putExtra("showShare", false); intent.putExtra("geta8key_username", com.tencent.mm.model.q.GF()); intent.putExtra("stastic_scene", 8); d.b(this, "webview", "com.tencent.mm.plugin.webview.ui.tools.WebViewUI", intent); } } public boolean onKeyUp(int i, KeyEvent keyEvent) { if (i != 4) { return super.onKeyUp(i, keyEvent); } done(); return true; } @Deprecated protected Dialog onCreateDialog(int i) { return com.tencent.mm.ui.base.h.a(this.mController.tml, getString(i.wallet_order_info_phone), getResources().getStringArray(a$b.wallet_phone_call), "", new 9(this)); } public void onResume() { super.onResume(); x.i("MicroMsg.WalletOrderInfoOldUI", "onResume, isClickActivityTinyApp: %s", new Object[]{Boolean.valueOf(this.pwA)}); if (this.pwA) { a(new com.tencent.mm.plugin.wallet_core.c.aa(this.pwz.pjF, this.pwz.pwm, this.pwz.pwn, this.pwz.pwo, this.pwz.bQa, this.pwz.myq, this.pwz.pqh), true, true); } } protected void onActivityResult(int i, int i2, Intent intent) { super.onActivityResult(i, i2, intent); x.i("MicroMsg.WalletOrderInfoOldUI", "onActivityResult %d %d", new Object[]{Integer.valueOf(i), Integer.valueOf(i2)}); if (i == 1) { a(new com.tencent.mm.plugin.wallet_core.c.aa(this.pwz.pjF, this.pwz.pwm, this.pwz.pwn, this.pwz.pwo, this.pwz.bQa, this.pwz.myq, this.pwz.pqh), true, true); } } private void bQr() { if (this.pfb == null || this.pfb.ppf == null || this.pfb.ppf.size() <= 0 || ((Commodity) this.pfb.ppf.get(0)).ppH == null || bi.oW(((Commodity) this.pfb.ppf.get(0)).ppH.text) || bi.oW(((Commodity) this.pfb.ppf.get(0)).ppH.url)) { x.i("MicroMsg.WalletOrderInfoOldUI", "hy: no commodity or no link act or link act is illegal!"); this.pwt.setVisibility(8); return; } this.pwt.setVisibility(0); this.pwt.setText(((Commodity) this.pfb.ppf.get(0)).ppH.text); this.pwt.setOnClickListener(new 10(this)); } public boolean d(int i, int i2, String str, l lVar) { if ((lVar instanceof com.tencent.mm.plugin.wallet_core.c.aa) && i == 0 && i2 == 0) { com.tencent.mm.plugin.wallet_core.c.aa aaVar = (com.tencent.mm.plugin.wallet_core.c.aa) lVar; b bVar = new b(this, aaVar.fFc); boolean z = (bi.oW(bVar.url) || bi.oW(bVar.bSc)) ? false : true; if (z) { this.pti.put(aaVar.pjF, bVar); } this.pwu.notifyDataSetChanged(); } if (lVar instanceof z) { if (i == 0 && i2 == 0) { ux(0); this.pfb = ((z) lVar).pjG; if (this.pfb != null) { this.pvL = this.pfb.ppf; } c(this.pfb); x.d("MicroMsg.WalletOrderInfoOldUI", "Coomdity:" + this.pvL); if (!(this.pvL == null || this.pvL.size() == 0)) { Commodity commodity = (Commodity) this.pvL.get(0); this.lJJ = commodity.bOe; x.d("MicroMsg.WalletOrderInfoOldUI", "Coomdity:" + commodity.toString()); ab Yg = ((com.tencent.mm.plugin.messenger.foundation.a.i) g.l(com.tencent.mm.plugin.messenger.foundation.a.i.class)).FR().Yg(commodity.lNW); if (Yg == null || ((int) Yg.dhP) == 0) { am.a.dBr.a(commodity.lNW, "", this.pwB); } else { M(Yg); } this.pwu.notifyDataSetChanged(); bQq(); } } if (this.pwu != null) { this.pwu.notifyDataSetChanged(); } bQr(); return true; } if (lVar instanceof n) { if (i == 0 && i2 == 0) { n nVar = (n) lVar; String str2 = nVar.pjp; this.pwy.put(Long.valueOf(nVar.pjs.pji), str2); nVar.pjs.poG = nVar.hKX; if (!"-1".equals(str2) && !"0".equals(str2) && !bi.oW(nVar.pjq)) { com.tencent.mm.ui.base.h.b(this, nVar.pjq, "", true); } else if ("0".equals(str2)) { CharSequence string; if (bi.oW(nVar.pjq)) { string = getString(i.wallet_pay_award_got); } else { string = nVar.pjq; } Toast.makeText(this, string, 0).show(); } this.pwu.notifyDataSetChanged(); return true; } else if (lVar instanceof n) { if (bi.oW(str)) { str = getString(i.wallet_unknown_err); } com.tencent.mm.ui.base.h.a(this, str, null, false, new 2(this)); return true; } } return false; } public final String fx(long j) { if (this.pwy.containsKey(Long.valueOf(j))) { return (String) this.pwy.get(Long.valueOf(j)); } return "-1"; } }
package vn.m2m.common; import com.hazelcast.core.HazelcastInstance; import com.hazelcast.core.IMap; import org.springframework.util.StringUtils; import java.lang.annotation.Annotation; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; public abstract class AbstractPrimitiveCache<KeyType, ValueType> { protected Class<KeyType> keyTypeClass; protected Class<ValueType> valueTypeClass; protected String mapCacheName; protected int mapCacheTTL; protected abstract HazelcastInstance hazelcastInstance(); public AbstractPrimitiveCache(Class<KeyType> keyTypeClazz, Class<ValueType> valueTypeClazz){ this.keyTypeClass = keyTypeClazz; this.valueTypeClass = valueTypeClazz; Class<?> tClass = this.getClass(); if (tClass.isAnnotationPresent(ModelData.class)) { Annotation annotation = tClass.getAnnotation(ModelData.class); ModelData modelData = (ModelData) annotation; this.mapCacheName = modelData.mapCacheName(); this.mapCacheTTL = modelData.mapCacheTTL(); } } // ---------------------- IMAP ------------------------------ private IMap<KeyType, ValueType> cacheMap; private synchronized IMap<KeyType, ValueType> getCacheMap() { try { if (cacheMap == null) { cacheMap = hazelcastInstance().getMap(mapCacheName); } return cacheMap; } catch (Exception e) { e.printStackTrace(); } return null; } // ---------------------- IMAP ------------------------------ // ---------------------- Function Cache--------------------- public void putCache(KeyType key, ValueType value){ if (StringUtils.isEmpty(key)) { return; } getCacheMap().put(key, value, mapCacheTTL, TimeUnit.SECONDS); } public void deleteCacheByKey(KeyType key) { if (StringUtils.isEmpty(key)) { return; } getCacheMap().delete(key); } public ValueType getCacheByKey(KeyType key){ if (StringUtils.isEmpty(key)) { return null; } return getCacheMap().get(key); } public ValueType getAndRemoveCacheByKey(KeyType key){ if (StringUtils.isEmpty(key)) { return null; } return getCacheMap().remove(key); } public List<ValueType> getAllCache(){ return new ArrayList<ValueType>(getCacheMap().values()); } public void putAllCache(Map<KeyType, ValueType> objMap){ if (objMap == null || objMap.isEmpty()) { return; } getCacheMap().putAll(objMap); } public void clearCache(){ getCacheMap().destroy(); } // ---------------------- Function Cache--------------------- }
package com.tencent.mm.plugin.collect.reward.ui; import com.tencent.mm.sdk.platformtools.bi; import com.tencent.mm.ui.u; class QrRewardGrantUI$2 extends u { final /* synthetic */ QrRewardGrantUI hVG; QrRewardGrantUI$2(QrRewardGrantUI qrRewardGrantUI) { this.hVG = qrRewardGrantUI; } public final void aBU() { if (QrRewardGrantUI.a(this.hVG, (int) Math.round(bi.getDouble(QrRewardGrantUI.a(this.hVG).getText(), 0.0d) * 100.0d))) { QrRewardGrantUI.b(this.hVG); } } }
package com.secureskytech.multipartcsrfgen; import static org.junit.Assert.*; import java.nio.charset.StandardCharsets; import org.apache.http.Header; import org.apache.http.HttpVersion; import org.apache.http.RequestLine; import org.junit.Test; import org.springframework.core.io.ClassPathResource; import org.springframework.util.StreamUtils; import com.secureskytech.multipartcsrfgen.HttpMultipartRequest.MultipartParameter; import com.secureskytech.multipartcsrfgen.HttpMultipartRequest.UrlEncodedParameter; public class TestHttpMultipartRequest { @Test public void testParseMultipart() throws Exception { final byte[] reqdata0 = StreamUtils .copyToByteArray((new ClassPathResource("static/sample-multipart-request-1.bin")).getInputStream()); HttpMultipartRequest req0 = HttpMultipartRequest.parse(reqdata0, StandardCharsets.UTF_8); final RequestLine reqline = req0.requestLine; assertNotNull(reqline); assertEquals("POST", reqline.getMethod()); assertEquals("/dummy", reqline.getUri()); assertEquals(HttpVersion.HTTP_1_1, reqline.getProtocolVersion()); final Header[] headers = req0.headers; assertEquals(13, headers.length); assertEquals("Host", headers[0].getName()); assertEquals("localhost:9002", headers[0].getValue()); assertEquals("Content-Length", headers[1].getName()); assertEquals("1683", headers[1].getValue()); assertEquals("Cache-Control", headers[2].getName()); assertEquals("max-age=0", headers[2].getValue()); assertEquals("Origin", headers[3].getName()); assertEquals("http://localhost:9002", headers[3].getValue()); assertEquals("Upgrade-Insecure-Requests", headers[4].getName()); assertEquals("1", headers[4].getValue()); assertEquals("Content-Type", headers[5].getName()); assertEquals("multipart/form-data; boundary=----WebKitFormBoundaryQMdpaBCjQndwSnvO", headers[5].getValue()); assertEquals("User-Agent", headers[6].getName()); assertEquals( "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36", headers[6].getValue()); assertEquals("Accept", headers[7].getName()); assertEquals( "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", headers[7].getValue()); assertEquals("Referer", headers[8].getName()); assertEquals("http://localhost:9002/", headers[8].getValue()); assertEquals("Accept-Encoding", headers[9].getName()); assertEquals("gzip, deflate", headers[9].getValue()); assertEquals("Accept-Language", headers[10].getName()); assertEquals("ja,en-US;q=0.9,en;q=0.8", headers[10].getValue()); assertEquals("Cookie", headers[11].getName()); assertEquals( "_ga=GA1.1.394581352.1511848536; JSESSIONID=8B51DE5FD4C803610312C9720A23402C", headers[11].getValue()); assertEquals("Connection", headers[12].getName()); assertEquals("close", headers[12].getValue()); assertEquals(0, req0.formParameters.size()); assertEquals(6, req0.multipartParameters.size()); MultipartParameter mp = req0.multipartParameters.get(0); assertEquals("<>%22&'日本語キー", mp.name); assertFalse(mp.isFile); assertEquals("<>\"&'日本語文字列1", mp.printableValue); mp = req0.multipartParameters.get(1); assertEquals("<>%22&'日本語キー", mp.name); assertFalse(mp.isFile); assertEquals("<>\"&'日本語文字列2", mp.printableValue); mp = req0.multipartParameters.get(2); assertEquals("fileA", mp.name); assertTrue(mp.isFile); assertEquals("256_0to255.bin", mp.fileName); assertEquals("application/octet-stream", mp.contentType); assertArrayEquals( StreamUtils.copyToByteArray((new ClassPathResource("static/256_0to255.bin")).getInputStream()), mp.fileBytes); mp = req0.multipartParameters.get(3); assertEquals("<>%22&'ファイル%0D%0AB%0d%0a", mp.name); assertTrue(mp.isFile); assertEquals("512_0to255.bin", mp.fileName); assertEquals("application/octet-stream", mp.contentType); assertArrayEquals( StreamUtils.copyToByteArray((new ClassPathResource("static/512_0to255.bin")).getInputStream()), mp.fileBytes); mp = req0.multipartParameters.get(4); assertEquals("ascii%0D%0Apname2[]%0d%0a", mp.name); assertFalse(mp.isFile); assertEquals("ascii\r\npvalue2[]\r\n%0d%0a", mp.printableValue); mp = req0.multipartParameters.get(5); assertEquals("ascii pname1%0d%0a", mp.name); assertFalse(mp.isFile); assertEquals("ascii pvalue1%0d%0a", mp.printableValue); } @Test public void testParseFormPost() throws Exception { final byte[] reqdata0 = StreamUtils .copyToByteArray((new ClassPathResource("static/sample-formpost-request-1.bin")).getInputStream()); HttpMultipartRequest req0 = HttpMultipartRequest.parse(reqdata0, StandardCharsets.UTF_8); assertEquals(4, req0.formParameters.size()); assertEquals(0, req0.multipartParameters.size()); UrlEncodedParameter formp = req0.formParameters.get(0); assertEquals("ascii pname1%0d%0a", formp.name); assertEquals("ascii pvalue1%0d%0a", formp.value); formp = req0.formParameters.get(1); assertEquals("ascii\r\npname2[]%0d%0a", formp.name); assertEquals("ascii\r\npvalue2[]\r\n%0d%0a", formp.value); formp = req0.formParameters.get(2); assertEquals("<>\"&'日本語キー", formp.name); assertEquals("<>\"&'日本語文字列1", formp.value); formp = req0.formParameters.get(3); assertEquals("<>\"&'日本語キー", formp.name); assertEquals("<>\"&'日本語文字列2", formp.value); } @Test public void testEscapeToJavaScriptString() { assertEquals("", HttpMultipartRequest.escapeToJavaScriptString(null)); assertEquals("", HttpMultipartRequest.escapeToJavaScriptString("")); assertEquals("abcこんにちは", HttpMultipartRequest.escapeToJavaScriptString("abcこんにちは")); assertEquals( "\\x08\\x09\\x0a\\x0d\\x0c\\x3c\\x3e\\x22\\x27\\\\\\/abcこんにちは", HttpMultipartRequest.escapeToJavaScriptString("\b\t\n\r\f<>\"'\\/abcこんにちは")); } }
package learn.calorietracker.controllers; import learn.calorietracker.domain.LogEntryResult; import learn.calorietracker.domain.LogEntryService; import learn.calorietracker.models.LogEntry; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import java.util.List; @RestController @RequestMapping("/log") public class LogEntryController { private final LogEntryService service; public LogEntryController(LogEntryService service) { this.service = service; } @GetMapping public List<LogEntry> findAll() { return service.findAll(); } @GetMapping("/{logEntryId}") public ResponseEntity findById(@PathVariable int logEntryId) { if (logEntryId <= 0) { return new ResponseEntity<>(null, HttpStatus.BAD_REQUEST); } LogEntry entry = service.findById(logEntryId); if (entry == null) { return new ResponseEntity(null, HttpStatus.NOT_FOUND); } return new ResponseEntity<>(entry, HttpStatus.OK); } @PostMapping public ResponseEntity<LogEntryResult> add(@RequestBody LogEntry entry) { LogEntryResult result = service.create(entry); if (!result.isSuccessful()) { return new ResponseEntity<>(result, HttpStatus.BAD_REQUEST); } return new ResponseEntity<>(result, HttpStatus.CREATED); } @PutMapping("/{logEntryId}") public ResponseEntity<LogEntryResult> update(@PathVariable int logEntryId, @RequestBody LogEntry entry) { entry.setId(logEntryId); LogEntryResult result = service.update(entry); if(!result.isSuccessful()) { return new ResponseEntity<>(result, HttpStatus.BAD_REQUEST); } return new ResponseEntity<>(result, HttpStatus.OK); } @DeleteMapping("/{logEntryId}") public ResponseEntity<Void> delete(@PathVariable int logEntryId) { if (service.deleteById(logEntryId)) { return new ResponseEntity<>(HttpStatus.NO_CONTENT); } return new ResponseEntity<>(HttpStatus.NOT_FOUND); } }
package com.stream.api; public class Ex2 { // Code legth reduce // readability // Inbuilt functions support public static void main(String[] args) { // I1 i1 = (a,b)-> a+b; // System.out.println(i1.add(100,200)); } }
package com.example.pangrett.astroweather; import android.content.SharedPreferences; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.TextView; import java.util.Objects; public class AdditionalWeatherFragment extends Fragment { private TextView windView; private TextView directionView; private TextView humidityView; private TextView visibilityView; private Button refreshAdditional; private SharedPreferences sharedPreferences; private String speedSettings; private String speedUnit; @Override public void onStart() { super.onStart(); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup rootView = (ViewGroup) inflater.inflate( R.layout.fragment_additional_weather, container, false); initTextViews(rootView); refreshAdditional = rootView.findViewById(R.id.refreshAdditonal); refreshAdditional.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { getSharedPreferences(); setAdditionalInfo(); } }); getSharedPreferences(); setAdditionalInfo(); return rootView; } private void initTextViews(View rootView){ windView = rootView.findViewById(R.id.windView); directionView = rootView.findViewById(R.id.directionView); humidityView = rootView.findViewById(R.id.humidityView); visibilityView = rootView.findViewById(R.id.visibilityView); } private void getSharedPreferences(){ sharedPreferences = Objects.requireNonNull(getContext()).getSharedPreferences("weather.xml", 0); speedSettings = sharedPreferences.getString("speed_unit", "NULL"); } private void setAdditionalInfo(){ windView.setText(String.format("Wind Speed: %s %s", setUnit(sharedPreferences.getString("wind_speed", "NULL")), speedUnit)); directionView.setText(String.format("Wind Direction: %s", sharedPreferences.getString("wind_direction", "NULL"))); humidityView.setText(String.format("Humidity: %s %%", sharedPreferences.getString("humidity", "NULL"))); visibilityView.setText(String.format("Visibility: %s %%", sharedPreferences.getString("visibility", "NULL"))); } private String setUnit(String windSpeed){ if(speedSettings.equals("0") || speedSettings.equals("NULL")){ speedUnit = "mph"; } else{ speedUnit = "kmh"; windSpeed = String.valueOf((int)(Double.parseDouble(windSpeed) * 1.61)); } return windSpeed; } }
package com.chris.projects.fx.ftp.fix; public interface SessionConnector { void start(); void stop(); }
package com.pingcap.tools.cdb.binlog.starter.monitor; import java.util.Map; /** * Created by iamxy on 2017/2/17. */ public class ServerRunningMonitors { private static Map runningMonitors; public static Map<String, ServerRunningMonitor> getRunningMonitors() { return runningMonitors; } public static ServerRunningMonitor getRunningMonitor(String destination) { return (ServerRunningMonitor) runningMonitors.get(destination); } public static void setRunningMonitors(Map runningMonitors) { ServerRunningMonitors.runningMonitors = runningMonitors; } }
package com.tencent.mm.plugin.game.gamewebview.jsapi; import android.content.Context; import android.os.Parcel; import android.os.Parcelable.Creator; import com.tencent.mm.plugin.game.gamewebview.ipc.GameProcessActivityTask; import com.tencent.mm.plugin.game.gamewebview.ipc.GameProcessActivityTask.a; import com.tencent.mm.plugin.game.gamewebview.ui.d; import com.tencent.mm.sdk.platformtools.x; import java.util.Map; public class GameJsApiActivityTask extends GameProcessActivityTask { public static final Creator<GameJsApiActivityTask> CREATOR = new Creator<GameJsApiActivityTask>() { public final /* synthetic */ Object createFromParcel(Parcel parcel) { return new GameJsApiActivityTask(parcel, (byte) 0); } public final /* bridge */ /* synthetic */ Object[] newArray(int i) { return new GameJsApiActivityTask[i]; } }; public int fFd; public String fII; public d jGq; public String jGt; public String jGu; /* synthetic */ GameJsApiActivityTask(Parcel parcel, byte b) { this(parcel); } public final void a(Context context, a aVar) { x.i("MicroMsg.GameJsApiActivityTask", "runInMainProcess, apiName = %s", new Object[]{this.jGt}); Map aSw = e.aSw(); if (aSw != null) { c cVar = (c) aSw.get(this.jGt); if (!(cVar instanceof f)) { ((a) cVar).a(context, this.fII, new 1(this, aVar)); } } } public final void aaj() { if (this.jGq != null) { this.jGq.E(this.fFd, this.jGu); } } public final void g(Parcel parcel) { this.fII = parcel.readString(); this.jGt = parcel.readString(); this.jGu = parcel.readString(); } public void writeToParcel(Parcel parcel, int i) { parcel.writeString(this.fII); parcel.writeString(this.jGt); parcel.writeString(this.jGu); } public GameJsApiActivityTask(Context context) { super(context); } private GameJsApiActivityTask(Parcel parcel) { g(parcel); } }
package com.tencent.mm.plugin.wallet_core.ui.view; import android.view.View; import android.view.View.OnClickListener; import com.tencent.mm.plugin.wxpay.a$g; import com.tencent.mm.plugin.wxpay.a.i; import com.tencent.mm.ui.MMActivity; import com.tencent.mm.wallet_core.ui.formview.b; class WalletPhoneInputView$2 implements OnClickListener { final /* synthetic */ WalletPhoneInputView pzY; WalletPhoneInputView$2(WalletPhoneInputView walletPhoneInputView) { this.pzY = walletPhoneInputView; } public final void onClick(View view) { b.a((MMActivity) this.pzY.getContext(), a$g.wallet_phone_illustration_dialog, i.wallet_card_phone_illustraction); } }
/* * Copyright 2011 Sergio Moyano Serrano. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package uk.ac.brunel.sc2dm.server; /** * Public interface defining a default method which will be called always the registration id arrive for a * client. * @author Sergio Moyano Serrano (smoyano@correo.ugr.es) * Created: 15:07 - 2/08/11 */ public interface SC2DMUnregistrationCallbackHandler { /** * Some task like saving the registrationId along with the email should be done. */ public void unregisterDevice(final String email, final String registrationId); }
package com.paritytrading.parity.client.event; import com.paritytrading.parity.net.poe.POE; import com.paritytrading.parity.net.poe.POEClientListener; import org.eclipse.collections.api.list.ImmutableList; import org.eclipse.collections.impl.factory.Lists; public class Events implements POEClientListener { private volatile ImmutableList<Event> events; public Events() { events = Lists.immutable.with(); } public void accept(EventVisitor visitor) { for (Event event : events) event.accept(visitor); } @Override public void orderAccepted(POE.OrderAccepted message) { add(new Event.OrderAccepted(message)); } @Override public void orderRejected(POE.OrderRejected message) { add(new Event.OrderRejected(message)); } @Override public void orderExecuted(POE.OrderExecuted message) { add(new Event.OrderExecuted(message)); } @Override public void orderCanceled(POE.OrderCanceled message) { add(new Event.OrderCanceled(message)); } private void add(Event event) { events = events.newWith(event); } }
package com.android.yinwear.core.db; import android.content.Context; import androidx.room.Room; public class DbClient { private static DbClient mInstance; private AppDatabase appDatabase; private DbClient(Context context) { appDatabase = Room.databaseBuilder(context, AppDatabase.class, "MyYINDb").build(); } public static synchronized DbClient getInstance(Context context) { if (mInstance == null) { mInstance = new DbClient(context); } return mInstance; } public AppDatabase getAppDatabase() { return appDatabase; } }
package com.rsm.yuri.projecttaxilivredriver.domain; /** * Created by yuri_ on 28/12/2017. */ public interface FirebaseStorageFinishedListener { void onSuccess(String url); void onError(String error); }
package edu.cornell.gdiac.controller; /** * Created by nsterling4 on 4/7/17. */ import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.ApplicationListener; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.g2d.Animation; import com.badlogic.gdx.graphics.g2d.SpriteBatch; public class Animator { // // Constant rows and columns of the sprite sheet // private static final int FRAME_COLS = 8, FRAME_ROWS = 1; // // // Objects used // Animation<TextureRegion> walkAnimation; // Must declare frame type (TextureRegion) // Texture walkSheet; // SpriteBatch spriteBatch; // // // A variable for tracking elapsed time for the animation // float stateTime; // // @Override // public void create() { // // // Load the sprite sheet as a Texture // walkSheet = new Texture(Gdx.files.internal("space/planets/sunAnim.png")); // // // Use the split utility method to create a 2D array of TextureRegions. This is // // possible because this sprite sheet contains frames of equal size and they are // // all aligned. // TextureRegion[][] tmp = TextureRegion.split(walkSheet, // walkSheet.getWidth() / FRAME_COLS, // walkSheet.getHeight() / FRAME_ROWS); // // // Place the regions into a 1D array in the correct order, starting from the top // // left, going across first. The Animation constructor requires a 1D array. // TextureRegion[] walkFrames = new TextureRegion[FRAME_COLS * FRAME_ROWS]; // int index = 0; // for (int i = 0; i < FRAME_ROWS; i++) { // for (int j = 0; j < FRAME_COLS; j++) { // walkFrames[index++] = tmp[i][j]; // } // } // // // Initialize the Animation with the frame interval and array of frames // walkAnimation = new Animation<TextureRegion>(0.125f, walkFrames); // // // Instantiate a SpriteBatch for drawing and reset the elapsed animation // // time to 0 // spriteBatch = new SpriteBatch(); // stateTime = 0f; // } // // // public void render() { // Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); // Clear screen // stateTime += Gdx.graphics.getDeltaTime(); // Accumulate elapsed animation time // // // Get current frame of animation for the current stateTime // TextureRegion currentFrame = walkAnimation.getKeyFrame(stateTime, true); // spriteBatch.begin(); // spriteBatch.draw(currentFrame, 50, 50); // Draw current frame at (50, 50) // spriteBatch.end(); // } // // // public void dispose() { // SpriteBatches and Textures must always be disposed // spriteBatch.dispose(); // walkSheet.dispose(); // } // // // // Constant rows and columns of the sprite sheet private static int FRAME_COLS; private static int FRAME_ROWS; private static String spritePath; private static float frameRate; // Objects used Animation<TextureRegion> spriteAnimation; // Must declare frame type (TextureRegion) Texture spriteSheet; SpriteBatch spriteBatch; // A variable for tracking elapsed time for the animation float stateTime; public void setCols(int val){FRAME_COLS = val;} public float getCols(){return FRAME_COLS;} public void setRows(int val){FRAME_ROWS = val;} public float getRows(){return FRAME_ROWS;} public void setRate(float val){frameRate = val;} public float getRate(){return frameRate;} public void setSpritePath(String path){spritePath = path;} public String getSpritePath(){return spritePath;} public Animator (int columns, int rows, float framerate, String filePath) { setCols(columns); setRows(rows); setRate(framerate); setSpritePath(filePath); } public void create() { // Load the sprite sheet as a Texture spriteSheet = new Texture(Gdx.files.internal(spritePath)); // Use the split utility method to create a 2D array of TextureRegions. This is // possible because this sprite sheet contains frames of equal size and they are // all aligned. TextureRegion[][] tmp = TextureRegion.split(spriteSheet, spriteSheet.getWidth() / FRAME_COLS, spriteSheet.getHeight() / FRAME_ROWS); // Place the regions into a 1D array in the correct order, starting from the top // left, going across first. The Animation constructor requires a 1D array. TextureRegion[] walkFrames = new TextureRegion[FRAME_COLS * FRAME_ROWS]; int index = 0; for (int i = 0; i < FRAME_ROWS; i++) { for (int j = 0; j < FRAME_COLS; j++) { walkFrames[index++] = tmp[i][j]; } } // Initialize the Animation with the frame interval and array of frames spriteAnimation = new Animation<TextureRegion>(frameRate, walkFrames); // Instantiate a SpriteBatch for drawing and reset the elapsed animation // time to 0 spriteBatch = new SpriteBatch(); stateTime = 0f; } // @Override // public void render() { // Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); // Clear screen // stateTime += Gdx.graphics.getDeltaTime(); // Accumulate elapsed animation time // // // Get current frame of animation for the current stateTime // TextureRegion currentFrame = spriteAnimation.getKeyFrame(stateTime, true); // spriteBatch.begin(); // spriteBatch.draw(currentFrame, 50, 50); // Draw current frame at (50, 50) // spriteBatch.end(); // } // // //@Override // public void dispose() { // SpriteBatches and Textures must always be disposed // spriteBatch.dispose(); // spriteSheet.dispose(); // } /** * Called when the Screen is resized. * * This can happen at any point during a non-paused state but will never happen * before a call to show(). * * @param width The new width in pixels * @param height The new height in pixels */ public void resize(int width, int height) { // IGNORE FOR NOW } /** * Called when the Screen is paused. * <p> * This is usually when it's not active or visible on screen. An Application is * also paused before it is destroyed. */ public void pause() { // TODO Auto-generated method stub } /** * Called when the Screen is resumed from a paused state. * <p> * This is usually when it regains focus. */ public void resume() { // TODO Auto-generated method stub } }
package cz.root.rohlik.entity; public enum OrderStatusEnum { REGISTRED, PAID, UNPAID }
package com.zxjdev.smile.domain.moment; import java.util.List; import io.reactivex.Completable; import io.reactivex.Observable; public interface MomentRepository { Completable addMoment(String content); Observable<List<Moment>> queryMomentList(); Observable<Moment> queryMoment(String momentId); }
/* * Copyright 2019 iserge. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.cleanlogic.rsc4j.format.primitives; import com.google.gson.annotations.Expose; import org.cleanlogic.rsc4j.format.enums.PrimitiveType; /** * @author Serge Silaev aka iSergio <s.serge.b@gmail.com> */ public class Section { private PrimitiveType type; private Primitive primitive; private int length; public Section() {} public PrimitiveType getType() { return type; } public void setType(PrimitiveType type) { this.type = type; } public Primitive getPrimitive() { return primitive; } public void setPrimitive(Primitive primitive) { this.primitive = primitive; } public int getLength() { return length; } public void setLength(int length) { this.length = length; } }
package com.tencent.mm.plugin.exdevice.ui; import android.view.View; import com.tencent.mm.ui.base.MMPullDownView$d; class ExdeviceRankInfoUI$4 implements MMPullDownView$d { final /* synthetic */ ExdeviceRankInfoUI iFG; ExdeviceRankInfoUI$4(ExdeviceRankInfoUI exdeviceRankInfoUI) { this.iFG = exdeviceRankInfoUI; } public final boolean aCh() { int firstVisiblePosition = ExdeviceRankInfoUI.q(this.iFG).getFirstVisiblePosition(); if (firstVisiblePosition == 0) { View childAt = ExdeviceRankInfoUI.q(this.iFG).getChildAt(firstVisiblePosition); if (childAt != null && childAt.getTop() >= 0) { return true; } } return false; } }
package com.espendwise.manta.history; import java.util.Iterator; import java.util.List; import java.util.Map; import org.apache.log4j.Logger; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.AfterReturning; import org.aspectj.lang.annotation.AfterThrowing; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.espendwise.manta.model.data.HistoryData; import com.espendwise.manta.model.view.ShoppingControlItemView; import com.espendwise.manta.service.HistoryService; import com.espendwise.manta.util.RefCodeNames; import com.espendwise.manta.util.Utility; @Component @Aspect public class ShoppingControlHistorian { private static final Logger logger = Logger.getLogger(ShoppingControlHistorian.class); @Autowired private HistoryService historyService; public ShoppingControlHistorian() { } public ShoppingControlHistorian(HistoryService historyService) { this.historyService = historyService; } @Pointcut("execution(* com.espendwise.manta.dao.ShoppingControlDAOImpl.updateShoppingControls(..))") public void handleUpdateShoppingControls() { } @AfterReturning(pointcut="handleUpdateShoppingControls()", returning="returnValue") public void recordUpdateShoppingControlsSuccess(JoinPoint jp, Map<String,List<ShoppingControlItemView>> returnValue) throws Throwable { if (Utility.isSet(returnValue)) { List<ShoppingControlItemView> createdControls = returnValue.get(RefCodeNames.HISTORY_TYPE_CD.CREATED); if (Utility.isSet(createdControls)) { Iterator<ShoppingControlItemView> createdControlIterator = createdControls.iterator(); while (createdControlIterator.hasNext()) { ShoppingControlItemView createdControl = createdControlIterator.next(); HistoryRecord historyRecord = HistoryRecord.getInstance(HistoryRecord.TYPE_CODE_CREATE_SHOPPING_CONTROL); HistoryData historyData = historyRecord.describeIntoHistoryData(createdControl); try { historyService.createHistoryRecord(historyData, historyRecord.getInvolvedObjects(createdControl), historyRecord.getSecurityObjects(createdControl)); } catch (Exception e) { logger.error("Exception occurred in ShoppingControlHistorian.recordUpdateShoppingControlsSuccess: " + e.toString()); } } } List<ShoppingControlItemView> modifiedControls = returnValue.get(RefCodeNames.HISTORY_TYPE_CD.MODIFIED); if (Utility.isSet(modifiedControls)) { Iterator<ShoppingControlItemView> modifiedControlIterator = modifiedControls.iterator(); while (modifiedControlIterator.hasNext()) { ShoppingControlItemView modifiedControl = modifiedControlIterator.next(); HistoryRecord historyRecord = HistoryRecord.getInstance(HistoryRecord.TYPE_CODE_MODIFY_SHOPPING_CONTROL); HistoryData historyData = historyRecord.describeIntoHistoryData(modifiedControl); try { historyService.createHistoryRecord(historyData, historyRecord.getInvolvedObjects(modifiedControl), historyRecord.getSecurityObjects(modifiedControl)); } catch (Exception e) { logger.error("Exception occurred in ShoppingControlHistorian.recordUpdateShoppingControlsSuccess: " + e.toString()); } } } } } @AfterThrowing(pointcut="handleUpdateShoppingControls()", throwing="ex") public void recordUpdateShoppingControlsException(JoinPoint jp, Throwable ex) throws Throwable { StringBuilder builder = new StringBuilder(100); builder.append("Exception \""); builder.append(ex.getClass()); builder.append("\" occurred in method \""); builder.append(jp.getSignature()); builder.append("\" - message = "); builder.append(ex.getMessage()); builder.append(". No history record was recorded."); logger.error(builder.toString()); } }
package org.idea.plugin.atg.actions; import com.intellij.icons.AllIcons; import com.intellij.ide.IdeView; import com.intellij.ide.actions.CreateFileFromTemplateAction; import com.intellij.ide.actions.CreateFileFromTemplateDialog; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.LangDataKeys; import com.intellij.openapi.actionSystem.Presentation; import com.intellij.openapi.project.Project; import com.intellij.openapi.roots.ProjectFileIndex; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiDirectory; import org.idea.plugin.atg.AtgToolkitBundle; import org.idea.plugin.atg.util.AtgComponentUtil; import org.jetbrains.annotations.NotNull; import java.util.Arrays; /** * @author gress on 09.12.2019 */ public class NewAtgFileAction extends CreateFileFromTemplateAction { public NewAtgFileAction() { super(AtgToolkitBundle.message("new.atg.file.action"), AtgToolkitBundle.message("new.atg.file.action.dialog.description"), AllIcons.FileTypes.Xml); } @Override protected void buildDialog(@NotNull Project project, @NotNull PsiDirectory directory, CreateFileFromTemplateDialog.Builder builder) { builder.setTitle(AtgToolkitBundle.message("new.atg.file.action.dialog.title")) .addKind("ATG Actor definition", AllIcons.FileTypes.Xml, "Actor File.xml") .addKind("ATG Repository definition", AllIcons.FileTypes.Xml, "Repository File.xml") .addKind("ATG Pipeline definition", AllIcons.FileTypes.Xml, "Pipeline File.xml"); } @Override protected String getActionName(PsiDirectory directory, @NotNull String newName, String templateName) { return AtgToolkitBundle.message("new.atg.file.action"); } @Override public void update(final AnActionEvent e) { final DataContext dataContext = e.getDataContext(); final Presentation presentation = e.getPresentation(); final boolean enabled = isAvailable(dataContext); presentation.setVisible(enabled); presentation.setEnabled(enabled); } @Override protected boolean isAvailable(final DataContext dataContext) { boolean available = false; final IdeView view = LangDataKeys.IDE_VIEW.getData(dataContext); if (view != null) { available = Arrays.stream(view.getDirectories()) .anyMatch(this::isUnderConfigDir); } return available; } private boolean isUnderConfigDir(PsiDirectory psiDirectory) { ProjectFileIndex projectFileIndex = ProjectFileIndex.getInstance(psiDirectory.getProject()); final VirtualFile current = psiDirectory.getVirtualFile(); return AtgComponentUtil.getConfigRootForFile(projectFileIndex, current).isPresent(); } }
package com.rc.portal.vo; import java.math.BigDecimal; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import com.rc.app.framework.webapp.model.BaseModel; public class CDeliveryWayExample extends BaseModel{ protected String orderByClause; protected List oredCriteria; public CDeliveryWayExample() { oredCriteria = new ArrayList(); } protected CDeliveryWayExample(CDeliveryWayExample example) { this.orderByClause = example.orderByClause; this.oredCriteria = example.oredCriteria; } public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; } public String getOrderByClause() { return orderByClause; } public List getOredCriteria() { return oredCriteria; } public void or(Criteria criteria) { oredCriteria.add(criteria); } public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); if (oredCriteria.size() == 0) { oredCriteria.add(criteria); } return criteria; } protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); return criteria; } public void clear() { oredCriteria.clear(); } public static class Criteria { protected List criteriaWithoutValue; protected List criteriaWithSingleValue; protected List criteriaWithListValue; protected List criteriaWithBetweenValue; protected Criteria() { super(); criteriaWithoutValue = new ArrayList(); criteriaWithSingleValue = new ArrayList(); criteriaWithListValue = new ArrayList(); criteriaWithBetweenValue = new ArrayList(); } public boolean isValid() { return criteriaWithoutValue.size() > 0 || criteriaWithSingleValue.size() > 0 || criteriaWithListValue.size() > 0 || criteriaWithBetweenValue.size() > 0; } public List getCriteriaWithoutValue() { return criteriaWithoutValue; } public List getCriteriaWithSingleValue() { return criteriaWithSingleValue; } public List getCriteriaWithListValue() { return criteriaWithListValue; } public List getCriteriaWithBetweenValue() { return criteriaWithBetweenValue; } protected void addCriterion(String condition) { if (condition == null) { throw new RuntimeException("Value for condition cannot be null"); } criteriaWithoutValue.add(condition); } protected void addCriterion(String condition, Object value, String property) { if (value == null) { throw new RuntimeException("Value for " + property + " cannot be null"); } Map map = new HashMap(); map.put("condition", condition); map.put("value", value); criteriaWithSingleValue.add(map); } protected void addCriterion(String condition, List values, String property) { if (values == null || values.size() == 0) { throw new RuntimeException("Value list for " + property + " cannot be null or empty"); } Map map = new HashMap(); map.put("condition", condition); map.put("values", values); criteriaWithListValue.add(map); } protected void addCriterion(String condition, Object value1, Object value2, String property) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + property + " cannot be null"); } List list = new ArrayList(); list.add(value1); list.add(value2); Map map = new HashMap(); map.put("condition", condition); map.put("values", list); criteriaWithBetweenValue.add(map); } public Criteria andIdIsNull() { addCriterion("id is null"); return this; } public Criteria andIdIsNotNull() { addCriterion("id is not null"); return this; } public Criteria andIdEqualTo(Long value) { addCriterion("id =", value, "id"); return this; } public Criteria andIdNotEqualTo(Long value) { addCriterion("id <>", value, "id"); return this; } public Criteria andIdGreaterThan(Long value) { addCriterion("id >", value, "id"); return this; } public Criteria andIdGreaterThanOrEqualTo(Long value) { addCriterion("id >=", value, "id"); return this; } public Criteria andIdLessThan(Long value) { addCriterion("id <", value, "id"); return this; } public Criteria andIdLessThanOrEqualTo(Long value) { addCriterion("id <=", value, "id"); return this; } public Criteria andIdIn(List values) { addCriterion("id in", values, "id"); return this; } public Criteria andIdNotIn(List values) { addCriterion("id not in", values, "id"); return this; } public Criteria andIdBetween(Long value1, Long value2) { addCriterion("id between", value1, value2, "id"); return this; } public Criteria andIdNotBetween(Long value1, Long value2) { addCriterion("id not between", value1, value2, "id"); return this; } public Criteria andNameIsNull() { addCriterion("name is null"); return this; } public Criteria andNameIsNotNull() { addCriterion("name is not null"); return this; } public Criteria andNameEqualTo(String value) { addCriterion("name =", value, "name"); return this; } public Criteria andNameNotEqualTo(String value) { addCriterion("name <>", value, "name"); return this; } public Criteria andNameGreaterThan(String value) { addCriterion("name >", value, "name"); return this; } public Criteria andNameGreaterThanOrEqualTo(String value) { addCriterion("name >=", value, "name"); return this; } public Criteria andNameLessThan(String value) { addCriterion("name <", value, "name"); return this; } public Criteria andNameLessThanOrEqualTo(String value) { addCriterion("name <=", value, "name"); return this; } public Criteria andNameLike(String value) { addCriterion("name like", value, "name"); return this; } public Criteria andNameNotLike(String value) { addCriterion("name not like", value, "name"); return this; } public Criteria andNameIn(List values) { addCriterion("name in", values, "name"); return this; } public Criteria andNameNotIn(List values) { addCriterion("name not in", values, "name"); return this; } public Criteria andNameBetween(String value1, String value2) { addCriterion("name between", value1, value2, "name"); return this; } public Criteria andNameNotBetween(String value1, String value2) { addCriterion("name not between", value1, value2, "name"); return this; } public Criteria andInitWeightIsNull() { addCriterion("init_weight is null"); return this; } public Criteria andInitWeightIsNotNull() { addCriterion("init_weight is not null"); return this; } public Criteria andInitWeightEqualTo(BigDecimal value) { addCriterion("init_weight =", value, "initWeight"); return this; } public Criteria andInitWeightNotEqualTo(BigDecimal value) { addCriterion("init_weight <>", value, "initWeight"); return this; } public Criteria andInitWeightGreaterThan(BigDecimal value) { addCriterion("init_weight >", value, "initWeight"); return this; } public Criteria andInitWeightGreaterThanOrEqualTo(BigDecimal value) { addCriterion("init_weight >=", value, "initWeight"); return this; } public Criteria andInitWeightLessThan(BigDecimal value) { addCriterion("init_weight <", value, "initWeight"); return this; } public Criteria andInitWeightLessThanOrEqualTo(BigDecimal value) { addCriterion("init_weight <=", value, "initWeight"); return this; } public Criteria andInitWeightIn(List values) { addCriterion("init_weight in", values, "initWeight"); return this; } public Criteria andInitWeightNotIn(List values) { addCriterion("init_weight not in", values, "initWeight"); return this; } public Criteria andInitWeightBetween(BigDecimal value1, BigDecimal value2) { addCriterion("init_weight between", value1, value2, "initWeight"); return this; } public Criteria andInitWeightNotBetween(BigDecimal value1, BigDecimal value2) { addCriterion("init_weight not between", value1, value2, "initWeight"); return this; } public Criteria andAddWeightIsNull() { addCriterion("add_weight is null"); return this; } public Criteria andAddWeightIsNotNull() { addCriterion("add_weight is not null"); return this; } public Criteria andAddWeightEqualTo(BigDecimal value) { addCriterion("add_weight =", value, "addWeight"); return this; } public Criteria andAddWeightNotEqualTo(BigDecimal value) { addCriterion("add_weight <>", value, "addWeight"); return this; } public Criteria andAddWeightGreaterThan(BigDecimal value) { addCriterion("add_weight >", value, "addWeight"); return this; } public Criteria andAddWeightGreaterThanOrEqualTo(BigDecimal value) { addCriterion("add_weight >=", value, "addWeight"); return this; } public Criteria andAddWeightLessThan(BigDecimal value) { addCriterion("add_weight <", value, "addWeight"); return this; } public Criteria andAddWeightLessThanOrEqualTo(BigDecimal value) { addCriterion("add_weight <=", value, "addWeight"); return this; } public Criteria andAddWeightIn(List values) { addCriterion("add_weight in", values, "addWeight"); return this; } public Criteria andAddWeightNotIn(List values) { addCriterion("add_weight not in", values, "addWeight"); return this; } public Criteria andAddWeightBetween(BigDecimal value1, BigDecimal value2) { addCriterion("add_weight between", value1, value2, "addWeight"); return this; } public Criteria andAddWeightNotBetween(BigDecimal value1, BigDecimal value2) { addCriterion("add_weight not between", value1, value2, "addWeight"); return this; } public Criteria andInitPriceIsNull() { addCriterion("init_price is null"); return this; } public Criteria andInitPriceIsNotNull() { addCriterion("init_price is not null"); return this; } public Criteria andInitPriceEqualTo(BigDecimal value) { addCriterion("init_price =", value, "initPrice"); return this; } public Criteria andInitPriceNotEqualTo(BigDecimal value) { addCriterion("init_price <>", value, "initPrice"); return this; } public Criteria andInitPriceGreaterThan(BigDecimal value) { addCriterion("init_price >", value, "initPrice"); return this; } public Criteria andInitPriceGreaterThanOrEqualTo(BigDecimal value) { addCriterion("init_price >=", value, "initPrice"); return this; } public Criteria andInitPriceLessThan(BigDecimal value) { addCriterion("init_price <", value, "initPrice"); return this; } public Criteria andInitPriceLessThanOrEqualTo(BigDecimal value) { addCriterion("init_price <=", value, "initPrice"); return this; } public Criteria andInitPriceIn(List values) { addCriterion("init_price in", values, "initPrice"); return this; } public Criteria andInitPriceNotIn(List values) { addCriterion("init_price not in", values, "initPrice"); return this; } public Criteria andInitPriceBetween(BigDecimal value1, BigDecimal value2) { addCriterion("init_price between", value1, value2, "initPrice"); return this; } public Criteria andInitPriceNotBetween(BigDecimal value1, BigDecimal value2) { addCriterion("init_price not between", value1, value2, "initPrice"); return this; } public Criteria andAddPriceIsNull() { addCriterion("add_price is null"); return this; } public Criteria andAddPriceIsNotNull() { addCriterion("add_price is not null"); return this; } public Criteria andAddPriceEqualTo(BigDecimal value) { addCriterion("add_price =", value, "addPrice"); return this; } public Criteria andAddPriceNotEqualTo(BigDecimal value) { addCriterion("add_price <>", value, "addPrice"); return this; } public Criteria andAddPriceGreaterThan(BigDecimal value) { addCriterion("add_price >", value, "addPrice"); return this; } public Criteria andAddPriceGreaterThanOrEqualTo(BigDecimal value) { addCriterion("add_price >=", value, "addPrice"); return this; } public Criteria andAddPriceLessThan(BigDecimal value) { addCriterion("add_price <", value, "addPrice"); return this; } public Criteria andAddPriceLessThanOrEqualTo(BigDecimal value) { addCriterion("add_price <=", value, "addPrice"); return this; } public Criteria andAddPriceIn(List values) { addCriterion("add_price in", values, "addPrice"); return this; } public Criteria andAddPriceNotIn(List values) { addCriterion("add_price not in", values, "addPrice"); return this; } public Criteria andAddPriceBetween(BigDecimal value1, BigDecimal value2) { addCriterion("add_price between", value1, value2, "addPrice"); return this; } public Criteria andAddPriceNotBetween(BigDecimal value1, BigDecimal value2) { addCriterion("add_price not between", value1, value2, "addPrice"); return this; } public Criteria andIconIsNull() { addCriterion("icon is null"); return this; } public Criteria andIconIsNotNull() { addCriterion("icon is not null"); return this; } public Criteria andIconEqualTo(String value) { addCriterion("icon =", value, "icon"); return this; } public Criteria andIconNotEqualTo(String value) { addCriterion("icon <>", value, "icon"); return this; } public Criteria andIconGreaterThan(String value) { addCriterion("icon >", value, "icon"); return this; } public Criteria andIconGreaterThanOrEqualTo(String value) { addCriterion("icon >=", value, "icon"); return this; } public Criteria andIconLessThan(String value) { addCriterion("icon <", value, "icon"); return this; } public Criteria andIconLessThanOrEqualTo(String value) { addCriterion("icon <=", value, "icon"); return this; } public Criteria andIconLike(String value) { addCriterion("icon like", value, "icon"); return this; } public Criteria andIconNotLike(String value) { addCriterion("icon not like", value, "icon"); return this; } public Criteria andIconIn(List values) { addCriterion("icon in", values, "icon"); return this; } public Criteria andIconNotIn(List values) { addCriterion("icon not in", values, "icon"); return this; } public Criteria andIconBetween(String value1, String value2) { addCriterion("icon between", value1, value2, "icon"); return this; } public Criteria andIconNotBetween(String value1, String value2) { addCriterion("icon not between", value1, value2, "icon"); return this; } public Criteria andInstroIsNull() { addCriterion("instro is null"); return this; } public Criteria andInstroIsNotNull() { addCriterion("instro is not null"); return this; } public Criteria andInstroEqualTo(String value) { addCriterion("instro =", value, "instro"); return this; } public Criteria andInstroNotEqualTo(String value) { addCriterion("instro <>", value, "instro"); return this; } public Criteria andInstroGreaterThan(String value) { addCriterion("instro >", value, "instro"); return this; } public Criteria andInstroGreaterThanOrEqualTo(String value) { addCriterion("instro >=", value, "instro"); return this; } public Criteria andInstroLessThan(String value) { addCriterion("instro <", value, "instro"); return this; } public Criteria andInstroLessThanOrEqualTo(String value) { addCriterion("instro <=", value, "instro"); return this; } public Criteria andInstroLike(String value) { addCriterion("instro like", value, "instro"); return this; } public Criteria andInstroNotLike(String value) { addCriterion("instro not like", value, "instro"); return this; } public Criteria andInstroIn(List values) { addCriterion("instro in", values, "instro"); return this; } public Criteria andInstroNotIn(List values) { addCriterion("instro not in", values, "instro"); return this; } public Criteria andInstroBetween(String value1, String value2) { addCriterion("instro between", value1, value2, "instro"); return this; } public Criteria andInstroNotBetween(String value1, String value2) { addCriterion("instro not between", value1, value2, "instro"); return this; } public Criteria andSortIsNull() { addCriterion("sort is null"); return this; } public Criteria andSortIsNotNull() { addCriterion("sort is not null"); return this; } public Criteria andSortEqualTo(Integer value) { addCriterion("sort =", value, "sort"); return this; } public Criteria andSortNotEqualTo(Integer value) { addCriterion("sort <>", value, "sort"); return this; } public Criteria andSortGreaterThan(Integer value) { addCriterion("sort >", value, "sort"); return this; } public Criteria andSortGreaterThanOrEqualTo(Integer value) { addCriterion("sort >=", value, "sort"); return this; } public Criteria andSortLessThan(Integer value) { addCriterion("sort <", value, "sort"); return this; } public Criteria andSortLessThanOrEqualTo(Integer value) { addCriterion("sort <=", value, "sort"); return this; } public Criteria andSortIn(List values) { addCriterion("sort in", values, "sort"); return this; } public Criteria andSortNotIn(List values) { addCriterion("sort not in", values, "sort"); return this; } public Criteria andSortBetween(Integer value1, Integer value2) { addCriterion("sort between", value1, value2, "sort"); return this; } public Criteria andSortNotBetween(Integer value1, Integer value2) { addCriterion("sort not between", value1, value2, "sort"); return this; } public Criteria andIsFreeIsNull() { addCriterion("is_free is null"); return this; } public Criteria andIsFreeIsNotNull() { addCriterion("is_free is not null"); return this; } public Criteria andIsFreeEqualTo(Integer value) { addCriterion("is_free =", value, "isFree"); return this; } public Criteria andIsFreeNotEqualTo(Integer value) { addCriterion("is_free <>", value, "isFree"); return this; } public Criteria andIsFreeGreaterThan(Integer value) { addCriterion("is_free >", value, "isFree"); return this; } public Criteria andIsFreeGreaterThanOrEqualTo(Integer value) { addCriterion("is_free >=", value, "isFree"); return this; } public Criteria andIsFreeLessThan(Integer value) { addCriterion("is_free <", value, "isFree"); return this; } public Criteria andIsFreeLessThanOrEqualTo(Integer value) { addCriterion("is_free <=", value, "isFree"); return this; } public Criteria andIsFreeIn(List values) { addCriterion("is_free in", values, "isFree"); return this; } public Criteria andIsFreeNotIn(List values) { addCriterion("is_free not in", values, "isFree"); return this; } public Criteria andIsFreeBetween(Integer value1, Integer value2) { addCriterion("is_free between", value1, value2, "isFree"); return this; } public Criteria andIsFreeNotBetween(Integer value1, Integer value2) { addCriterion("is_free not between", value1, value2, "isFree"); return this; } public Criteria andDeliveryCodeIsNull() { addCriterion("delivery_code is null"); return this; } public Criteria andDeliveryCodeIsNotNull() { addCriterion("delivery_code is not null"); return this; } public Criteria andDeliveryCodeEqualTo(String value) { addCriterion("delivery_code =", value, "deliveryCode"); return this; } public Criteria andDeliveryCodeNotEqualTo(String value) { addCriterion("delivery_code <>", value, "deliveryCode"); return this; } public Criteria andDeliveryCodeGreaterThan(String value) { addCriterion("delivery_code >", value, "deliveryCode"); return this; } public Criteria andDeliveryCodeGreaterThanOrEqualTo(String value) { addCriterion("delivery_code >=", value, "deliveryCode"); return this; } public Criteria andDeliveryCodeLessThan(String value) { addCriterion("delivery_code <", value, "deliveryCode"); return this; } public Criteria andDeliveryCodeLessThanOrEqualTo(String value) { addCriterion("delivery_code <=", value, "deliveryCode"); return this; } public Criteria andDeliveryCodeLike(String value) { addCriterion("delivery_code like", value, "deliveryCode"); return this; } public Criteria andDeliveryCodeNotLike(String value) { addCriterion("delivery_code not like", value, "deliveryCode"); return this; } public Criteria andDeliveryCodeIn(List values) { addCriterion("delivery_code in", values, "deliveryCode"); return this; } public Criteria andDeliveryCodeNotIn(List values) { addCriterion("delivery_code not in", values, "deliveryCode"); return this; } public Criteria andDeliveryCodeBetween(String value1, String value2) { addCriterion("delivery_code between", value1, value2, "deliveryCode"); return this; } public Criteria andDeliveryCodeNotBetween(String value1, String value2) { addCriterion("delivery_code not between", value1, value2, "deliveryCode"); return this; } } }
package controller; import Repository.UserRepository; import message.ResponseMessage; import model.User; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import java.util.List; import java.util.Optional; @Controller @CrossOrigin(origins = {"*"}, maxAge = 3600) @RequestMapping("/po/smestre3/user/*") public class UserContoller { @Autowired UserRepository userRepository; @PostMapping("/addUser") public ResponseEntity<?> saveUser(@Valid @RequestBody User user /* Integer id/*, BindingResult br*/) { Optional<User> p = userRepository.findById(user.getId()); if(!p.isPresent()) { userRepository.save(user); return new ResponseEntity<ResponseMessage>(new ResponseMessage("User enregistré"), HttpStatus.OK) ; } else { return new ResponseEntity<ResponseMessage>(new ResponseMessage("User existe déja"), HttpStatus.NOT_FOUND) ; } } @GetMapping(value = "/allUser") public ResponseEntity<?> getAllUser() { List<User> users = userRepository.findAll(); System.out.println("liste des User : " + users); if (users==null) return new ResponseEntity<ResponseMessage>(new ResponseMessage("liste vide "), HttpStatus.OK); return new ResponseEntity<List<User>>(users, HttpStatus.OK); } @PutMapping(value = "/update") public ResponseEntity<?> updateUser( @RequestBody User user) { Optional<User> c = userRepository.findById(user.getId()); if(c.isPresent() ) { User currentUser = c.get() ; currentUser.setNom(user.getNom()); currentUser.setPrenom(user.getPrenom()); currentUser.setAdresse(user.getAdresse()); currentUser.setArcheved(user.getArcheved()); currentUser.setPassword(user.getPassword()); currentUser.setProfil(user.getProfil()); currentUser.setTelephone(user.getTelephone()); currentUser.setCreated_date(user.getCreated_date()); currentUser.setLast_modified_date(user.getLast_modified_date()); userRepository.save(currentUser) ; return new ResponseEntity<ResponseMessage>(new ResponseMessage("User modifiée avec succès"), HttpStatus.OK) ; } else { return new ResponseEntity<ResponseMessage>(new ResponseMessage("User de la modification"), HttpStatus.NOT_FOUND) ; } } }
package org.firstinspires.ftc.teamcode.teamcode.libraries; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.util.ElapsedTime; import static org.firstinspires.ftc.teamcode.teamcode.libraries.Constants.GAMEPAD_JOYSTICK_TOLERANCE; import static org.firstinspires.ftc.teamcode.teamcode.libraries.Constants.GAMEPAD_TRIGGER_TOLERANCE; import static org.firstinspires.ftc.teamcode.teamcode.libraries.Constants.MOTOR_ARM; import static org.firstinspires.ftc.teamcode.teamcode.libraries.Constants.MOTOR_BACK_LEFT_WHEEL; import static org.firstinspires.ftc.teamcode.teamcode.libraries.Constants.MOTOR_BACK_RIGHT_WHEEL; import static org.firstinspires.ftc.teamcode.teamcode.libraries.Constants.MOTOR_FRONT_LEFT_WHEEL; import static org.firstinspires.ftc.teamcode.teamcode.libraries.Constants.MOTOR_FRONT_RIGHT_WHEEL; import static org.firstinspires.ftc.teamcode.teamcode.libraries.Constants.MOTOR_LEFT_INTAKE; import static org.firstinspires.ftc.teamcode.teamcode.libraries.Constants.MOTOR_RIGHT_INTAKE; import static org.firstinspires.ftc.teamcode.teamcode.libraries.Constants.MOTOR_TAPE; import static org.firstinspires.ftc.teamcode.teamcode.libraries.Constants.SERVO_AUTONOMOUS_ARM; import static org.firstinspires.ftc.teamcode.teamcode.libraries.Constants.SERVO_AUTONOMOUS_GRABBER; import static org.firstinspires.ftc.teamcode.teamcode.libraries.Constants.SERVO_AUTONOMOUS_GRABBER_GRAB; import static org.firstinspires.ftc.teamcode.teamcode.libraries.Constants.SERVO_AUTONOMOUS_UP_ARM; import static org.firstinspires.ftc.teamcode.teamcode.libraries.Constants.SERVO_CAPSTONE; import static org.firstinspires.ftc.teamcode.teamcode.libraries.Constants.SERVO_CAPSTONE_DROP; import static org.firstinspires.ftc.teamcode.teamcode.libraries.Constants.SERVO_CAPSTONE_HOLD; import static org.firstinspires.ftc.teamcode.teamcode.libraries.Constants.SERVO_FOUNDATION1; import static org.firstinspires.ftc.teamcode.teamcode.libraries.Constants.SERVO_FOUNDATION2; import static org.firstinspires.ftc.teamcode.teamcode.libraries.Constants.SERVO_FOUNDATION_GRAB1; import static org.firstinspires.ftc.teamcode.teamcode.libraries.Constants.SERVO_FOUNDATION_GRAB2; import static org.firstinspires.ftc.teamcode.teamcode.libraries.Constants.SERVO_FOUNDATION_REST1; import static org.firstinspires.ftc.teamcode.teamcode.libraries.Constants.SERVO_FOUNDATION_REST2; import static org.firstinspires.ftc.teamcode.teamcode.libraries.Constants.SERVO_GRABBER; import static org.firstinspires.ftc.teamcode.teamcode.libraries.Constants.SERVO_GRABBER_GRAB; import static org.firstinspires.ftc.teamcode.teamcode.libraries.Constants.SERVO_GRABBER_REST; import static org.firstinspires.ftc.teamcode.teamcode.libraries.Constants.SERVO_INTAKE; import static org.firstinspires.ftc.teamcode.teamcode.libraries.Constants.SERVO_SCORING_ARM; import static org.firstinspires.ftc.teamcode.teamcode.libraries.Constants.SERVO_SCORING_EXTEND; import static org.firstinspires.ftc.teamcode.teamcode.libraries.Constants.SERVO_SCORING_RETRACT; import static org.firstinspires.ftc.teamcode.teamcode.libraries.Constants.SERVO_STOPPER; import static org.firstinspires.ftc.teamcode.teamcode.libraries.Constants.SERVO_STOPPER_STOP; /* * Title: TeleLib * Date Created: 10/14/2018 * Date Modified: 2/27/2019 * Author: Poorvi, Sachin * Type: Library * Description: This will contain the methods for TeleOp, and other TeleOp-related programs. */ public class TeleLib { private Robot robot; private LinearOpMode opMode; private ElapsedTime latcherServoInputDelay; private ElapsedTime scoringServoInputDelay; private ElapsedTime intakeAngleServoInputDelay; private ElapsedTime servoArmInputDelay; private float speed; public TeleLib(LinearOpMode opMode) { robot = new Robot(opMode); this.opMode = opMode; opMode.gamepad1.setJoystickDeadzone(GAMEPAD_JOYSTICK_TOLERANCE); opMode.gamepad2.setJoystickDeadzone(GAMEPAD_JOYSTICK_TOLERANCE); // robot.setServoPosition(SERVO_GRABBER, SERVO_GRABBER_REST); latcherServoInputDelay = new ElapsedTime(); scoringServoInputDelay = new ElapsedTime(); intakeAngleServoInputDelay = new ElapsedTime(); } //gamepad1 public void processDrive() { // Values need to be reversed (up on joystick is -1) double r = Math.hypot(opMode.gamepad1.left_stick_x, -opMode.gamepad1.left_stick_y); //y ish changed to positive double robotAngle = Math.atan2(-opMode.gamepad1.left_stick_y, opMode.gamepad1.left_stick_x) - Math.PI / 4; double rightX = opMode.gamepad1.right_stick_x; final double v4 = r * Math.cos(robotAngle) - rightX; robot.setDcMotorPower(MOTOR_FRONT_LEFT_WHEEL, (float) (r * Math.cos(robotAngle) + rightX) * speed); robot.setDcMotorPower(MOTOR_FRONT_RIGHT_WHEEL, (float) (r * Math.sin(robotAngle) - rightX) * speed); robot.setDcMotorPower(MOTOR_BACK_LEFT_WHEEL, (float) (r * Math.sin(robotAngle) + rightX) * speed); robot.setDcMotorPower(MOTOR_BACK_RIGHT_WHEEL, (float) (r * Math.cos(robotAngle) - rightX) * speed); // speed = 1; if (opMode.gamepad1.dpad_left) { speed = 1; } else if (opMode.gamepad1.dpad_right) { speed = .5f; } // float powerFactor = 1; // boolean isDPadPressed = true; // // if (opMode.gamepad1.dpad_up && isDPadPressed) { // powerFactor = 3; // robot.setDcMotorPower(MOTOR_FRONT_LEFT_WHEEL, (float) (r * Math.cos(robotAngle) + rightX) / powerFactor); // robot.setDcMotorPower(MOTOR_FRONT_RIGHT_WHEEL, (float) (r * Math.sin(robotAngle) - rightX) / powerFactor); // robot.setDcMotorPower(MOTOR_BACK_LEFT_WHEEL, (float) (r * Math.sin(robotAngle) + rightX) / powerFactor); // robot.setDcMotorPower(MOTOR_BACK_RIGHT_WHEEL, (float) (r * Math.cos(robotAngle) - rightX) / powerFactor); // } // // if (opMode.gamepad1.dpad_down && isDPadPressed) { // robot.setDcMotorPower(MOTOR_FRONT_LEFT_WHEEL, (float) (r * Math.cos(robotAngle) + rightX)); // robot.setDcMotorPower(MOTOR_FRONT_RIGHT_WHEEL, (float) (r * Math.sin(robotAngle) - rightX)); // robot.setDcMotorPower(MOTOR_BACK_LEFT_WHEEL, (float) (r * Math.sin(robotAngle) + rightX)); // robot.setDcMotorPower(MOTOR_BACK_RIGHT_WHEEL, (float) (r * Math.cos(robotAngle) - rightX)); // } } // public void processDropCapstone() { // // if (opMode.gamepad2.dpad_down) { // robot.setServoPosition(SERVO_CAPSTONE, SERVO_CAPSTONE_DROP); // } // if (opMode.gamepad2.dpad_up) { // robot.setServoPosition(SERVO_CAPSTONE, SERVO_CAPSTONE_HOLD); // } // } // // public void processOutakeStone() { // if (opMode.gamepad1.left_bumper) { // robot.setDcMotorPower(MOTOR_RIGHT_INTAKE, .25f); // robot.setDcMotorPower(MOTOR_LEFT_INTAKE, -.25f); // robot.setServoPosition(SERVO_INTAKE, 1); // } // } // // public void holdCapstone () { // robot.setServoPosition(SERVO_CAPSTONE, SERVO_CAPSTONE_HOLD); // } // // public void processFoundation() { // if (opMode.gamepad1.a) { // robot.setServoPosition(SERVO_FOUNDATION1, SERVO_FOUNDATION_GRAB1); // robot.setServoPosition(SERVO_FOUNDATION2, SERVO_FOUNDATION_GRAB2); // // } else if (opMode.gamepad1.b) { // robot.setServoPosition(SERVO_FOUNDATION1, SERVO_FOUNDATION_REST1); // robot.setServoPosition(SERVO_FOUNDATION2, SERVO_FOUNDATION_REST2); // // } // } // // public void processStopIntake() { // if (opMode.gamepad1.y) { //|| !isBlockInIntake() // robot.setDcMotorPower(MOTOR_LEFT_INTAKE, 0); // robot.setDcMotorPower(MOTOR_RIGHT_INTAKE, 0); // robot.setServoPosition(SERVO_INTAKE, 0.5f); // } // } // //// private boolean isBlockInIntake() { //// if (distance <= 2) { //// return true; //// } else { //// return false; //// } //// //// return distance <= 2; //// } // // public void processIntakeStone() { // if (opMode.gamepad1.right_bumper) { // robot.setDcMotorPower(MOTOR_RIGHT_INTAKE, -.25f); // robot.setDcMotorPower(MOTOR_LEFT_INTAKE, .25f); // robot.setServoPosition(SERVO_INTAKE, 0); // } // } // // public void processTapeMeasure() { // if (opMode.gamepad1.right_trigger > GAMEPAD_TRIGGER_TOLERANCE) { // // Extend // robot.setDcMotorPower(MOTOR_TAPE, -1f); // } else if (opMode.gamepad1.left_trigger > GAMEPAD_TRIGGER_TOLERANCE) { // // Retract // robot.setDcMotorPower(MOTOR_TAPE, 1f); // } else { // robot.setDcMotorPower(MOTOR_TAPE, 0); // } // // } // // // //gamepad 2 // // public void processMoveArm() { // if (opMode.gamepad2.right_trigger > GAMEPAD_TRIGGER_TOLERANCE) { // // Extend // robot.setDcMotorPower(MOTOR_ARM, 1f); // } else if (opMode.gamepad2.left_trigger > GAMEPAD_TRIGGER_TOLERANCE) { // // Retract // robot.setDcMotorPower(MOTOR_ARM, -1f); // } else { // robot.setDcMotorPower(MOTOR_ARM, 0); // } // } // //// public void processAutonomousArm() { //// //// if (opMode.gamepad2.dpad_down) { //// robot.setServoPosition(SERVO_STOPPER, SERVO_STOPPER_REST); //// robot.setServoPosition(SERVO_AUTONOMOUS_ARM, SERVO_AUTONOMOUS_DOWN_ARM); //// } else if (opMode.gamepad2.dpad_up) { //// robot.setServoPosition(SERVO_AUTONOMOUS_ARM, SERVO_AUTONOMOUS_UP_ARM); //// robot.setServoPosition(SERVO_STOPPER, SERVO_STOPPER_STOP); //// } else if (opMode.gamepad2.dpad_left) { //// robot.setServoPosition(SERVO_AUTONOMOUS_ARM, SERVO_GRABBER_REST); //// } else if (opMode.gamepad2.dpad_right) { //// robot.setServoPosition(SERVO_AUTONOMOUS_ARM, SERVO_GRABBER_GRAB); //// } //// } // // public void processExtendArm() { // if (opMode.gamepad2.y) { // // Extend // robot.setServoPosition(SERVO_SCORING_ARM, SERVO_SCORING_EXTEND); // } // } // // public void processRetractArm() { // if (opMode.gamepad2.x) { // // Retract // robot.setServoPosition(SERVO_SCORING_ARM, SERVO_SCORING_RETRACT); // } // } // // public void processGrabStone() { // if (opMode.gamepad2.a) { // robot.setServoPosition(SERVO_GRABBER, SERVO_GRABBER_GRAB); // } // } // // public void processScoreStone() { // if (opMode.gamepad2.b) { // robot.setServoPosition(SERVO_GRABBER, SERVO_GRABBER_REST); // } // } // // public void restServoStopper() { // robot.setServoPosition(SERVO_STOPPER, SERVO_STOPPER_STOP); // } // // public void autonomousArmUp() { // robot.setServoPosition(SERVO_AUTONOMOUS_ARM, SERVO_AUTONOMOUS_UP_ARM); // } // // public void autonomousArmGrab() { // robot.setServoPosition(SERVO_AUTONOMOUS_GRABBER, SERVO_AUTONOMOUS_GRABBER_GRAB); // } } // // public void processScoreStone() { // if (opMode.gamepad2.x) { // robot.setServoPosition(SERVO_ARM, SERVO_ARM_POS_RECIEVE); // } // } // // public void processServoGrab() { // if (opMode.gamepad2.a) { // robot.setServoPosition(SERVO_GRABBER, SERVO_GRABBER_GRAB); // } else if (opMode.gamepad2.b) { // robot.setServoPosition(SERVO_GRABBER, SERVO_GRABBER_REST); // } // } // // public void processServoArm() { // if (opMode.gamepad2.y) { // robot.setServoPosition(SERVO_ARM, SERVO_ARM_POS_SCORE); // } // } // if (opMode.gamepad1.right_bumper && servoArmInputDelay.seconds() > .25) // if (robot.getServoPosition(SERVO_ARM) == SERVO_ARM_POS_RECIEVE) { // robot.setServoPosition(SERVO_ARM, SERVO_ARM_POS_RECIEVE); // } else { // robot.setServoPosition(SERVO_ARM, SERVO_ARM_POS_SCORE); // } // latcherServoInputDelay.reset(); // if (opMode.gamepad1.dpad_up && scoringServoInputDelay.seconds() > .2f) { // robot.setDeltaServoPosition(SERVO_ARM, .02f); // scoringServoInputDelay.reset(); // } else if (opMode.gamepad1.dpad_down && scoringServoInputDelay.seconds() > .2f) { // robot.setDeltaServoPosition(SERVO_ARM, -.02f); // scoringServoInputDelay.reset(); // } // } // if (opMode.gamepad2.dpad_up && intakeAngleServoInputDelay.seconds() > .2f) { // robot.setDeltaServoPosition(SERVO_FOUNDATION1, .02f); // intakeAngleServoInputDelay.reset(); // } else if (opMode.gamepad2.dpad_down && intakeAngleServoInputDelay.seconds() > .2f) { // robot.setDeltaServoPosition(SERVO_FOUNDATION2, -.02f); // intakeAngleServoInputDelay.reset(); // } // } // if (opMode.gamepad1.dpad_up && intakeAngleServoInputDelay.seconds() > .2f) { // robot.setDeltaServoPosition(SERVO_GRABBER, .02f); // intakeAngleServoInputDelay.reset(); // } else if (opMode.gamepad1.dpad_down && intakeAngleServoInputDelay.seconds() > .2f) { // robot.setDeltaServoPosition(SERVO_GRABBER, -.02f); // intakeAngleServoInputDelay.reset(); // }
/* * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package jdk.test.lib.cds; import java.util.ArrayList; // This class represents options used // during creation of CDS archive and/or running JVM with a CDS archive public class CDSOptions { public String xShareMode = "on"; public String archiveName; public ArrayList<String> prefix = new ArrayList<String>(); public ArrayList<String> suffix = new ArrayList<String>(); public boolean useSystemArchive = false; // classes to be archived public String[] classList; // Indicate whether to append "-version" when using CDS Archive. // Most of tests will use '-version' public boolean useVersion = true; public CDSOptions() { } public CDSOptions addPrefix(String... prefix) { for (String s : prefix) this.prefix.add(s); return this; } public CDSOptions addSuffix(String... suffix) { for (String s : suffix) this.suffix.add(s); return this; } public CDSOptions setXShareMode(String mode) { this.xShareMode = mode; return this; } public CDSOptions setArchiveName(String name) { this.archiveName = name; return this; } public CDSOptions setUseVersion(boolean use) { this.useVersion = use; return this; } public CDSOptions setUseSystemArchive(boolean use) { this.useSystemArchive = use; return this; } public CDSOptions setClassList(String[] list) { this.classList = list; return this; } public CDSOptions setClassList(ArrayList<String> list) { String array[] = new String[list.size()]; list.toArray(array); this.classList = array; return this; } }
package mg.egg.eggc.runtime.libjava; import java.io.IOException; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.xml.sax.Attributes; import org.xml.sax.ErrorHandler; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; import org.xml.sax.XMLReader; import org.xml.sax.helpers.DefaultHandler; public class EGGOptionsAnalyzer { private static final long serialVersionUID = 1L; private EGGOptions options; IEGGCompilationUnit cu; public EGGOptionsAnalyzer(IEGGCompilationUnit unit) throws EGGException { cu = unit; options = cu.getOptions(); // in = cu.getFileName(); } public class PrintError implements ErrorHandler { public void error(SAXParseException exception) throws SAXException { System.err.println("error: " + exception); exception.printStackTrace(); } public void fatalError(SAXParseException exception) throws SAXException { System.err.println("fatal error: " + exception); } public void warning(SAXParseException exception) throws SAXException { System.err.println("warning: " + exception); } } class BasketHandler extends DefaultHandler { private StringBuffer result = new StringBuffer(); public void startDocument() throws SAXException { } public void startElement(String namespaceURI, String localName, String qName, Attributes atts) { // System.err.println("start element : " + qName); if (qName.equals("egg")) { // System.err.println("egg : "); for (int i = 0; i < atts.getLength(); i++) { String aname = atts.getQName(i); String avalue = atts.getValue(i); if ("scanner".equals(aname)) { options.setLexer(avalue); } else if ("module".equals(aname)) { options.setModule("true".equals(avalue)); } else if ("lang".equals(aname)) { options.setLang(avalue); } else if ("gen".equals(aname)) { options.setDirectory(avalue); } else if ("prefix".equals(aname)) { options.setProject(avalue); } else if ("dst".equals(aname)) { options.setDst("true".equals(avalue)); } else if ("so".equals(aname)) { options.setSyntaxOnly("true".equals(avalue)); // } else if ("typage".equals(aname)) { // options.setTypage("true".equals(avalue)); } else if ("main".equals(aname)) { options.setMain("true".equals(avalue)); } } } else if (qName.equals("import")) { // System.err.println("import : "); for (int i = 0; i < atts.getLength(); i++) { String aname = atts.getQName(i); String avalue = atts.getValue(i); if ("lib".equals(aname)) { options.addLib(avalue); } } } } public void endElement(String namespaceURI, String localName, String qName) { } public void characters(char[] ch, int start, int length) { result.append(new String(ch, start, length)); } } public void analyse(InputSource is) throws ParserConfigurationException, SAXException, IOException { // System.err.println("Analyse_xml "); // try { SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setNamespaceAware(true); // activation de la validation (egg.dtd) // factory.setValidating(true); factory.setValidating(false); SAXParser parser = factory.newSAXParser(); BasketHandler handler = new BasketHandler(); XMLReader reader = parser.getXMLReader(); reader.setEntityResolver(handler); reader.setContentHandler(handler); // mise en place du gestionnaire d'erreur reader.setErrorHandler(new PrintError()); reader.parse(is); // System.err.println("Options = " + options); // cu.setState(); } public String getUsage() { StringBuffer sb = new StringBuffer(); sb.append("\nusage : egg.java.EGGC <file>"); sb.append("(see configuration file .ecf)\n"); return sb.toString(); } public String getHelp() { StringBuffer sb = new StringBuffer(); sb.append("\nusage : egg.java.EGGC <file>"); sb.append("[-?] : this help.\n"); return sb.toString(); } }
import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Servlet implementation class HelloWorld */ @WebServlet("/HelloWorld") public class HelloWorld extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String username = request.getParameter("username"); String password = request.getParameter("password"); response.setContentType("text/html"); PrintWriter pw = response.getWriter(); pw.println("<h2>"); pw.println("Username: " + username); pw.println("</h2><h2>"); pw.println("Password: " + password); pw.println("</h2>"); } }
package com.nks.whatsapp.marketing.app; import java.awt.BorderLayout; import java.awt.Dimension; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.UIManager; import com.nks.whatsapp.StorageException; import com.nks.whatsapp.WhatsApp; import com.nks.whatsapp.WhatsAppFactory; public class MainApplication extends JFrame{ private static final long serialVersionUID = 1L; private transient LoginDialog loginDialog; private MainPanel mainPanel; public MainApplication() { try{UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());}catch(Exception ex){} jbInit(); } private void jbInit() { try{ initializeResources(); }catch(Exception ex){ex.printStackTrace();JOptionPane.showMessageDialog(this, ex.getMessage()+ ", Error Initializing system, exitting");System.exit(0);} setLayout(new BorderLayout(0,0)); setSize(new Dimension(200,500)); loginDialog=new LoginDialog(this); loginDialog.setBackGround(Constants.getNormalApplicationBackgroudColor()); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); mainPanel=new MainPanel(this); this.add(mainPanel,BorderLayout.CENTER); this.setSize(390,685); //this.setResizable(false); setVisible(true); } private void initializeResources() throws Exception { SVGImages.loadImages(); SVGImages.checkDefaultLoaded(); } public static void main(String[] args) { MainApplication main=new MainApplication(); try{WhatsAppFactory.initStorage();}catch(StorageException strEx){JOptionPane.showMessageDialog(main, "Unable to initialize storage because of "+strEx.getMessage(), "Unable to load Storage", JOptionPane.ERROR_MESSAGE);strEx.printStackTrace();System.exit(0);} main.startApplication(); } public void startApplication() { loginDialog.setLocation(100,300); int option=loginDialog.showDialog(null); switch(option){ case LoginDialog.OK:{try{refreshPanels(WhatsAppFactory.getWhatsApp(loginDialog.getSelectedContact()));}catch(StorageException strEx){JOptionPane.showMessageDialog(this, "Unable to load Phone data because "+strEx.getMessage(), "Unable to load Phone", JOptionPane.ERROR_MESSAGE);this.loginDialog.showDialog(null);}break;} case LoginDialog.ADD:{JOptionPane.showMessageDialog(this, "Add Contact");System.exit(0);} case LoginDialog.CANCEL:{try{Thread.sleep(200);}catch(Exception ex){}System.exit(0);} } } public void refreshPanels(WhatsApp whatsApp) { mainPanel.updatePanel(whatsApp); } }
package q1; import java.util.Random; public class application { public static void main(String[] args) { int[][] arr = new int[5][5]; int[] arr2 = new int[25]; Random rn = new Random(); int a=0; for(int i=0; i <5; i++) { for(int j=0; j<5; j++) { arr[i][j]=a; a++; } } int c=0; for(int i=0; i <5; i++) { for(int j=0; j<5; j++) { arr2[c]=arr[i][j]; c++; } } for(int i=0; i <25; i++) { System.out.print(arr2[i]); System.out.print(" ");} } }
package com.jadn.cc.services; import java.util.List; import com.jadn.cc.core.Subscription; public interface SubscriptionHelper { public boolean addSubscription(Subscription toAdd); public void deleteAllSubscriptions(); public boolean editSubscription(Subscription original, Subscription updated); public List<Subscription> getSubscriptions(); public boolean removeSubscription(Subscription toRemove); public List<Subscription> resetToDemoSubscriptions(); boolean toggleSubscription(Subscription toToggle); }
package com.tencent.mm.plugin.appbrand.media.record.a; public interface c$a { void c(byte[] bArr, int i, boolean z); }
/** * tpshop * ============================================================================ * * 版权所有 2015-2027 深圳搜豹网络科技有限公司,并保留所有权利。 * 网站地址: http://www.tp-shop.cn * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用 . * 不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: 飞龙 16/01/15 $ * $description: 服务操数据配置获取 */ package com.tpshop.mallc.utils; import com.soubao.tpshop.utils.SPStringUtils; import com.tpshop.mallc.global.SPMobileApplication; import com.tpshop.mallc.model.SPServiceConfig; import java.util.List; /** * Created by admin on 2016/6/29. */ public class SPServerUtils { final static String CONFIG_TPSHOP_HTTP = "tpshop_http"; final static String CONFIG_QQ = "qq"; final static String CONFIG_QQ1 = "qq1"; final static String CONFIG_STORE_NAME = "store_name"; final static String CONFIG_POINT_RATE = "point_rate";//积分抵扣金额 final static String CONFIG_PHONE = "phone"; final static String CONFIG_ADDRESS = "address"; final static String CONFIG_WORK_TIME = "worktime"; final static String CONFIG_HOT_KEYWORDS = "hot_keywords"; final static String CONFIG_KEY_SMS_TIME_OUT = "sms_time_out"; final static String CONFIG_KEY_REG_SMS_ENABLE = "sms_enable"; /** * 获取联系客服QQ * * @return return value description */ public static String getCustomerQQ(){ return getConfigValue(CONFIG_QQ); } /** * 获取商城名称 * * @return return value description */ public static String getStoreName(){ return getConfigValue(CONFIG_STORE_NAME); } /** * 获取积分抵扣金额 * * @return return value description */ public static String getPointRate(){ return getConfigValue(CONFIG_POINT_RATE); } /** * 根据名称获取配置的值 * * @param name name description * * @return return value description */ public static String getConfigValue(String name){ List<SPServiceConfig> serviceConfigs = SPMobileApplication.getInstance().getServiceConfigs(); if (serviceConfigs!= null && serviceConfigs.size() > 0) { for (SPServiceConfig config : serviceConfigs) { if (name.equals(config.getName())){ return config.getValue(); } } } return name; } /** * 上班时间 * * @return return value description */ public static String getWorkTime(){ String worktime = getConfigValue(CONFIG_WORK_TIME); if(SPStringUtils.isEmpty(worktime)){ worktime = "(周一致周五) 08:00-19:00 (周六日) 休息"; } return worktime; } /** * 售后收货地址 * * @return return value description */ public static String getAddress(){ return getConfigValue(CONFIG_ADDRESS); } /** * 售后客服电话 * * @return return value description */ public static String getServicePhone(){ return getConfigValue(CONFIG_PHONE); } /** * 搜索关键词 * * @return return value description */ public static List<String> getHotKeyword(){ List<String> hotwords = null; String hotword = getConfigValue(CONFIG_HOT_KEYWORDS); if (!SPStringUtils.isEmpty(hotword)) { hotwords = SPStringUtils.stringToList(hotword , "|"); } return hotwords; } /** * 注册短信, 超时时间(单位:s) * * @return */ public static int getSmsTimeOut(){ String timeout = getConfigValue(CONFIG_KEY_SMS_TIME_OUT); if (!SPStringUtils.isEmpty(timeout)) { return Integer.valueOf(timeout); } return 0; } /** * 是否启用短信验证码 * * @return */ public static boolean enableSmsCheckCode() { String smsEnable = getConfigValue(CONFIG_KEY_REG_SMS_ENABLE); if (!SPStringUtils.isEmpty(smsEnable)) { return Boolean.valueOf(smsEnable); } return false; } }
package com.github.vinja.server; import java.io.PrintWriter; import java.io.StringWriter; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import com.github.vinja.util.BufferStore; import com.github.vinja.util.IdGenerator; import com.github.vinja.util.VjdeUtil; public abstract class SzjdeShextCommand extends SzjdeCommand { private StringWriter strWriter = new StringWriter(); private StringBuffer buffer = strWriter.getBuffer(); protected ScheduledExecutorService exec = null; protected PrintWriter out = new PrintWriter(strWriter); protected String uuid; protected String vimServerName; protected String bufname ; public String execute() { vimServerName = params.get(SzjdeConstants.PARAM_VIM_SERVER); bufname = params.get(SzjdeConstants.PARAM_BUF_NAME); uuid=IdGenerator.getUniqueId(); BufferStore.put(uuid, buffer); exec = Executors.newScheduledThreadPool(1); exec.scheduleAtFixedRate(new BufferChecker(buffer,uuid), 1, 200, TimeUnit.MILLISECONDS); Thread job = createShextJob(); JobFinishNotifier notifier = new JobFinishNotifier(job); job.start(); notifier.start(); return ""; } public abstract Thread createShextJob() ; public Thread callBackJob () { return null; } public abstract String getCmdName() ; class JobFinishNotifier extends Thread { private Thread job = null; public JobFinishNotifier(Thread job) { this.job = job; } public void run() { try { job.join(); } catch (InterruptedException e) { } out.println(""); out.println("(" + getCmdName() + " finished.)"); new BufferChecker(buffer,uuid).run(); exec.shutdown(); Thread callBackJob = callBackJob(); if (callBackJob != null) { callBackJob.start(); } } } class BufferChecker implements Runnable { private StringBuffer buffer; private String uuid; private BufferChecker(StringBuffer buffer,String uuid) { this.buffer = buffer; this.uuid = uuid; } public void run() { synchronized (buffer) { if ( ! (buffer.length() > 0)) return; String[] args = new String[] { uuid,bufname }; VjdeUtil.callVimFunc(vimServerName, "FetchResult", args); } } } }
package Algorithm; import java.util.LinkedList; public class a394 { // public String decodeString(String s) { // StringBuilder res = new StringBuilder(); // int multi = 0; // LinkedList<Integer> stack_multi = new LinkedList<>(); // LinkedList<String> stack_res = new LinkedList<>(); // for(Character c : s.toCharArray()) { // if(c == '[') { // stack_multi.addLast(multi); // stack_res.addLast(res.toString()); // multi = 0; // res = new StringBuilder(); // } // else if(c == ']') { // StringBuilder tmp = new StringBuilder(); // int cur_multi = stack_multi.removeLast(); // for(int i = 0; i < cur_multi; i++) tmp.append(res); // res = new StringBuilder(stack_res.removeLast() + tmp); // } // else if(c >= '0' && c <= '9') multi = multi * 10 + Integer.parseInt(c + ""); // else res.append(c); // } // return res.toString(); // } public String decodeString(String s) { StringBuilder sb= new StringBuilder(); LinkedList<String> str=new LinkedList<>(); LinkedList<Integer> num=new LinkedList<>(); int curnum=0; for (char c:s.toCharArray()){ if (c=='['){ str.add(sb.toString()); num.add(curnum); sb=new StringBuilder(); curnum=0; }else if (c==']'){ StringBuilder temp=new StringBuilder(); int times=num.pollLast(); for (int i=0;i<times;i++){ temp.append(sb.toString()); } sb=new StringBuilder(str.pollLast()+temp.toString()); }else if (c>='0'&&c<='9'){ curnum=curnum*10+Integer.parseInt(c+""); }else { sb.append(c); } } return sb.toString(); } }
package br.com.senac.action; import java.sql.SQLException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import br.com.senac.bo.PerfilBO; import br.com.senac.excecao.ActionException; import br.com.senac.excecao.FalhaBancoException; public class DeleteAction implements Action { @Override public String execute(HttpServletRequest request, HttpServletResponse response) throws ActionException { int userId = Integer.parseInt(request.getParameter("id")); PerfilBO perfilBO = new PerfilBO(); try { perfilBO.excluir(userId); request.setAttribute("message", "Aluno excluído com sucesso."); } catch (FalhaBancoException | SQLException e) { request.setAttribute("message", e); } return "busca"; } }
// Departamento.java package inmobiliarias; public class Departamento extends Inmueble { private boolean cochera; private boolean baulera; public Departamento(String domicilio, double superficie, int cantidadAmbientes, int precio, boolean cochera, boolean baulera) { super(domicilio, superficie, cantidadAmbientes, precio); this.cochera = cochera; this.baulera = baulera; } public boolean getCochera() { return cochera; } public boolean getBaulera() { return baulera; } public String imprimirDatos() { String strDepartamento = String.format("\nCochera: %b.\nCochera: %b.\n", this.getCochera(), this.getBaulera()); return super.imprimirDatos() + strDepartamento; } // nuevo m�todo: public double comisionVendedor() { if (getCochera()) return 0.009 * getPrecio(); else return 0.011 * getPrecio(); } }
package com.deltastuido.infrastructure; import java.util.concurrent.TimeUnit; import javax.enterprise.context.ApplicationScoped; import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; @ApplicationScoped public class AutoEvictedCache { static private final Cache<String, Object> cache = CacheBuilder.newBuilder() .maximumSize(1_000_000).expireAfterWrite(2, TimeUnit.MINUTES) .build(); public void put(String key, Object object) { cache.put(key, object); } public Object get(String key) { return cache.getIfPresent(key); } }
package com.example.danielatienza.farmdropapp.model; import android.os.Parcel; import android.os.Parcelable; /** * Created by danielatienza on 14/12/2016. */ public class Pagination implements Parcelable { int current; int previous; int next; int per_page; int pages; int count; @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeInt(this.current); dest.writeInt(this.previous); dest.writeInt(this.next); dest.writeInt(this.per_page); dest.writeInt(this.pages); dest.writeInt(this.count); } public Pagination() { } protected Pagination(Parcel in) { this.current = in.readInt(); this.previous = in.readInt(); this.next = in.readInt(); this.per_page = in.readInt(); this.pages = in.readInt(); this.count = in.readInt(); } public static final Parcelable.Creator<Pagination> CREATOR = new Parcelable.Creator<Pagination>() { @Override public Pagination createFromParcel(Parcel source) { return new Pagination(source); } @Override public Pagination[] newArray(int size) { return new Pagination[size]; } }; }
/* * MIT License * * Copyright (c) 2019 Bayu Dwiyan Satria * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ import com.bayudwiyansatria.environment.apache.spark.*; import org.apache.spark.api.java.JavaRDD; import org.apache.spark.mllib.clustering.BisectingKMeans; import org.apache.spark.mllib.linalg.Vector; import org.apache.spark.mllib.linalg.Vectors; import java.io.Serializable; public class FunctionTest implements Serializable { public static void main(String[] args){ double Vw; double Vb; double maxop = 0; double secop = 0; int maxpost = 0; int secpost = 0; String dataSource = "hdfs://hdfs.bayudwiyansatria.com:9000/home/bayudwiyansatria/resources/ruspini"; JavaRDD<String> dataDouble = new SparkIO().readData(dataSource+".csv"); JavaRDD<Vector> vectorData = new SparkIO().readData(dataDouble); double[][] data = new com.bayudwiyansatria.io.IO().readCSV_double("src/main/resources/ruspini"); double [] variance = new com.bayudwiyansatria.mat.Mat().initArray(data.length, 0.0); double [] globalOptimum = new com.bayudwiyansatria.mat.Mat().initArray(data.length, 0.0); //proses mencari variance for (int i = 0; i < data.length; i++){ int[] clusters = new com.bayudwiyansatria.ml.clustering.Clustering().HierarchicalClustering().SingleLinkage(data, i+2); double[] V = new com.bayudwiyansatria.ml.ML().getVariance(data, clusters); Vw = V[0]; Vb = V[1]; variance[data.length-i-1] = (Vw/Vb)*100; } for (int i = 0; i < data.length;i++) { //proses mencari global optimum if (i <= data.length - 3) { globalOptimum[i] = (variance[i + 2] + variance[i]) - (2 * variance[i + 1]); } else if (i <= data.length - 2) { globalOptimum[i] = (variance[0] + variance[i]) - (2 * variance[i + 1]); } else { globalOptimum[i] = variance[i]; //membulatkan negatif menjadi nol if (globalOptimum[i] < 0) { globalOptimum[i] = 0; } //mencari maximum optimal if (globalOptimum[i] > maxop) { secpost = maxpost; maxpost = i; secop = maxop; maxop = globalOptimum[i]; } } new com.bayudwiyansatria.mat.Mat().print("Akurasi", maxop / secop); new com.bayudwiyansatria.mat.Mat().print("Cluster Terbaik", maxpost + 1); new com.bayudwiyansatria.mat.Mat().print("Cluster Terbaik Kedua", secpost + 1); //L.setDraw(globalOptimum,true); //libs.ExternalLibs().VectorLib().setDraw(variance,true); } } }
// Double colon operator - Method reference and constructor Reference interface Bike { public String getName(); } class Engine { Engine() { System.out.println("Engine is created !!"); } } interface NewBike { public Engine getEngine(); } class Honda { public static String printName() { return "Honda - static"; } public String displayName() { return "Honda - instance"; } public static void main(String args[]) { // Method Reference - Static Methods Bike b1 = Honda::printName; System.out.println(b1.getName()); // Method Reference - Instance Methods Honda h = new Honda(); Bike b2 = h::displayName; System.out.println(b2.getName()); // Without Constructor Reference NewBike b3 = () -> new Engine() ; b3.getEngine(); // Constructor Reference NewBike b4 = Engine :: new; b4.getEngine(); } }
package lesson10.task1; public class Demo { public static void main(String[] args) { Student anyStudent = new Student (); //Создать переменную типа Student, которая ссылается // на объект типа Aspirant. Aspirant aspirant = new Aspirant("One", "Two", "Three", "Four"); Student student = new Student(); System.out.println(aspirant); System.out.println(student); Student[] students = new Student[2]; students[0] = aspirant; students[1] = student; for (Student student1 : students) { System.out.println(student1.getScholarship()); System.out.println(student); } System.out.println(anyStudent.equals(student)); } }
package shop.pojo; import java.util.ArrayList; import java.util.Date; import java.util.List; public class TSellerAddrExample { protected String orderByClause; protected boolean distinct; protected List<Criteria> oredCriteria; public TSellerAddrExample() { oredCriteria = new ArrayList<Criteria>(); } public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; } public String getOrderByClause() { return orderByClause; } public void setDistinct(boolean distinct) { this.distinct = distinct; } public boolean isDistinct() { return distinct; } public List<Criteria> getOredCriteria() { return oredCriteria; } public void or(Criteria criteria) { oredCriteria.add(criteria); } public Criteria or() { Criteria criteria = createCriteriaInternal(); oredCriteria.add(criteria); return criteria; } public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); if (oredCriteria.size() == 0) { oredCriteria.add(criteria); } return criteria; } protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); return criteria; } public void clear() { oredCriteria.clear(); orderByClause = null; distinct = false; } protected abstract static class GeneratedCriteria { protected List<Criterion> criteria; protected GeneratedCriteria() { super(); criteria = new ArrayList<Criterion>(); } public boolean isValid() { return criteria.size() > 0; } public List<Criterion> getAllCriteria() { return criteria; } public List<Criterion> getCriteria() { return criteria; } protected void addCriterion(String condition) { if (condition == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion(condition)); } protected void addCriterion(String condition, Object value, String property) { if (value == null) { throw new RuntimeException("Value for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value)); } protected void addCriterion(String condition, Object value1, Object value2, String property) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value1, value2)); } public Criteria andIdIsNull() { addCriterion("id is null"); return (Criteria) this; } public Criteria andIdIsNotNull() { addCriterion("id is not null"); return (Criteria) this; } public Criteria andIdEqualTo(Long value) { addCriterion("id =", value, "id"); return (Criteria) this; } public Criteria andIdNotEqualTo(Long value) { addCriterion("id <>", value, "id"); return (Criteria) this; } public Criteria andIdGreaterThan(Long value) { addCriterion("id >", value, "id"); return (Criteria) this; } public Criteria andIdGreaterThanOrEqualTo(Long value) { addCriterion("id >=", value, "id"); return (Criteria) this; } public Criteria andIdLessThan(Long value) { addCriterion("id <", value, "id"); return (Criteria) this; } public Criteria andIdLessThanOrEqualTo(Long value) { addCriterion("id <=", value, "id"); return (Criteria) this; } public Criteria andIdIn(List<Long> values) { addCriterion("id in", values, "id"); return (Criteria) this; } public Criteria andIdNotIn(List<Long> values) { addCriterion("id not in", values, "id"); return (Criteria) this; } public Criteria andIdBetween(Long value1, Long value2) { addCriterion("id between", value1, value2, "id"); return (Criteria) this; } public Criteria andIdNotBetween(Long value1, Long value2) { addCriterion("id not between", value1, value2, "id"); return (Criteria) this; } public Criteria andSellerIdIsNull() { addCriterion("seller_id is null"); return (Criteria) this; } public Criteria andSellerIdIsNotNull() { addCriterion("seller_id is not null"); return (Criteria) this; } public Criteria andSellerIdEqualTo(String value) { addCriterion("seller_id =", value, "sellerId"); return (Criteria) this; } public Criteria andSellerIdNotEqualTo(String value) { addCriterion("seller_id <>", value, "sellerId"); return (Criteria) this; } public Criteria andSellerIdGreaterThan(String value) { addCriterion("seller_id >", value, "sellerId"); return (Criteria) this; } public Criteria andSellerIdGreaterThanOrEqualTo(String value) { addCriterion("seller_id >=", value, "sellerId"); return (Criteria) this; } public Criteria andSellerIdLessThan(String value) { addCriterion("seller_id <", value, "sellerId"); return (Criteria) this; } public Criteria andSellerIdLessThanOrEqualTo(String value) { addCriterion("seller_id <=", value, "sellerId"); return (Criteria) this; } public Criteria andSellerIdLike(String value) { addCriterion("seller_id like", value, "sellerId"); return (Criteria) this; } public Criteria andSellerIdNotLike(String value) { addCriterion("seller_id not like", value, "sellerId"); return (Criteria) this; } public Criteria andSellerIdIn(List<String> values) { addCriterion("seller_id in", values, "sellerId"); return (Criteria) this; } public Criteria andSellerIdNotIn(List<String> values) { addCriterion("seller_id not in", values, "sellerId"); return (Criteria) this; } public Criteria andSellerIdBetween(String value1, String value2) { addCriterion("seller_id between", value1, value2, "sellerId"); return (Criteria) this; } public Criteria andSellerIdNotBetween(String value1, String value2) { addCriterion("seller_id not between", value1, value2, "sellerId"); return (Criteria) this; } public Criteria andAreaIdIsNull() { addCriterion("area_id is null"); return (Criteria) this; } public Criteria andAreaIdIsNotNull() { addCriterion("area_id is not null"); return (Criteria) this; } public Criteria andAreaIdEqualTo(Long value) { addCriterion("area_id =", value, "areaId"); return (Criteria) this; } public Criteria andAreaIdNotEqualTo(Long value) { addCriterion("area_id <>", value, "areaId"); return (Criteria) this; } public Criteria andAreaIdGreaterThan(Long value) { addCriterion("area_id >", value, "areaId"); return (Criteria) this; } public Criteria andAreaIdGreaterThanOrEqualTo(Long value) { addCriterion("area_id >=", value, "areaId"); return (Criteria) this; } public Criteria andAreaIdLessThan(Long value) { addCriterion("area_id <", value, "areaId"); return (Criteria) this; } public Criteria andAreaIdLessThanOrEqualTo(Long value) { addCriterion("area_id <=", value, "areaId"); return (Criteria) this; } public Criteria andAreaIdIn(List<Long> values) { addCriterion("area_id in", values, "areaId"); return (Criteria) this; } public Criteria andAreaIdNotIn(List<Long> values) { addCriterion("area_id not in", values, "areaId"); return (Criteria) this; } public Criteria andAreaIdBetween(Long value1, Long value2) { addCriterion("area_id between", value1, value2, "areaId"); return (Criteria) this; } public Criteria andAreaIdNotBetween(Long value1, Long value2) { addCriterion("area_id not between", value1, value2, "areaId"); return (Criteria) this; } public Criteria andProvinceIdIsNull() { addCriterion("province_id is null"); return (Criteria) this; } public Criteria andProvinceIdIsNotNull() { addCriterion("province_id is not null"); return (Criteria) this; } public Criteria andProvinceIdEqualTo(String value) { addCriterion("province_id =", value, "provinceId"); return (Criteria) this; } public Criteria andProvinceIdNotEqualTo(String value) { addCriterion("province_id <>", value, "provinceId"); return (Criteria) this; } public Criteria andProvinceIdGreaterThan(String value) { addCriterion("province_id >", value, "provinceId"); return (Criteria) this; } public Criteria andProvinceIdGreaterThanOrEqualTo(String value) { addCriterion("province_id >=", value, "provinceId"); return (Criteria) this; } public Criteria andProvinceIdLessThan(String value) { addCriterion("province_id <", value, "provinceId"); return (Criteria) this; } public Criteria andProvinceIdLessThanOrEqualTo(String value) { addCriterion("province_id <=", value, "provinceId"); return (Criteria) this; } public Criteria andProvinceIdLike(String value) { addCriterion("province_id like", value, "provinceId"); return (Criteria) this; } public Criteria andProvinceIdNotLike(String value) { addCriterion("province_id not like", value, "provinceId"); return (Criteria) this; } public Criteria andProvinceIdIn(List<String> values) { addCriterion("province_id in", values, "provinceId"); return (Criteria) this; } public Criteria andProvinceIdNotIn(List<String> values) { addCriterion("province_id not in", values, "provinceId"); return (Criteria) this; } public Criteria andProvinceIdBetween(String value1, String value2) { addCriterion("province_id between", value1, value2, "provinceId"); return (Criteria) this; } public Criteria andProvinceIdNotBetween(String value1, String value2) { addCriterion("province_id not between", value1, value2, "provinceId"); return (Criteria) this; } public Criteria andProvinceNameIsNull() { addCriterion("province_name is null"); return (Criteria) this; } public Criteria andProvinceNameIsNotNull() { addCriterion("province_name is not null"); return (Criteria) this; } public Criteria andProvinceNameEqualTo(String value) { addCriterion("province_name =", value, "provinceName"); return (Criteria) this; } public Criteria andProvinceNameNotEqualTo(String value) { addCriterion("province_name <>", value, "provinceName"); return (Criteria) this; } public Criteria andProvinceNameGreaterThan(String value) { addCriterion("province_name >", value, "provinceName"); return (Criteria) this; } public Criteria andProvinceNameGreaterThanOrEqualTo(String value) { addCriterion("province_name >=", value, "provinceName"); return (Criteria) this; } public Criteria andProvinceNameLessThan(String value) { addCriterion("province_name <", value, "provinceName"); return (Criteria) this; } public Criteria andProvinceNameLessThanOrEqualTo(String value) { addCriterion("province_name <=", value, "provinceName"); return (Criteria) this; } public Criteria andProvinceNameLike(String value) { addCriterion("province_name like", value, "provinceName"); return (Criteria) this; } public Criteria andProvinceNameNotLike(String value) { addCriterion("province_name not like", value, "provinceName"); return (Criteria) this; } public Criteria andProvinceNameIn(List<String> values) { addCriterion("province_name in", values, "provinceName"); return (Criteria) this; } public Criteria andProvinceNameNotIn(List<String> values) { addCriterion("province_name not in", values, "provinceName"); return (Criteria) this; } public Criteria andProvinceNameBetween(String value1, String value2) { addCriterion("province_name between", value1, value2, "provinceName"); return (Criteria) this; } public Criteria andProvinceNameNotBetween(String value1, String value2) { addCriterion("province_name not between", value1, value2, "provinceName"); return (Criteria) this; } public Criteria andCityIdIsNull() { addCriterion("city_id is null"); return (Criteria) this; } public Criteria andCityIdIsNotNull() { addCriterion("city_id is not null"); return (Criteria) this; } public Criteria andCityIdEqualTo(String value) { addCriterion("city_id =", value, "cityId"); return (Criteria) this; } public Criteria andCityIdNotEqualTo(String value) { addCriterion("city_id <>", value, "cityId"); return (Criteria) this; } public Criteria andCityIdGreaterThan(String value) { addCriterion("city_id >", value, "cityId"); return (Criteria) this; } public Criteria andCityIdGreaterThanOrEqualTo(String value) { addCriterion("city_id >=", value, "cityId"); return (Criteria) this; } public Criteria andCityIdLessThan(String value) { addCriterion("city_id <", value, "cityId"); return (Criteria) this; } public Criteria andCityIdLessThanOrEqualTo(String value) { addCriterion("city_id <=", value, "cityId"); return (Criteria) this; } public Criteria andCityIdLike(String value) { addCriterion("city_id like", value, "cityId"); return (Criteria) this; } public Criteria andCityIdNotLike(String value) { addCriterion("city_id not like", value, "cityId"); return (Criteria) this; } public Criteria andCityIdIn(List<String> values) { addCriterion("city_id in", values, "cityId"); return (Criteria) this; } public Criteria andCityIdNotIn(List<String> values) { addCriterion("city_id not in", values, "cityId"); return (Criteria) this; } public Criteria andCityIdBetween(String value1, String value2) { addCriterion("city_id between", value1, value2, "cityId"); return (Criteria) this; } public Criteria andCityIdNotBetween(String value1, String value2) { addCriterion("city_id not between", value1, value2, "cityId"); return (Criteria) this; } public Criteria andCityNameIsNull() { addCriterion("city_name is null"); return (Criteria) this; } public Criteria andCityNameIsNotNull() { addCriterion("city_name is not null"); return (Criteria) this; } public Criteria andCityNameEqualTo(String value) { addCriterion("city_name =", value, "cityName"); return (Criteria) this; } public Criteria andCityNameNotEqualTo(String value) { addCriterion("city_name <>", value, "cityName"); return (Criteria) this; } public Criteria andCityNameGreaterThan(String value) { addCriterion("city_name >", value, "cityName"); return (Criteria) this; } public Criteria andCityNameGreaterThanOrEqualTo(String value) { addCriterion("city_name >=", value, "cityName"); return (Criteria) this; } public Criteria andCityNameLessThan(String value) { addCriterion("city_name <", value, "cityName"); return (Criteria) this; } public Criteria andCityNameLessThanOrEqualTo(String value) { addCriterion("city_name <=", value, "cityName"); return (Criteria) this; } public Criteria andCityNameLike(String value) { addCriterion("city_name like", value, "cityName"); return (Criteria) this; } public Criteria andCityNameNotLike(String value) { addCriterion("city_name not like", value, "cityName"); return (Criteria) this; } public Criteria andCityNameIn(List<String> values) { addCriterion("city_name in", values, "cityName"); return (Criteria) this; } public Criteria andCityNameNotIn(List<String> values) { addCriterion("city_name not in", values, "cityName"); return (Criteria) this; } public Criteria andCityNameBetween(String value1, String value2) { addCriterion("city_name between", value1, value2, "cityName"); return (Criteria) this; } public Criteria andCityNameNotBetween(String value1, String value2) { addCriterion("city_name not between", value1, value2, "cityName"); return (Criteria) this; } public Criteria andDistrictIdIsNull() { addCriterion("district_id is null"); return (Criteria) this; } public Criteria andDistrictIdIsNotNull() { addCriterion("district_id is not null"); return (Criteria) this; } public Criteria andDistrictIdEqualTo(Integer value) { addCriterion("district_id =", value, "districtId"); return (Criteria) this; } public Criteria andDistrictIdNotEqualTo(Integer value) { addCriterion("district_id <>", value, "districtId"); return (Criteria) this; } public Criteria andDistrictIdGreaterThan(Integer value) { addCriterion("district_id >", value, "districtId"); return (Criteria) this; } public Criteria andDistrictIdGreaterThanOrEqualTo(Integer value) { addCriterion("district_id >=", value, "districtId"); return (Criteria) this; } public Criteria andDistrictIdLessThan(Integer value) { addCriterion("district_id <", value, "districtId"); return (Criteria) this; } public Criteria andDistrictIdLessThanOrEqualTo(Integer value) { addCriterion("district_id <=", value, "districtId"); return (Criteria) this; } public Criteria andDistrictIdIn(List<Integer> values) { addCriterion("district_id in", values, "districtId"); return (Criteria) this; } public Criteria andDistrictIdNotIn(List<Integer> values) { addCriterion("district_id not in", values, "districtId"); return (Criteria) this; } public Criteria andDistrictIdBetween(Integer value1, Integer value2) { addCriterion("district_id between", value1, value2, "districtId"); return (Criteria) this; } public Criteria andDistrictIdNotBetween(Integer value1, Integer value2) { addCriterion("district_id not between", value1, value2, "districtId"); return (Criteria) this; } public Criteria andDistrictNameIsNull() { addCriterion("district_name is null"); return (Criteria) this; } public Criteria andDistrictNameIsNotNull() { addCriterion("district_name is not null"); return (Criteria) this; } public Criteria andDistrictNameEqualTo(String value) { addCriterion("district_name =", value, "districtName"); return (Criteria) this; } public Criteria andDistrictNameNotEqualTo(String value) { addCriterion("district_name <>", value, "districtName"); return (Criteria) this; } public Criteria andDistrictNameGreaterThan(String value) { addCriterion("district_name >", value, "districtName"); return (Criteria) this; } public Criteria andDistrictNameGreaterThanOrEqualTo(String value) { addCriterion("district_name >=", value, "districtName"); return (Criteria) this; } public Criteria andDistrictNameLessThan(String value) { addCriterion("district_name <", value, "districtName"); return (Criteria) this; } public Criteria andDistrictNameLessThanOrEqualTo(String value) { addCriterion("district_name <=", value, "districtName"); return (Criteria) this; } public Criteria andDistrictNameLike(String value) { addCriterion("district_name like", value, "districtName"); return (Criteria) this; } public Criteria andDistrictNameNotLike(String value) { addCriterion("district_name not like", value, "districtName"); return (Criteria) this; } public Criteria andDistrictNameIn(List<String> values) { addCriterion("district_name in", values, "districtName"); return (Criteria) this; } public Criteria andDistrictNameNotIn(List<String> values) { addCriterion("district_name not in", values, "districtName"); return (Criteria) this; } public Criteria andDistrictNameBetween(String value1, String value2) { addCriterion("district_name between", value1, value2, "districtName"); return (Criteria) this; } public Criteria andDistrictNameNotBetween(String value1, String value2) { addCriterion("district_name not between", value1, value2, "districtName"); return (Criteria) this; } public Criteria andCountryIsNull() { addCriterion("country is null"); return (Criteria) this; } public Criteria andCountryIsNotNull() { addCriterion("country is not null"); return (Criteria) this; } public Criteria andCountryEqualTo(String value) { addCriterion("country =", value, "country"); return (Criteria) this; } public Criteria andCountryNotEqualTo(String value) { addCriterion("country <>", value, "country"); return (Criteria) this; } public Criteria andCountryGreaterThan(String value) { addCriterion("country >", value, "country"); return (Criteria) this; } public Criteria andCountryGreaterThanOrEqualTo(String value) { addCriterion("country >=", value, "country"); return (Criteria) this; } public Criteria andCountryLessThan(String value) { addCriterion("country <", value, "country"); return (Criteria) this; } public Criteria andCountryLessThanOrEqualTo(String value) { addCriterion("country <=", value, "country"); return (Criteria) this; } public Criteria andCountryLike(String value) { addCriterion("country like", value, "country"); return (Criteria) this; } public Criteria andCountryNotLike(String value) { addCriterion("country not like", value, "country"); return (Criteria) this; } public Criteria andCountryIn(List<String> values) { addCriterion("country in", values, "country"); return (Criteria) this; } public Criteria andCountryNotIn(List<String> values) { addCriterion("country not in", values, "country"); return (Criteria) this; } public Criteria andCountryBetween(String value1, String value2) { addCriterion("country between", value1, value2, "country"); return (Criteria) this; } public Criteria andCountryNotBetween(String value1, String value2) { addCriterion("country not between", value1, value2, "country"); return (Criteria) this; } public Criteria andContactNameIsNull() { addCriterion("contact_name is null"); return (Criteria) this; } public Criteria andContactNameIsNotNull() { addCriterion("contact_name is not null"); return (Criteria) this; } public Criteria andContactNameEqualTo(String value) { addCriterion("contact_name =", value, "contactName"); return (Criteria) this; } public Criteria andContactNameNotEqualTo(String value) { addCriterion("contact_name <>", value, "contactName"); return (Criteria) this; } public Criteria andContactNameGreaterThan(String value) { addCriterion("contact_name >", value, "contactName"); return (Criteria) this; } public Criteria andContactNameGreaterThanOrEqualTo(String value) { addCriterion("contact_name >=", value, "contactName"); return (Criteria) this; } public Criteria andContactNameLessThan(String value) { addCriterion("contact_name <", value, "contactName"); return (Criteria) this; } public Criteria andContactNameLessThanOrEqualTo(String value) { addCriterion("contact_name <=", value, "contactName"); return (Criteria) this; } public Criteria andContactNameLike(String value) { addCriterion("contact_name like", value, "contactName"); return (Criteria) this; } public Criteria andContactNameNotLike(String value) { addCriterion("contact_name not like", value, "contactName"); return (Criteria) this; } public Criteria andContactNameIn(List<String> values) { addCriterion("contact_name in", values, "contactName"); return (Criteria) this; } public Criteria andContactNameNotIn(List<String> values) { addCriterion("contact_name not in", values, "contactName"); return (Criteria) this; } public Criteria andContactNameBetween(String value1, String value2) { addCriterion("contact_name between", value1, value2, "contactName"); return (Criteria) this; } public Criteria andContactNameNotBetween(String value1, String value2) { addCriterion("contact_name not between", value1, value2, "contactName"); return (Criteria) this; } public Criteria andAddrIsNull() { addCriterion("addr is null"); return (Criteria) this; } public Criteria andAddrIsNotNull() { addCriterion("addr is not null"); return (Criteria) this; } public Criteria andAddrEqualTo(String value) { addCriterion("addr =", value, "addr"); return (Criteria) this; } public Criteria andAddrNotEqualTo(String value) { addCriterion("addr <>", value, "addr"); return (Criteria) this; } public Criteria andAddrGreaterThan(String value) { addCriterion("addr >", value, "addr"); return (Criteria) this; } public Criteria andAddrGreaterThanOrEqualTo(String value) { addCriterion("addr >=", value, "addr"); return (Criteria) this; } public Criteria andAddrLessThan(String value) { addCriterion("addr <", value, "addr"); return (Criteria) this; } public Criteria andAddrLessThanOrEqualTo(String value) { addCriterion("addr <=", value, "addr"); return (Criteria) this; } public Criteria andAddrLike(String value) { addCriterion("addr like", value, "addr"); return (Criteria) this; } public Criteria andAddrNotLike(String value) { addCriterion("addr not like", value, "addr"); return (Criteria) this; } public Criteria andAddrIn(List<String> values) { addCriterion("addr in", values, "addr"); return (Criteria) this; } public Criteria andAddrNotIn(List<String> values) { addCriterion("addr not in", values, "addr"); return (Criteria) this; } public Criteria andAddrBetween(String value1, String value2) { addCriterion("addr between", value1, value2, "addr"); return (Criteria) this; } public Criteria andAddrNotBetween(String value1, String value2) { addCriterion("addr not between", value1, value2, "addr"); return (Criteria) this; } public Criteria andMemoIsNull() { addCriterion("memo is null"); return (Criteria) this; } public Criteria andMemoIsNotNull() { addCriterion("memo is not null"); return (Criteria) this; } public Criteria andMemoEqualTo(String value) { addCriterion("memo =", value, "memo"); return (Criteria) this; } public Criteria andMemoNotEqualTo(String value) { addCriterion("memo <>", value, "memo"); return (Criteria) this; } public Criteria andMemoGreaterThan(String value) { addCriterion("memo >", value, "memo"); return (Criteria) this; } public Criteria andMemoGreaterThanOrEqualTo(String value) { addCriterion("memo >=", value, "memo"); return (Criteria) this; } public Criteria andMemoLessThan(String value) { addCriterion("memo <", value, "memo"); return (Criteria) this; } public Criteria andMemoLessThanOrEqualTo(String value) { addCriterion("memo <=", value, "memo"); return (Criteria) this; } public Criteria andMemoLike(String value) { addCriterion("memo like", value, "memo"); return (Criteria) this; } public Criteria andMemoNotLike(String value) { addCriterion("memo not like", value, "memo"); return (Criteria) this; } public Criteria andMemoIn(List<String> values) { addCriterion("memo in", values, "memo"); return (Criteria) this; } public Criteria andMemoNotIn(List<String> values) { addCriterion("memo not in", values, "memo"); return (Criteria) this; } public Criteria andMemoBetween(String value1, String value2) { addCriterion("memo between", value1, value2, "memo"); return (Criteria) this; } public Criteria andMemoNotBetween(String value1, String value2) { addCriterion("memo not between", value1, value2, "memo"); return (Criteria) this; } public Criteria andPhoneIsNull() { addCriterion("phone is null"); return (Criteria) this; } public Criteria andPhoneIsNotNull() { addCriterion("phone is not null"); return (Criteria) this; } public Criteria andPhoneEqualTo(String value) { addCriterion("phone =", value, "phone"); return (Criteria) this; } public Criteria andPhoneNotEqualTo(String value) { addCriterion("phone <>", value, "phone"); return (Criteria) this; } public Criteria andPhoneGreaterThan(String value) { addCriterion("phone >", value, "phone"); return (Criteria) this; } public Criteria andPhoneGreaterThanOrEqualTo(String value) { addCriterion("phone >=", value, "phone"); return (Criteria) this; } public Criteria andPhoneLessThan(String value) { addCriterion("phone <", value, "phone"); return (Criteria) this; } public Criteria andPhoneLessThanOrEqualTo(String value) { addCriterion("phone <=", value, "phone"); return (Criteria) this; } public Criteria andPhoneLike(String value) { addCriterion("phone like", value, "phone"); return (Criteria) this; } public Criteria andPhoneNotLike(String value) { addCriterion("phone not like", value, "phone"); return (Criteria) this; } public Criteria andPhoneIn(List<String> values) { addCriterion("phone in", values, "phone"); return (Criteria) this; } public Criteria andPhoneNotIn(List<String> values) { addCriterion("phone not in", values, "phone"); return (Criteria) this; } public Criteria andPhoneBetween(String value1, String value2) { addCriterion("phone between", value1, value2, "phone"); return (Criteria) this; } public Criteria andPhoneNotBetween(String value1, String value2) { addCriterion("phone not between", value1, value2, "phone"); return (Criteria) this; } public Criteria andSellerCompanyIsNull() { addCriterion("seller_company is null"); return (Criteria) this; } public Criteria andSellerCompanyIsNotNull() { addCriterion("seller_company is not null"); return (Criteria) this; } public Criteria andSellerCompanyEqualTo(String value) { addCriterion("seller_company =", value, "sellerCompany"); return (Criteria) this; } public Criteria andSellerCompanyNotEqualTo(String value) { addCriterion("seller_company <>", value, "sellerCompany"); return (Criteria) this; } public Criteria andSellerCompanyGreaterThan(String value) { addCriterion("seller_company >", value, "sellerCompany"); return (Criteria) this; } public Criteria andSellerCompanyGreaterThanOrEqualTo(String value) { addCriterion("seller_company >=", value, "sellerCompany"); return (Criteria) this; } public Criteria andSellerCompanyLessThan(String value) { addCriterion("seller_company <", value, "sellerCompany"); return (Criteria) this; } public Criteria andSellerCompanyLessThanOrEqualTo(String value) { addCriterion("seller_company <=", value, "sellerCompany"); return (Criteria) this; } public Criteria andSellerCompanyLike(String value) { addCriterion("seller_company like", value, "sellerCompany"); return (Criteria) this; } public Criteria andSellerCompanyNotLike(String value) { addCriterion("seller_company not like", value, "sellerCompany"); return (Criteria) this; } public Criteria andSellerCompanyIn(List<String> values) { addCriterion("seller_company in", values, "sellerCompany"); return (Criteria) this; } public Criteria andSellerCompanyNotIn(List<String> values) { addCriterion("seller_company not in", values, "sellerCompany"); return (Criteria) this; } public Criteria andSellerCompanyBetween(String value1, String value2) { addCriterion("seller_company between", value1, value2, "sellerCompany"); return (Criteria) this; } public Criteria andSellerCompanyNotBetween(String value1, String value2) { addCriterion("seller_company not between", value1, value2, "sellerCompany"); return (Criteria) this; } public Criteria andZipCodeIsNull() { addCriterion("zip_code is null"); return (Criteria) this; } public Criteria andZipCodeIsNotNull() { addCriterion("zip_code is not null"); return (Criteria) this; } public Criteria andZipCodeEqualTo(String value) { addCriterion("zip_code =", value, "zipCode"); return (Criteria) this; } public Criteria andZipCodeNotEqualTo(String value) { addCriterion("zip_code <>", value, "zipCode"); return (Criteria) this; } public Criteria andZipCodeGreaterThan(String value) { addCriterion("zip_code >", value, "zipCode"); return (Criteria) this; } public Criteria andZipCodeGreaterThanOrEqualTo(String value) { addCriterion("zip_code >=", value, "zipCode"); return (Criteria) this; } public Criteria andZipCodeLessThan(String value) { addCriterion("zip_code <", value, "zipCode"); return (Criteria) this; } public Criteria andZipCodeLessThanOrEqualTo(String value) { addCriterion("zip_code <=", value, "zipCode"); return (Criteria) this; } public Criteria andZipCodeLike(String value) { addCriterion("zip_code like", value, "zipCode"); return (Criteria) this; } public Criteria andZipCodeNotLike(String value) { addCriterion("zip_code not like", value, "zipCode"); return (Criteria) this; } public Criteria andZipCodeIn(List<String> values) { addCriterion("zip_code in", values, "zipCode"); return (Criteria) this; } public Criteria andZipCodeNotIn(List<String> values) { addCriterion("zip_code not in", values, "zipCode"); return (Criteria) this; } public Criteria andZipCodeBetween(String value1, String value2) { addCriterion("zip_code between", value1, value2, "zipCode"); return (Criteria) this; } public Criteria andZipCodeNotBetween(String value1, String value2) { addCriterion("zip_code not between", value1, value2, "zipCode"); return (Criteria) this; } public Criteria andCreatedIsNull() { addCriterion("created is null"); return (Criteria) this; } public Criteria andCreatedIsNotNull() { addCriterion("created is not null"); return (Criteria) this; } public Criteria andCreatedEqualTo(Date value) { addCriterion("created =", value, "created"); return (Criteria) this; } public Criteria andCreatedNotEqualTo(Date value) { addCriterion("created <>", value, "created"); return (Criteria) this; } public Criteria andCreatedGreaterThan(Date value) { addCriterion("created >", value, "created"); return (Criteria) this; } public Criteria andCreatedGreaterThanOrEqualTo(Date value) { addCriterion("created >=", value, "created"); return (Criteria) this; } public Criteria andCreatedLessThan(Date value) { addCriterion("created <", value, "created"); return (Criteria) this; } public Criteria andCreatedLessThanOrEqualTo(Date value) { addCriterion("created <=", value, "created"); return (Criteria) this; } public Criteria andCreatedIn(List<Date> values) { addCriterion("created in", values, "created"); return (Criteria) this; } public Criteria andCreatedNotIn(List<Date> values) { addCriterion("created not in", values, "created"); return (Criteria) this; } public Criteria andCreatedBetween(Date value1, Date value2) { addCriterion("created between", value1, value2, "created"); return (Criteria) this; } public Criteria andCreatedNotBetween(Date value1, Date value2) { addCriterion("created not between", value1, value2, "created"); return (Criteria) this; } public Criteria andUpdatedIsNull() { addCriterion("updated is null"); return (Criteria) this; } public Criteria andUpdatedIsNotNull() { addCriterion("updated is not null"); return (Criteria) this; } public Criteria andUpdatedEqualTo(Date value) { addCriterion("updated =", value, "updated"); return (Criteria) this; } public Criteria andUpdatedNotEqualTo(Date value) { addCriterion("updated <>", value, "updated"); return (Criteria) this; } public Criteria andUpdatedGreaterThan(Date value) { addCriterion("updated >", value, "updated"); return (Criteria) this; } public Criteria andUpdatedGreaterThanOrEqualTo(Date value) { addCriterion("updated >=", value, "updated"); return (Criteria) this; } public Criteria andUpdatedLessThan(Date value) { addCriterion("updated <", value, "updated"); return (Criteria) this; } public Criteria andUpdatedLessThanOrEqualTo(Date value) { addCriterion("updated <=", value, "updated"); return (Criteria) this; } public Criteria andUpdatedIn(List<Date> values) { addCriterion("updated in", values, "updated"); return (Criteria) this; } public Criteria andUpdatedNotIn(List<Date> values) { addCriterion("updated not in", values, "updated"); return (Criteria) this; } public Criteria andUpdatedBetween(Date value1, Date value2) { addCriterion("updated between", value1, value2, "updated"); return (Criteria) this; } public Criteria andUpdatedNotBetween(Date value1, Date value2) { addCriterion("updated not between", value1, value2, "updated"); return (Criteria) this; } public Criteria andActiveIsNull() { addCriterion("active is null"); return (Criteria) this; } public Criteria andActiveIsNotNull() { addCriterion("active is not null"); return (Criteria) this; } public Criteria andActiveEqualTo(Integer value) { addCriterion("active =", value, "active"); return (Criteria) this; } public Criteria andActiveNotEqualTo(Integer value) { addCriterion("active <>", value, "active"); return (Criteria) this; } public Criteria andActiveGreaterThan(Integer value) { addCriterion("active >", value, "active"); return (Criteria) this; } public Criteria andActiveGreaterThanOrEqualTo(Integer value) { addCriterion("active >=", value, "active"); return (Criteria) this; } public Criteria andActiveLessThan(Integer value) { addCriterion("active <", value, "active"); return (Criteria) this; } public Criteria andActiveLessThanOrEqualTo(Integer value) { addCriterion("active <=", value, "active"); return (Criteria) this; } public Criteria andActiveIn(List<Integer> values) { addCriterion("active in", values, "active"); return (Criteria) this; } public Criteria andActiveNotIn(List<Integer> values) { addCriterion("active not in", values, "active"); return (Criteria) this; } public Criteria andActiveBetween(Integer value1, Integer value2) { addCriterion("active between", value1, value2, "active"); return (Criteria) this; } public Criteria andActiveNotBetween(Integer value1, Integer value2) { addCriterion("active not between", value1, value2, "active"); return (Criteria) this; } } public static class Criteria extends GeneratedCriteria { protected Criteria() { super(); } } public static class Criterion { private String condition; private Object value; private Object secondValue; private boolean noValue; private boolean singleValue; private boolean betweenValue; private boolean listValue; private String typeHandler; public String getCondition() { return condition; } public Object getValue() { return value; } public Object getSecondValue() { return secondValue; } public boolean isNoValue() { return noValue; } public boolean isSingleValue() { return singleValue; } public boolean isBetweenValue() { return betweenValue; } public boolean isListValue() { return listValue; } public String getTypeHandler() { return typeHandler; } protected Criterion(String condition) { super(); this.condition = condition; this.typeHandler = null; this.noValue = true; } protected Criterion(String condition, Object value, String typeHandler) { super(); this.condition = condition; this.value = value; this.typeHandler = typeHandler; if (value instanceof List<?>) { this.listValue = true; } else { this.singleValue = true; } } protected Criterion(String condition, Object value) { this(condition, value, null); } protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { super(); this.condition = condition; this.value = value; this.secondValue = secondValue; this.typeHandler = typeHandler; this.betweenValue = true; } protected Criterion(String condition, Object value, Object secondValue) { this(condition, value, secondValue, null); } } }
package com.tencent.mm.plugin.honey_pay.ui; import android.view.MenuItem; import android.view.MenuItem.OnMenuItemClickListener; class HoneyPayCardBackUI$1 implements OnMenuItemClickListener { final /* synthetic */ HoneyPayCardBackUI kke; HoneyPayCardBackUI$1(HoneyPayCardBackUI honeyPayCardBackUI) { this.kke = honeyPayCardBackUI; } public final boolean onMenuItemClick(MenuItem menuItem) { this.kke.YC(); this.kke.Wq(); this.kke.finish(); return false; } }
package com.tencent.mm.plugin.recharge.ui.form; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import com.tencent.mm.plugin.recharge.ui.form.c.b; import com.tencent.mm.sdk.platformtools.x; class c$b$3 implements OnItemClickListener { final /* synthetic */ b mqS; final /* synthetic */ InstantAutoCompleteTextView mqT; public c$b$3(b bVar, InstantAutoCompleteTextView instantAutoCompleteTextView) { this.mqS = bVar; this.mqT = instantAutoCompleteTextView; } public final void onItemClick(AdapterView<?> adapterView, View view, int i, long j) { this.mqS.mph = this.mqS.mqQ.vg(i); if (this.mqS.mph != null) { x.i(c.TAG, "onItemClick record.record " + this.mqS.mph.mov + ", record.name " + this.mqS.mph.name); this.mqS.mqR = true; this.mqS.setInput(this.mqS.mph); } else { x.w(c.TAG, "record is null"); } this.mqT.dismissDropDown(); } }
package com.tencent.mm.ac.a; import com.tencent.mm.ac.a.e.1; class e$1$1 implements Runnable { final /* synthetic */ 1 dNu; e$1$1(1 1) { this.dNu = 1; } public final void run() { if (this.dNu.dAD != null) { this.dNu.dAD.Io(); } } }
// Maryam Athar Khan // Homework 08 part 2 // Due date is October 20, 2015 // This program is designed to process, parts or a complete, string and determine if they are letters import java.util.Scanner; // import java class from outside public class StringAnalysis { // define a class public static boolean analysis(String input) { // define the first anaylsis method that runs for the entire string. Method returns a boolean char c; // declare char c boolean letters = false; // declare letters variable for (int i=0;i<input.length();i++) { // loop runs until i is less than the string length c=input.charAt(i); // character at the position i if (Character.isLetter(c)==true) { // if the character is a letter letters = true; // assign true to letters break; // break and exit. Once you find a letter, there is no need to check the other characters } // end of if statement else { // else letters=false; // assign false to letters } // end of else statement } // end of loop return letters; // return letters } // end of first analysis method public static boolean analysis(String input, int x ) { // define the second analysis method which processes a part fo the string char c; // declare char c boolean letters=true; // declare letters variable if (x>input.length()) { // if x is greater than the number of characters in a string letters=analysis(input); // run the first method which processes the entire string } // end of if statement else { // otherwise for (int i=0;i<x;i++) { // loop runs until i is less than int x c=input.charAt(i); // character at position i if (Character.isLetter(c)==true) { // if character is a letter letters=true; // assign true to letters break; // break and exit since there is no need to check the other characters } // end of if statement else { // otherwise letters=false; // assign false to letters } // end of else statement } // end of loop } // end of big else return letters; // return letters } // end of second analysis method that accepts a string and an int public static void main(String[] args) { // define the main method Scanner myScanner= new Scanner(System.in); // declare Scanner variable System.out.print("Please type in a string: "); // ask user to input string String str=myScanner.next(); // declare str and assign user's input to it System.out.print("Type in All if you want to examine all the characters. Otherwise type in Certain: "); // Asks user to type All or Certain String a="All"; // declare string a and assign All to it String b="Certain"; // declare string b and assign Certain to it String input=myScanner.next(); // declare string input and assign user's input to it boolean letters=true; // declare letters variable int x=0; // declare x which tells you how many characters to check while (true) { // loop always run if (input.equals(a) || input.equals(b) ) { // if user typed in All or Certain break; // break and exit the loop } // end of if statement else { // otherwise System.out.println("ERROR. Please only type in All or Certain."); // display error message System.out.print("Type in All if you want to examine all the characters. Otherwise type in Certain: ");// prompt user again input=myScanner.next();// collects whatever the user inputs } // end of else statement } // end of while loop if (input.equals(a)) { // if user inputs All letters=analysis(str); // run the first analysis method with the entire string if (letters==true) { // if letters is true System.out.println("Letters found."); // print that letters are found } // end of if statement else { // otherwise if letters is false System.out.println("No letters found. "); // print that no letters are found } // end of else statement } // end of if user wants All statement if (input.equals(b)) { // if user inputs Certain System.out.print("Please input how many characters you would like to check: "); // ask what x should be while (true) { // loop always runs if (myScanner.hasNextInt()) { // if input is an int x=myScanner.nextInt(); // assign it to x break; // break and exit } // end of if statement else { // otherwise System.out.print("Sorry, you did not enter an integer value. Try again: ");// error message and prompt user again myScanner.next(); // whatever user inputs } // end of else statement } // end of while loop letters=analysis(str,x); // run second analysis method where only part of a string is processed by using int x if (letters==true) { // if letters is true System.out.println("Letters found."); // print that letters are found } // end of if statement else { // otherwise System.out.println("No letters found."); // print that no letters are found } // end of else statement } // end of if user wants Certain statement } // end of main method } // end of class
package jp.smartcompany.job.configuration; import jp.smartcompany.job.interceptor.AuditInterceptor; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; /** * @author Xiao Wenpeng */ @Configuration @RequiredArgsConstructor(onConstructor = @__(@Autowired)) public class WebConfiguration implements WebMvcConfigurer { private final AuditInterceptor auditInterceptor; @Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(auditInterceptor).excludePathPatterns("/login","/favicon","/log/**"); } @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**") .allowCredentials(true) .allowedHeaders("*") .allowedMethods( "GET", "POST", "OPTIONS" ).maxAge(3600); } @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { // registry.addResourceHandler("/upload/**") // .addResourceLocations("file:///D:/IdeaWorkspace/office-next-BE/upload/"); } }
package com.datareference; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import weka.classifiers.bayes.NaiveBayes; import weka.core.DenseInstance; import weka.core.Instance; import weka.core.Instances; import weka.core.converters.ConverterUtils.DataSource; import weka.filters.unsupervised.attribute.StringToNominal; import com.dbconnection.ConnectToOracle; import com.model.User; public class WekaAnalysis { private Connection connection; private PreparedStatement ps; private ResultSet rs; private String sql; public WekaAnalysis() { this.connection = new ConnectToOracle().connect(); } public User selectAppropriateProfession(int jo_code) { User best_user = new User(); sql = "SELECT user_jobopening.user_id, userform.firstname, userform.lastname, userform.email, userform.born_date, userform.phone, userform.accesspassword, profession.profession_name,academictraining.course, professionalexperience.jobtitle, languages.lang, languages.lang_level, extracurricularcourses.extc_course, extracurricularcourses.course_level FROM user_jobopening JOIN userform ON userform.user_id = user_jobopening.user_id JOIN profession ON userform.user_id = profession.profession_id JOIN academictraining ON academictraining.user_id = user_jobopening.user_id JOIN professionalexperience ON professionalexperience.user_id = user_jobopening.user_id JOIN languages ON languages.user_id = user_jobopening.user_id JOIN extracurricularcourses ON extracurricularcourses.user_id = user_jobopening.user_id WHERE user_jobopening.job_id = ?"; try { ps = connection.prepareStatement(sql); ps.setInt(1, jo_code); rs = ps.executeQuery(); if(rs.next()) { try { DataSource ds = new DataSource("data_reference_ia.arff"); Instances ins = ds.getDataSet(); ins.setClassIndex(ins.numAttributes() - 1); NaiveBayes nb = new NaiveBayes(); nb.buildClassifier(ins); Instance new_instance = new DenseInstance(5); new_instance.setDataset(ins); ins.add(new_instance); String profession = rs.getString("profession_name"); String course = rs.getString("course"); String jobtitle = rs.getString("jobtitle"); String lang = rs.getString("lang"); String lang_level = rs.getString("lang_level"); String skill = rs.getString("extc_course"); String skill_level = rs.getString("course_level"); new_instance.setValue(0, "Backenddeveloper"); new_instance.setValue(1, "Sistemasdeinformacao"); new_instance.setValue(2, "Analistadesistemaspl"); new_instance.setValue(3, "Ingles"); new_instance.setValue(4, "Java"); double[] prediction_vector = nb.distributionForInstance(new_instance); double prediction_1 = prediction_vector[0]; double prediction_2 = prediction_vector[1]; if(prediction_1 > prediction_2) { best_user = new User(rs.getString("firstname"),rs.getString("lastname"),rs.getString("email"),rs.getString("phone"),prediction_1); } } catch (Exception e) { System.out.println("Error during I.A. profile analysis.\n" + e); } } }catch(SQLException e) { System.out.println("Error during retrievement of applied users on Oracle\n"+e); } System.out.println(best_user.toString()); return best_user; } public List<User> selectRefusedApply(int jo_code) { List<User> users = new ArrayList<>(); sql = "SELECT * FROM user_jobopening JOIN resumeform ON resumeform.email_user = user_jobopening.email JOIN userform ON userform.email = user_jobopening.email WHERE user_jobopening.jo_code = ?"; try { ps = connection.prepareStatement(sql); ps.setInt(1, jo_code); rs = ps.executeQuery(); while(rs.next()) { try { DataSource ds = new DataSource("data_reference_ia.arff"); Instances ins = ds.getDataSet(); ins.setClassIndex(ins.numAttributes() - 1); NaiveBayes nb = new NaiveBayes(); nb.buildClassifier(ins); Instance new_instance = new DenseInstance(5); new_instance.setDataset(ins); ins.add(new_instance); new_instance.setValue(0, rs.getString("goal")); new_instance.setValue(1, rs.getString("academic_training")); new_instance.setValue(2, rs.getString("professional_experience")); new_instance.setValue(3, rs.getString("languages")); new_instance.setValue(4, rs.getString("extracurricular_courses")); double[] prediction_vector = nb.distributionForInstance(new_instance); double prediction_1 = prediction_vector[0]; double prediction_2 = prediction_vector[1]; if(prediction_2 > prediction_1) { users.add(new User(rs.getString("firstname"),rs.getString("lastname"),rs.getString("email"),rs.getString("phone"),prediction_1)); } } catch (Exception e) { System.out.println("Error during I.A. profile analysis.\n" + e); } } }catch(SQLException e) { System.out.println("Error during retrievement of applied users on Oracle\n"+e); } System.out.println(users.toString()); return users; } }
package db; import models.Advert; import models.Category; import models.User; import org.hibernate.Criteria; import org.hibernate.HibernateException; import org.hibernate.Session; import org.hibernate.Transaction; import org.hibernate.criterion.MatchMode; import org.hibernate.criterion.Restrictions; import java.util.List; public class DBAdvert { private static Session session; private static Transaction transaction; public static List<Advert> findAdvertsByName(String searchCriteria){ session = HibernateUtil.getSessionFactory().openSession(); List<Advert> foundAdverts = null; try{ Criteria cr = session.createCriteria(Advert.class); cr.add(Restrictions.ilike("advertTitle", searchCriteria, MatchMode.ANYWHERE)); foundAdverts = cr.list(); }catch(HibernateException e){ e.printStackTrace(); }finally{ session.close(); } return foundAdverts; } public static List<Advert> findAdvertsByCategory(Category category){ session = HibernateUtil.getSessionFactory().openSession(); List<Advert> foundAdverts = null; try{ Criteria cr = session.createCriteria(Advert.class); cr.createAlias("categories", "category"); cr.add(Restrictions.eq("category.id", category.getId())); foundAdverts = cr.list(); }catch(HibernateException e){ e.printStackTrace(); }finally{ session.close(); } return foundAdverts; } public static List<User> findFavouritedBy(Advert advert) { session = HibernateUtil.getSessionFactory().openSession(); List<User> results = null; try { Criteria cr = session.createCriteria(User.class); cr.createAlias("favouriteAdverts", "advert"); cr.add(Restrictions.eq("advert.id", advert.getId())); results = cr.list(); }catch (HibernateException e){ e.printStackTrace(); }finally { session.close(); } return results; } }
package MiniNet; import java.util.HashMap; import java.util.Iterator; /** * @version V1.6 * @author jammy * data 2018Äê3ÔÂ22ÈÕ 22:44:04 **/ abstract public class Person {//every person have name, age, status, friend, image, father and mother attributes private String name; private int age; private String status; HashMap friend;//built a friend array for storing friends' name private String image; private Children father; private Children mother; private String gender; HashMap colleague; HashMap classmate; HashMap relationshipChain; public String getGender() { return gender; } public void setGender(String gender) { this.gender = gender; } public String getStates() { return states; } public void setStates(String states) { this.states = states; } private String states; Person(){ friend = new HashMap(); colleague = new HashMap(); classmate = new HashMap(); relationshipChain = new HashMap(); } public void setName(String name) { this.name=name; } public String getName() { return this.name; } public void setAge(int age) { this.age=age; } public int getAge() { return this.age; } public void setStatus(String status) { this.status=status; } public String getStatus() { return this.status; } public void setFriend(String name,Children per) { friend.put(name, friend); } public void getFriend() {//type the ith friend you want to show Iterator it = friend.keySet().iterator(); while(it.hasNext()) { String key = it.next().toString(); Children children = (Children) friend.get(key); System.out.println(children); } return ; } public void setImage(String image) { this.image=image; } public String getImage() { return this.image; } public void setFather(Children father) { this.father=father; } public Adult getFather() { return this.father; } public void setMother(Children mother) { this.mother=mother; } public Adult getMother() { return this.mother; } public String toString() {//override the toString method for output person basic information String msg=this.name+", "+this.image+", "+this.status+", "+this.gender+", "+this.age+", "+this.states; return msg; } }
package com.example.mrcio.applisbonph; import android.app.AlertDialog; import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; import android.database.Cursor; import android.os.AsyncTask; import android.os.Bundle; import android.os.Environment; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.Toast; import org.apache.log4j.Level; import org.apache.log4j.Logger; import java.io.File; import database.DBHelper; import de.mindpipe.android.logging.log4j.LogConfigurator; import email.Mail; /** * Created by NB19194 on 06/05/2016. */ public class EventActivity extends AppCompatActivity { Bundle extras; int imageId; int userId; String eventName; final Context context = this; DBHelper mydb; ProgressDialog mProgressDialog; ImageView eventImage; Button registerButton; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_event); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); //Logs LogConfigurator logConfigurator = new LogConfigurator(); logConfigurator.setFileName(Environment.getExternalStorageDirectory() + File.separator + "AppLisbonPh" + File.separator + "logs" + File.separator + "AppLisbonPhLog.txt"); logConfigurator.setRootLevel(Level.DEBUG); logConfigurator.setLevel("org.apache", Level.ERROR); logConfigurator.setFilePattern("%d %-5p [%c{2}]-[%L] %m%n"); logConfigurator.setMaxFileSize(1024 * 1024 * 5); logConfigurator.setImmediateFlush(true); logConfigurator.configure(); final Cursor userLogin; mydb = new DBHelper(this); extras = getIntent().getExtras(); imageId = extras.getInt("imageId"); userId = extras.getInt("userId"); eventName = extras.getString("eventName"); userLogin = mydb.getUserById(userId); userLogin.moveToFirst(); //User data final String userName = userLogin.getString(userLogin.getColumnIndex(DBHelper.USERS_COLUMN_USERNAME)); final String userEmail = userLogin.getString(userLogin.getColumnIndex(DBHelper.USERS_COLUMN_EMAIL)); final String userCompleteName = userLogin.getString(userLogin.getColumnIndex(DBHelper.USERS_COLUMN_COMPLETE_NAME)); final String userInvoiceName = userLogin.getString(userLogin.getColumnIndex(DBHelper.USERS_COLUMN_INVOICE_NAME)); final String userCertificationName = userLogin.getString(userLogin.getColumnIndex(DBHelper.USERS_COLUMN_CERTIFICATE_NAME)); final String userPhone = userLogin.getString(userLogin.getColumnIndex(DBHelper.USERS_COLUMN_PHONE)); final String userCitizenCard = userLogin.getString(userLogin.getColumnIndex(DBHelper.USERS_COLUMN_CITIZEN_CARD)); final String userWorkbooklet = userLogin.getString(userLogin.getColumnIndex(DBHelper.USERS_COLUMN_WORK_BOOKLET)); final String userNif = userLogin.getString(userLogin.getColumnIndex(DBHelper.USERS_COLUMN_NIF)); final String userAddress = userLogin.getString(userLogin.getColumnIndex(DBHelper.USERS_COLUMN_ADDRESS)); final String userZipCode = userLogin.getString(userLogin.getColumnIndex(DBHelper.USERS_COLUMN_POSTAL_CODE)); eventImage = (ImageView)findViewById(R.id.eventImage); eventImage.setImageResource(imageId); registerButton = (Button)findViewById(R.id.registerButton); registerButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { new AlertDialog.Builder(context) .setMessage("Tem a certeza que pretende enviar a inscrição para o evento " + eventName + "?") .setCancelable(false) .setPositiveButton("Sim", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { sendRegisterEmail(userName, userEmail, userCompleteName, userInvoiceName, userCertificationName, userPhone, userCitizenCard, userWorkbooklet, userNif, userAddress, userZipCode); } }) .setNegativeButton("Não", null) .show(); } }); } private void sendRegisterEmail(String userName, String userEmail ,String completeName, String invoiceName, String certificateName, String phone, String citizenCard, String workBooklet, String nif, String address, String zipCode){ String[] toArr = new String[]{"joaonunofrazao@hotmail.com"}; //Google SMTP: final Mail m = new Mail("appLisbonTest@gmail.com", "AppLisbon"); //Send Pulse SMTP: final Mail m = new Mail("appLisbonTest@gmail.com", "fbN3EYiMtqi"); //SMTP2GO final Mail m = new Mail("appLisbonTest@gmail.com", "5qhWvWv2y552"); m.setTo(toArr); m.setFrom("appLisbonTest@gmail.com"); m.setSubject("Inscrição User " + userName + " no Evento " + eventName); StringBuilder body = new StringBuilder("O Utilizador <b>" + userName + "</b> inscreveu-se no evento <b>" + eventName + "</b>, com os seguintes dados:"); body.append("<br/>"); body.append("<br/>"); body.append("<b>Nome Completo:</b> " + completeName); body.append("<br/>"); body.append("<b>Endereco de email utilizado:</b> " + userEmail); body.append("<br/>"); body.append("<b>Nome para Fatura:</b> " + invoiceName + "."); body.append("<br/>"); body.append("<b>Nome para Certificado:</b> " + certificateName); body.append("<br/>"); body.append("<b>Num. de Telefone:</b> " + phone); body.append("<br/>"); body.append("<b>Num. de Cartao do Cidadao:</b> " + citizenCard); body.append("<br/>"); body.append("<b>Num. de Carteira Profissional:</b> " + workBooklet); body.append("<br/>"); body.append("<b>NIF:</b> " + nif); body.append("<br/>"); body.append("<b>Morada:</b> " + address); body.append("<br/>"); body.append("<b>Codigo Postal:</b> " + zipCode); body.append("<br/>"); body.append("<br/>"); body.append("Atenciosamente,"); body.append("<br/>"); body.append("AppLisbonPH"); m.setBody(body.toString()); new AsyncTask<Void, Void, Void>() { boolean result; Logger log = Logger.getLogger(EventActivity.class); @Override protected void onPreExecute() { super.onPreExecute(); mProgressDialog = new ProgressDialog(EventActivity.this); mProgressDialog.setTitle("Envio de Inscriçao"); mProgressDialog.setMessage("A submeter inscrição..."); mProgressDialog.setIndeterminate(false); mProgressDialog.setCanceledOnTouchOutside(false); mProgressDialog.show(); } @Override protected Void doInBackground(Void... params) { try { result = m.send(); } catch (Exception e) { log.error("Failed to Sent email: " + e.getMessage()); result = false; } finally { mProgressDialog.dismiss(); } return null;} @Override protected void onPostExecute(Void v){ if(!result) Toast.makeText(context, "Não foi possivel realizar a inscrição no evento. " + "Verifique a ligação à Internet ou tente mais tarde", Toast.LENGTH_LONG).show(); else{ Toast.makeText(context, "Inscrição realizada com sucesso", Toast.LENGTH_LONG).show(); finish(); } } }.execute(); } @Override public void onBackPressed() { finish(); } }
/* * Copyright (C) 2021-2023 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.hedera.services.store.models; import static com.hedera.node.app.service.evm.utils.ValidationUtils.validateFalse; import static com.hedera.node.app.service.evm.utils.ValidationUtils.validateTrue; import static com.hedera.services.utils.BitPackUtils.MAX_NUM_ALLOWED; import static com.hedera.services.utils.MiscUtils.asUsableFcKey; import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.ACCOUNT_DOES_NOT_OWN_WIPED_NFT; import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.CANNOT_WIPE_TOKEN_TREASURY_ACCOUNT; import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.FAIL_INVALID; import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.INSUFFICIENT_TOKEN_BALANCE; import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.INVALID_TOKEN_BURN_AMOUNT; import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.INVALID_TOKEN_BURN_METADATA; import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.INVALID_TOKEN_MINT_AMOUNT; import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.INVALID_TOKEN_MINT_METADATA; import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.INVALID_WIPING_AMOUNT; import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.SERIAL_NUMBER_LIMIT_REACHED; import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.TOKEN_HAS_NO_SUPPLY_KEY; import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.TOKEN_HAS_NO_WIPE_KEY; import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.TOKEN_IS_IMMUTABLE; import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.TOKEN_MAX_SUPPLY_REACHED; import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.TREASURY_MUST_OWN_BURNED_NFT; import com.google.common.base.MoreObjects; import com.google.protobuf.ByteString; import com.hedera.node.app.service.evm.exceptions.InvalidTransactionException; import com.hedera.node.app.service.evm.store.contracts.precompile.codec.CustomFee; import com.hedera.node.app.service.evm.store.tokens.TokenType; import com.hedera.services.jproto.JKey; import com.hedera.services.state.submerkle.RichInstant; import com.hederahashgraph.api.proto.java.ResponseCodeEnum; import com.hederahashgraph.api.proto.java.TokenCreateTransactionBody; import com.hederahashgraph.api.proto.java.TokenSupplyType; import edu.umd.cs.findbugs.annotations.Nullable; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; /** * Copied model from hedera-services. * <p> * Encapsulates the state and operations of a Hedera token. * * <p>Operations are validated, and throw a {@link InvalidTransactionException} with response code * capturing the failure when one occurs. * * <p><b>NOTE:</b> Some operations only apply to specific token types. For example, a {@link * Token#mint(TokenRelationship, long, boolean)} call only makes sense for a token of type {@code FUNGIBLE_COMMON}; the * signature for a {@code NON_FUNGIBLE_UNIQUE} is * {@link Token#mint(TokenRelationship, List, RichInstant)}. * <p> * This model is used as a value in a special state (CachingStateFrame), used for speculative write operations. Object * immutability is required for this model in order to be used seamlessly in the state. * <p> * Differences from the original: * 1. Added factory method that returns empty instance * 2. Added mapToDomain method from TokenTypesManager * 3. Removed OwnershipTracker */ public class Token { private final Long entityId; private final Id id; private final List<UniqueToken> mintedUniqueTokens; private final List<UniqueToken> removedUniqueTokens; private final Map<Long, UniqueToken> loadedUniqueTokens; private final boolean supplyHasChanged; private final TokenType type; private final TokenSupplyType supplyType; private final long totalSupply; private final long maxSupply; private final JKey kycKey; private final JKey freezeKey; private final JKey supplyKey; private final JKey wipeKey; private final JKey adminKey; private final JKey feeScheduleKey; private final JKey pauseKey; private final boolean frozenByDefault; private final Account treasury; private final Account autoRenewAccount; private final boolean deleted; private final boolean paused; private final boolean autoRemoved; private final long expiry; private final boolean isNew; private final String memo; private final String name; private final String symbol; private final int decimals; private final long autoRenewPeriod; private final long createdTimestamp; private final long lastUsedSerialNumber; private final List<CustomFee> customFees; public Token(Id id) { this( 0L, id, new ArrayList<>(), new ArrayList<>(), new HashMap<>(), false, null, null, 0, 0, null, null, null, null, null, null, null, false, null, null, false, false, false, 0, 0, false, "", "", "", 0, 0, 0, new ArrayList<>()); } @SuppressWarnings("java:S107") public Token( Long entityId, Id id, List<UniqueToken> mintedUniqueTokens, List<UniqueToken> removedUniqueTokens, Map<Long, UniqueToken> loadedUniqueTokens, boolean supplyHasChanged, TokenType type, TokenSupplyType supplyType, long totalSupply, long maxSupply, JKey kycKey, JKey freezeKey, JKey supplyKey, JKey wipeKey, JKey adminKey, JKey feeScheduleKey, JKey pauseKey, boolean frozenByDefault, Account treasury, Account autoRenewAccount, boolean deleted, boolean paused, boolean autoRemoved, long expiry, long createdTimestamp, boolean isNew, String memo, String name, String symbol, int decimals, long autoRenewPeriod, long lastUsedSerialNumber, List<CustomFee> customFees) { this.entityId = entityId; this.id = id; this.mintedUniqueTokens = Collections.emptyList().equals(mintedUniqueTokens) ? new ArrayList<>() : mintedUniqueTokens; this.removedUniqueTokens = Collections.emptyList().equals(removedUniqueTokens) ? new ArrayList<>() : removedUniqueTokens; this.loadedUniqueTokens = Collections.emptyMap().equals(loadedUniqueTokens) ? new HashMap<>() : loadedUniqueTokens; this.supplyHasChanged = supplyHasChanged; this.type = type; this.supplyType = supplyType; this.totalSupply = totalSupply; this.maxSupply = maxSupply; this.kycKey = kycKey; this.freezeKey = freezeKey; this.supplyKey = supplyKey; this.wipeKey = wipeKey; this.adminKey = adminKey; this.feeScheduleKey = feeScheduleKey; this.pauseKey = pauseKey; this.frozenByDefault = frozenByDefault; this.treasury = treasury; this.autoRenewAccount = autoRenewAccount; this.deleted = deleted; this.paused = paused; this.autoRemoved = autoRemoved; this.expiry = expiry; this.createdTimestamp = createdTimestamp; this.isNew = isNew; this.memo = memo; this.name = name; this.symbol = symbol; this.decimals = decimals; this.autoRenewPeriod = autoRenewPeriod; this.lastUsedSerialNumber = lastUsedSerialNumber; this.customFees = customFees; } public static Token getEmptyToken() { return new Token(Id.DEFAULT); } /** * Creates a new instance of the model token, which is later persisted in state. * * @param tokenId the new token id * @param op the transaction body containing the necessary data for token creation * @param treasury treasury of the token * @param autoRenewAccount optional(nullable) account used for auto-renewal * @param consensusTimestamp the consensus time of the token create transaction * @return a new instance of the {@link Token} class */ public static Token fromGrpcOpAndMeta( final Id tokenId, final TokenCreateTransactionBody op, final Account treasury, @Nullable final Account autoRenewAccount, final long consensusTimestamp) { final var tokenExpiry = op.hasAutoRenewAccount() ? consensusTimestamp + op.getAutoRenewPeriod().getSeconds() : op.getExpiry().getSeconds(); final var freezeKey = asUsableFcKey(op.getFreezeKey()); final var adminKey = asUsableFcKey(op.getAdminKey()); final var kycKey = asUsableFcKey(op.getKycKey()); final var wipeKey = asUsableFcKey(op.getWipeKey()); final var supplyKey = asUsableFcKey(op.getSupplyKey()); final var feeScheduleKey = asUsableFcKey(op.getFeeScheduleKey()); final var pauseKey = asUsableFcKey(op.getPauseKey()); return new Token( 0L, tokenId, new ArrayList<>(), new ArrayList<>(), new HashMap<>(), false, mapToDomain(op.getTokenType()), op.getSupplyType(), 0, op.getMaxSupply(), kycKey.orElse(null), freezeKey.orElse(null), supplyKey.orElse(null), wipeKey.orElse(null), adminKey.orElse(null), feeScheduleKey.orElse(null), pauseKey.orElse(null), op.getFreezeDefault(), treasury, autoRenewAccount, false, false, false, tokenExpiry, 0, true, op.getMemo(), op.getName(), op.getSymbol(), op.getDecimals(), op.getAutoRenewPeriod().getSeconds(), 0, Collections.emptyList()); } // copied from TokenTypesManager in services private static TokenType mapToDomain(final com.hederahashgraph.api.proto.java.TokenType grpcType) { if (grpcType == com.hederahashgraph.api.proto.java.TokenType.NON_FUNGIBLE_UNIQUE) { return TokenType.NON_FUNGIBLE_UNIQUE; } else { return TokenType.FUNGIBLE_COMMON; } } public boolean isEmptyToken() { return this.equals(getEmptyToken()); } /** * Creates new instance of {@link Token} with updated loadedUniqueTokens in order to keep the object's immutability and * avoid entry points for changing the state. * * @param oldToken * @param loadedUniqueTokens * @return the new instance of {@link Token} with updated {@link #loadedUniqueTokens} property */ private Token createNewTokenWithLoadedUniqueTokens(Token oldToken, Map<Long, UniqueToken> loadedUniqueTokens) { return new Token( oldToken.entityId, oldToken.id, oldToken.mintedUniqueTokens, oldToken.removedUniqueTokens, loadedUniqueTokens, oldToken.supplyHasChanged, oldToken.type, oldToken.supplyType, oldToken.totalSupply, oldToken.maxSupply, oldToken.kycKey, oldToken.freezeKey, oldToken.supplyKey, oldToken.wipeKey, oldToken.adminKey, oldToken.feeScheduleKey, oldToken.pauseKey, oldToken.frozenByDefault, oldToken.treasury, oldToken.autoRenewAccount, oldToken.deleted, oldToken.paused, oldToken.autoRemoved, oldToken.expiry, oldToken.createdTimestamp, oldToken.isNew, oldToken.memo, oldToken.name, oldToken.symbol, oldToken.decimals, oldToken.autoRenewPeriod, oldToken.lastUsedSerialNumber, oldToken.customFees); } /** * Creates new instance of {@link Token} with updated maxSupply in order to keep the object's immutability and * avoid entry points for changing the state. * * @param oldToken * @param maxSupply * @return the new instance of {@link Token} with updated {@link #maxSupply} property */ private Token createNewTokenWithNewMaxSupply(Token oldToken, long maxSupply) { return new Token( oldToken.entityId, oldToken.id, oldToken.mintedUniqueTokens, oldToken.removedUniqueTokens, oldToken.loadedUniqueTokens, oldToken.supplyHasChanged, oldToken.type, oldToken.supplyType, oldToken.totalSupply, maxSupply, oldToken.kycKey, oldToken.freezeKey, oldToken.supplyKey, oldToken.wipeKey, oldToken.adminKey, oldToken.feeScheduleKey, oldToken.pauseKey, oldToken.frozenByDefault, oldToken.treasury, oldToken.autoRenewAccount, oldToken.deleted, oldToken.paused, oldToken.autoRemoved, oldToken.expiry, oldToken.createdTimestamp, oldToken.isNew, oldToken.memo, oldToken.name, oldToken.symbol, oldToken.decimals, oldToken.autoRenewPeriod, oldToken.lastUsedSerialNumber, oldToken.customFees); } /** * Creates new instance of {@link Token} with updated totalSupply in order to keep the object's immutability and * avoid entry points for changing the state. * * @param oldToken * @param totalSupply * @return the new instance of {@link Token} with updated {@link #totalSupply} property */ private Token createNewTokenWithNewTotalSupply(Token oldToken, long totalSupply) { return new Token( oldToken.entityId, oldToken.id, oldToken.mintedUniqueTokens, oldToken.removedUniqueTokens, oldToken.loadedUniqueTokens, true, oldToken.type, oldToken.supplyType, totalSupply, oldToken.maxSupply, oldToken.kycKey, oldToken.freezeKey, oldToken.supplyKey, oldToken.wipeKey, oldToken.adminKey, oldToken.feeScheduleKey, oldToken.pauseKey, oldToken.frozenByDefault, oldToken.treasury, oldToken.autoRenewAccount, oldToken.deleted, oldToken.paused, oldToken.autoRemoved, oldToken.expiry, oldToken.createdTimestamp, oldToken.isNew, oldToken.memo, oldToken.name, oldToken.symbol, oldToken.decimals, oldToken.autoRenewPeriod, oldToken.lastUsedSerialNumber, oldToken.customFees); } /** * Creates new instance of {@link Token} with updated treasury in order to keep the object's * immutability and avoid entry points for changing the state. * * @param oldToken * @param treasury * @return new instance of {@link Token} with updated {@link #treasury} property */ private Token createNewTokenWithNewTreasury(Token oldToken, Account treasury) { return new Token( oldToken.entityId, oldToken.id, oldToken.mintedUniqueTokens, oldToken.removedUniqueTokens, oldToken.loadedUniqueTokens, oldToken.supplyHasChanged, oldToken.type, oldToken.supplyType, oldToken.totalSupply, oldToken.maxSupply, oldToken.kycKey, oldToken.freezeKey, oldToken.supplyKey, oldToken.wipeKey, oldToken.adminKey, oldToken.feeScheduleKey, oldToken.pauseKey, oldToken.frozenByDefault, treasury, oldToken.autoRenewAccount, oldToken.deleted, oldToken.paused, oldToken.autoRemoved, oldToken.expiry, oldToken.createdTimestamp, oldToken.isNew, oldToken.memo, oldToken.name, oldToken.symbol, oldToken.decimals, oldToken.autoRenewPeriod, oldToken.lastUsedSerialNumber, oldToken.customFees); } /** * Creates new instance of {@link Token} with updated lastUsedSerialNumber in order to keep the object's * immutability and avoid entry points for changing the state. * * @param oldToken * @param lastUsedSerialNumber * @return new instance of {@link Token} with updated {@link #lastUsedSerialNumber} property */ private Token createNewTokenWithNewLastUsedSerialNumber(Token oldToken, long lastUsedSerialNumber) { return new Token( oldToken.entityId, oldToken.id, oldToken.mintedUniqueTokens, oldToken.removedUniqueTokens, oldToken.loadedUniqueTokens, oldToken.supplyHasChanged, oldToken.type, oldToken.supplyType, oldToken.totalSupply, oldToken.maxSupply, oldToken.kycKey, oldToken.freezeKey, oldToken.supplyKey, oldToken.wipeKey, oldToken.adminKey, oldToken.feeScheduleKey, oldToken.pauseKey, oldToken.frozenByDefault, oldToken.treasury, oldToken.autoRenewAccount, oldToken.deleted, oldToken.paused, oldToken.autoRemoved, oldToken.expiry, oldToken.createdTimestamp, oldToken.isNew, oldToken.memo, oldToken.name, oldToken.symbol, oldToken.decimals, oldToken.autoRenewPeriod, lastUsedSerialNumber, oldToken.customFees); } /** * Creates new instance of {@link Token} with deleted property in order to keep the object's * immutability and avoid entry points for changing the state. * * @param oldToken * @param isDeleted oldToken.entityId, * @return new instance of {@link Token} with {@link #deleted} property */ private Token createNewTokenWithDeletedFlag(Token oldToken, boolean isDeleted) { return new Token( oldToken.entityId, oldToken.id, oldToken.mintedUniqueTokens, oldToken.removedUniqueTokens, oldToken.loadedUniqueTokens, oldToken.supplyHasChanged, oldToken.type, oldToken.supplyType, oldToken.totalSupply, oldToken.maxSupply, oldToken.kycKey, oldToken.freezeKey, oldToken.supplyKey, oldToken.wipeKey, oldToken.adminKey, oldToken.feeScheduleKey, oldToken.pauseKey, oldToken.frozenByDefault, oldToken.treasury, oldToken.autoRenewAccount, isDeleted, oldToken.paused, oldToken.autoRemoved, oldToken.expiry, oldToken.createdTimestamp, oldToken.isNew, oldToken.memo, oldToken.name, oldToken.symbol, oldToken.decimals, oldToken.autoRenewPeriod, oldToken.lastUsedSerialNumber, oldToken.customFees); } /** * Creates new instance of {@link Token} with updated type in order to keep the object's immutability and avoid * entry points for changing the state. * * @param oldToken * @param tokenType * @return new instance of {@link Token} with updated {@link #type} property */ private Token createNewTokenWithTokenType(Token oldToken, TokenType tokenType) { return new Token( oldToken.entityId, oldToken.id, oldToken.mintedUniqueTokens, oldToken.removedUniqueTokens, oldToken.loadedUniqueTokens, oldToken.supplyHasChanged, tokenType, oldToken.supplyType, oldToken.totalSupply, oldToken.maxSupply, oldToken.kycKey, oldToken.freezeKey, oldToken.supplyKey, oldToken.wipeKey, oldToken.adminKey, oldToken.feeScheduleKey, oldToken.pauseKey, oldToken.frozenByDefault, oldToken.treasury, oldToken.autoRenewAccount, oldToken.deleted, oldToken.paused, oldToken.autoRemoved, oldToken.expiry, oldToken.createdTimestamp, oldToken.isNew, oldToken.memo, oldToken.name, oldToken.symbol, oldToken.decimals, oldToken.autoRenewPeriod, oldToken.lastUsedSerialNumber, oldToken.customFees); } /** * Creates new instance of {@link Token} with updated kycKey in order to keep the object's immutability and avoid * entry points for changing the state. * * @param oldToken * @param kycKey * @return new instance of {@link Token} with updated {@link #kycKey} property */ private Token createNewTokenWithKycKey(Token oldToken, JKey kycKey) { return new Token( oldToken.entityId, oldToken.id, oldToken.mintedUniqueTokens, oldToken.removedUniqueTokens, oldToken.loadedUniqueTokens, oldToken.supplyHasChanged, oldToken.type, oldToken.supplyType, oldToken.totalSupply, oldToken.maxSupply, kycKey, oldToken.freezeKey, oldToken.supplyKey, oldToken.wipeKey, oldToken.adminKey, oldToken.feeScheduleKey, oldToken.pauseKey, oldToken.frozenByDefault, oldToken.treasury, oldToken.autoRenewAccount, oldToken.deleted, oldToken.paused, oldToken.autoRemoved, oldToken.expiry, oldToken.createdTimestamp, oldToken.isNew, oldToken.memo, oldToken.name, oldToken.symbol, oldToken.decimals, oldToken.autoRenewPeriod, oldToken.lastUsedSerialNumber, oldToken.customFees); } /** * Creates new instance of {@link Token} with updated freezeKey in order to keep the object's immutability and avoid * entry points for changing the state. * * @param oldToken * @param freezeKey * @return new instance of {@link Token} with updated {@link #freezeKey} property */ private Token createNewTokenWithFreezeKey(Token oldToken, JKey freezeKey) { return new Token( oldToken.entityId, oldToken.id, oldToken.mintedUniqueTokens, oldToken.removedUniqueTokens, oldToken.loadedUniqueTokens, oldToken.supplyHasChanged, oldToken.type, oldToken.supplyType, oldToken.totalSupply, oldToken.maxSupply, oldToken.kycKey, freezeKey, oldToken.supplyKey, oldToken.wipeKey, oldToken.adminKey, oldToken.feeScheduleKey, oldToken.pauseKey, oldToken.frozenByDefault, oldToken.treasury, oldToken.autoRenewAccount, oldToken.deleted, oldToken.paused, oldToken.autoRemoved, oldToken.expiry, oldToken.createdTimestamp, oldToken.isNew, oldToken.memo, oldToken.name, oldToken.symbol, oldToken.decimals, oldToken.autoRenewPeriod, oldToken.lastUsedSerialNumber, oldToken.customFees); } /** * Creates new instance of {@link Token} with updated supplyKey in order to keep the object's immutability and avoid * entry points for changing the state. * * @param oldToken * @param supplyKey * @return new instance of {@link Token} with updated {@link #supplyKey} property */ private Token createNewTokenWithSupplyKey(Token oldToken, JKey supplyKey) { return new Token( oldToken.entityId, oldToken.id, oldToken.mintedUniqueTokens, oldToken.removedUniqueTokens, oldToken.loadedUniqueTokens, oldToken.supplyHasChanged, oldToken.type, oldToken.supplyType, oldToken.totalSupply, oldToken.maxSupply, oldToken.kycKey, oldToken.freezeKey, supplyKey, oldToken.wipeKey, oldToken.adminKey, oldToken.feeScheduleKey, oldToken.pauseKey, oldToken.frozenByDefault, oldToken.treasury, oldToken.autoRenewAccount, oldToken.deleted, oldToken.paused, oldToken.autoRemoved, oldToken.expiry, oldToken.createdTimestamp, oldToken.isNew, oldToken.memo, oldToken.name, oldToken.symbol, oldToken.decimals, oldToken.autoRenewPeriod, oldToken.lastUsedSerialNumber, oldToken.customFees); } /** * Creates new instance of {@link Token} with updated wipeKey in order to keep the object's immutability and avoid * entry points for changing the state. * * @param oldToken * @param wipeKey * @return new instance of {@link Token} with updated {@link #wipeKey} property */ private Token createNewTokenWithWipeKey(Token oldToken, JKey wipeKey) { return new Token( oldToken.entityId, oldToken.id, oldToken.mintedUniqueTokens, oldToken.removedUniqueTokens, oldToken.loadedUniqueTokens, oldToken.supplyHasChanged, oldToken.type, oldToken.supplyType, oldToken.totalSupply, oldToken.maxSupply, oldToken.kycKey, oldToken.freezeKey, oldToken.supplyKey, wipeKey, oldToken.adminKey, oldToken.feeScheduleKey, oldToken.pauseKey, oldToken.frozenByDefault, oldToken.treasury, oldToken.autoRenewAccount, oldToken.deleted, oldToken.paused, oldToken.autoRemoved, oldToken.expiry, oldToken.createdTimestamp, oldToken.isNew, oldToken.memo, oldToken.name, oldToken.symbol, oldToken.decimals, oldToken.autoRenewPeriod, oldToken.lastUsedSerialNumber, oldToken.customFees); } /** * Creates new instance of {@link Token} with updated treasury in order to keep the object's immutability and avoid * entry points for changing the state. * * @param oldToken * @param treasury * @return new instance of {@link Token} with updated {@link #treasury} property */ private Token createNewTokenWithTreasury(Token oldToken, Account treasury) { return new Token( oldToken.entityId, oldToken.id, oldToken.mintedUniqueTokens, oldToken.removedUniqueTokens, oldToken.loadedUniqueTokens, oldToken.supplyHasChanged, oldToken.type, oldToken.supplyType, oldToken.totalSupply, oldToken.maxSupply, oldToken.kycKey, oldToken.freezeKey, oldToken.supplyKey, oldToken.wipeKey, oldToken.adminKey, oldToken.feeScheduleKey, oldToken.pauseKey, oldToken.frozenByDefault, treasury, oldToken.autoRenewAccount, oldToken.deleted, oldToken.paused, oldToken.autoRemoved, oldToken.expiry, oldToken.createdTimestamp, oldToken.isNew, oldToken.memo, oldToken.name, oldToken.symbol, oldToken.decimals, oldToken.autoRenewPeriod, oldToken.lastUsedSerialNumber, oldToken.customFees); } /** * Creates new instance of {@link Token} with updated paused in order to keep the object's immutability and avoid * entry points for changing the state. * * @param oldToken * @param paused * @return new instance of {@link Token} with updated {@link #paused} property */ private Token createNewTokenWithPaused(Token oldToken, boolean paused) { return new Token( oldToken.entityId, oldToken.id, oldToken.mintedUniqueTokens, oldToken.removedUniqueTokens, oldToken.loadedUniqueTokens, oldToken.supplyHasChanged, oldToken.type, oldToken.supplyType, oldToken.totalSupply, oldToken.maxSupply, oldToken.kycKey, oldToken.freezeKey, oldToken.supplyKey, oldToken.wipeKey, oldToken.adminKey, oldToken.feeScheduleKey, oldToken.pauseKey, oldToken.frozenByDefault, oldToken.treasury, oldToken.autoRenewAccount, oldToken.deleted, paused, oldToken.autoRemoved, oldToken.expiry, oldToken.createdTimestamp, oldToken.isNew, oldToken.memo, oldToken.name, oldToken.symbol, oldToken.decimals, oldToken.autoRenewPeriod, oldToken.lastUsedSerialNumber, oldToken.customFees); } /** * Creates new instance of {@link Token} with updated decimals in order to keep the object's immutability and avoid * entry points for changing the state. * * @param oldToken * @param decimals * @return new instance of {@link Token} with updated {@link #decimals} property */ private Token createNewTokenWithDecimals(Token oldToken, int decimals) { return new Token( oldToken.entityId, oldToken.id, oldToken.mintedUniqueTokens, oldToken.removedUniqueTokens, oldToken.loadedUniqueTokens, oldToken.supplyHasChanged, oldToken.type, oldToken.supplyType, oldToken.totalSupply, oldToken.maxSupply, oldToken.kycKey, oldToken.freezeKey, oldToken.supplyKey, oldToken.wipeKey, oldToken.adminKey, oldToken.feeScheduleKey, oldToken.pauseKey, oldToken.frozenByDefault, oldToken.treasury, oldToken.autoRenewAccount, oldToken.deleted, oldToken.paused, oldToken.autoRemoved, oldToken.expiry, oldToken.createdTimestamp, oldToken.isNew, oldToken.memo, oldToken.name, oldToken.symbol, decimals, oldToken.autoRenewPeriod, oldToken.lastUsedSerialNumber, oldToken.customFees); } /** * Creates new instance of {@link Token} with updated decimals in order to keep the object's immutability and avoid * entry points for changing the state. * * @param oldToken * @param mintedUniqueTokens * @return new instance of {@link Token} with updated {@link #mintedUniqueTokens} property */ private Token createNewTokenWithMintedUniqueTokens(Token oldToken, List<UniqueToken> mintedUniqueTokens) { return new Token( oldToken.entityId, oldToken.id, mintedUniqueTokens, oldToken.removedUniqueTokens, oldToken.loadedUniqueTokens, oldToken.supplyHasChanged, oldToken.type, oldToken.supplyType, oldToken.totalSupply, oldToken.maxSupply, oldToken.kycKey, oldToken.freezeKey, oldToken.supplyKey, oldToken.wipeKey, oldToken.adminKey, oldToken.feeScheduleKey, oldToken.pauseKey, oldToken.frozenByDefault, oldToken.treasury, oldToken.autoRenewAccount, oldToken.deleted, oldToken.paused, oldToken.autoRemoved, oldToken.expiry, oldToken.createdTimestamp, oldToken.isNew, oldToken.memo, oldToken.name, oldToken.symbol, oldToken.decimals, oldToken.autoRenewPeriod, oldToken.lastUsedSerialNumber, oldToken.customFees); } /** * Creates new instance of {@link Token} with updated autoRenewAccount in order to keep the object's immutability and avoid * entry points for changing the state. * * @param oldToken * @param autoRenewAccount * @return new instance of {@link Token} with updated {@link #autoRenewAccount} property */ private Token createNewTokenWithAutoRenewAccount(Token oldToken, Account autoRenewAccount) { return new Token( oldToken.entityId, oldToken.id, oldToken.mintedUniqueTokens, oldToken.removedUniqueTokens, oldToken.loadedUniqueTokens, oldToken.supplyHasChanged, oldToken.type, oldToken.supplyType, oldToken.totalSupply, oldToken.maxSupply, oldToken.kycKey, oldToken.freezeKey, oldToken.supplyKey, oldToken.wipeKey, oldToken.adminKey, oldToken.feeScheduleKey, oldToken.pauseKey, oldToken.frozenByDefault, oldToken.treasury, autoRenewAccount, oldToken.deleted, oldToken.paused, oldToken.autoRemoved, oldToken.expiry, oldToken.createdTimestamp, oldToken.isNew, oldToken.memo, oldToken.name, oldToken.symbol, oldToken.decimals, oldToken.autoRenewPeriod, oldToken.lastUsedSerialNumber, oldToken.customFees); } /** * Creates new instance of {@link Token} with updated autoRenewPeriod in order to keep the object's immutability and avoid * entry points for changing the state. * * @param oldToken * @param autoRenewPeriod * @return new instance of {@link Token} with updated {@link #autoRenewPeriod} property */ private Token createNewTokenWithAutoRenewPeriod(Token oldToken, long autoRenewPeriod) { return new Token( oldToken.entityId, oldToken.id, oldToken.mintedUniqueTokens, oldToken.removedUniqueTokens, oldToken.loadedUniqueTokens, oldToken.supplyHasChanged, oldToken.type, oldToken.supplyType, oldToken.totalSupply, oldToken.maxSupply, oldToken.kycKey, oldToken.freezeKey, oldToken.supplyKey, oldToken.wipeKey, oldToken.adminKey, oldToken.feeScheduleKey, oldToken.pauseKey, oldToken.frozenByDefault, oldToken.treasury, oldToken.autoRenewAccount, oldToken.deleted, oldToken.paused, oldToken.autoRemoved, oldToken.expiry, oldToken.createdTimestamp, oldToken.isNew, oldToken.memo, oldToken.name, oldToken.symbol, oldToken.decimals, autoRenewPeriod, oldToken.lastUsedSerialNumber, oldToken.customFees); } /** * Creates new instance of {@link Token} with updated expiry in order to keep the object's immutability and avoid * entry points for changing the state. * * @param oldToken * @param expiry * @return new instance of {@link Token} with updated {@link #expiry} property */ private Token createNewTokenWithExpiry(Token oldToken, long expiry) { return new Token( oldToken.entityId, oldToken.id, oldToken.mintedUniqueTokens, oldToken.removedUniqueTokens, oldToken.loadedUniqueTokens, oldToken.supplyHasChanged, oldToken.type, oldToken.supplyType, oldToken.totalSupply, oldToken.maxSupply, oldToken.kycKey, oldToken.freezeKey, oldToken.supplyKey, oldToken.wipeKey, oldToken.adminKey, oldToken.feeScheduleKey, oldToken.pauseKey, oldToken.frozenByDefault, oldToken.treasury, oldToken.autoRenewAccount, oldToken.deleted, oldToken.paused, oldToken.autoRemoved, expiry, oldToken.createdTimestamp, oldToken.isNew, oldToken.memo, oldToken.name, oldToken.symbol, oldToken.decimals, oldToken.autoRenewPeriod, oldToken.lastUsedSerialNumber, oldToken.customFees); } /** * Creates new instance of {@link Token} with updated adminKey in order to keep the object's immutability and avoid * entry points for changing the state. * * @param oldToken * @param adminKey * @return new instance of {@link Token} with updated {@link #adminKey} property */ private Token createNewTokenWithAdminKey(Token oldToken, JKey adminKey) { return new Token( oldToken.entityId, oldToken.id, oldToken.mintedUniqueTokens, oldToken.removedUniqueTokens, oldToken.loadedUniqueTokens, oldToken.supplyHasChanged, oldToken.type, oldToken.supplyType, oldToken.totalSupply, oldToken.maxSupply, oldToken.kycKey, oldToken.freezeKey, oldToken.supplyKey, oldToken.wipeKey, adminKey, oldToken.feeScheduleKey, oldToken.pauseKey, oldToken.frozenByDefault, oldToken.treasury, oldToken.autoRenewAccount, oldToken.deleted, oldToken.paused, oldToken.autoRemoved, oldToken.expiry, oldToken.createdTimestamp, oldToken.isNew, oldToken.memo, oldToken.name, oldToken.symbol, oldToken.decimals, oldToken.autoRenewPeriod, oldToken.lastUsedSerialNumber, oldToken.customFees); } /** * Creates new instance of {@link Token} with updated name in order to keep the object's immutability and avoid * entry points for changing the state. * * @param oldToken * @param name * @return new instance of {@link Token} with updated {@link #name} property */ private Token createNewTokenWithName(Token oldToken, String name) { return new Token( oldToken.entityId, oldToken.id, oldToken.mintedUniqueTokens, oldToken.removedUniqueTokens, oldToken.loadedUniqueTokens, oldToken.supplyHasChanged, oldToken.type, oldToken.supplyType, oldToken.totalSupply, oldToken.maxSupply, oldToken.kycKey, oldToken.freezeKey, oldToken.supplyKey, oldToken.wipeKey, oldToken.adminKey, oldToken.feeScheduleKey, oldToken.pauseKey, oldToken.frozenByDefault, oldToken.treasury, oldToken.autoRenewAccount, oldToken.deleted, oldToken.paused, oldToken.autoRemoved, oldToken.expiry, oldToken.createdTimestamp, oldToken.isNew, oldToken.memo, name, oldToken.symbol, oldToken.decimals, oldToken.autoRenewPeriod, oldToken.lastUsedSerialNumber, oldToken.customFees); } /** * Creates new instance of {@link Token} with updated symbol in order to keep the object's immutability and avoid * entry points for changing the state. * * @param oldToken * @param symbol * @return new instance of {@link Token} with updated {@link #symbol} property */ private Token createNewTokenWithSymbol(Token oldToken, String symbol) { return new Token( oldToken.entityId, oldToken.id, oldToken.mintedUniqueTokens, oldToken.removedUniqueTokens, oldToken.loadedUniqueTokens, oldToken.supplyHasChanged, oldToken.type, oldToken.supplyType, oldToken.totalSupply, oldToken.maxSupply, oldToken.kycKey, oldToken.freezeKey, oldToken.supplyKey, oldToken.wipeKey, oldToken.adminKey, oldToken.feeScheduleKey, oldToken.pauseKey, oldToken.frozenByDefault, oldToken.treasury, oldToken.autoRenewAccount, oldToken.deleted, oldToken.paused, oldToken.autoRemoved, oldToken.expiry, oldToken.createdTimestamp, oldToken.isNew, oldToken.memo, oldToken.name, symbol, oldToken.decimals, oldToken.autoRenewPeriod, oldToken.lastUsedSerialNumber, oldToken.customFees); } /** * Creates new instance of {@link Token} with updated pauseKey in order to keep the object's immutability and avoid * entry points for changing the state. * * @param oldToken * @param pauseKey * @return new instance of {@link Token} with updated {@link #pauseKey} property */ private Token createNewTokenWithPauseKey(Token oldToken, JKey pauseKey) { return new Token( oldToken.entityId, oldToken.id, oldToken.mintedUniqueTokens, oldToken.removedUniqueTokens, oldToken.loadedUniqueTokens, oldToken.supplyHasChanged, oldToken.type, oldToken.supplyType, oldToken.totalSupply, oldToken.maxSupply, oldToken.kycKey, oldToken.freezeKey, oldToken.supplyKey, oldToken.wipeKey, oldToken.adminKey, oldToken.feeScheduleKey, pauseKey, oldToken.frozenByDefault, oldToken.treasury, oldToken.autoRenewAccount, oldToken.deleted, oldToken.paused, oldToken.autoRemoved, oldToken.expiry, oldToken.createdTimestamp, oldToken.isNew, oldToken.memo, oldToken.name, oldToken.symbol, oldToken.decimals, oldToken.autoRenewPeriod, oldToken.lastUsedSerialNumber, oldToken.customFees); } /** * Creates new instance of {@link Token} with updated feeScheduleKey in order to keep the object's immutability and avoid * entry points for changing the state. * * @param oldToken * @param feeScheduleKey * @return new instance of {@link Token} with updated {@link #feeScheduleKey} property */ private Token createNewTokenWithFeeScheduleKey(Token oldToken, JKey feeScheduleKey) { return new Token( oldToken.entityId, oldToken.id, oldToken.mintedUniqueTokens, oldToken.removedUniqueTokens, oldToken.loadedUniqueTokens, oldToken.supplyHasChanged, oldToken.type, oldToken.supplyType, oldToken.totalSupply, oldToken.maxSupply, oldToken.kycKey, oldToken.freezeKey, oldToken.supplyKey, oldToken.wipeKey, oldToken.adminKey, feeScheduleKey, oldToken.pauseKey, oldToken.frozenByDefault, oldToken.treasury, oldToken.autoRenewAccount, oldToken.deleted, oldToken.paused, oldToken.autoRemoved, oldToken.expiry, oldToken.createdTimestamp, oldToken.isNew, oldToken.memo, oldToken.name, oldToken.symbol, oldToken.decimals, oldToken.autoRenewPeriod, oldToken.lastUsedSerialNumber, oldToken.customFees); } /** * Creates new instance of {@link Token} with updated memo in order to keep the object's immutability and avoid * entry points for changing the state. * * @param oldToken * @param memo * @return new instance of {@link Token} with updated {@link #memo} property */ private Token createNewTokenWithMemo(Token oldToken, String memo) { return new Token( oldToken.entityId, oldToken.id, oldToken.mintedUniqueTokens, oldToken.removedUniqueTokens, oldToken.loadedUniqueTokens, oldToken.supplyHasChanged, oldToken.type, oldToken.supplyType, oldToken.totalSupply, oldToken.maxSupply, oldToken.kycKey, oldToken.freezeKey, oldToken.supplyKey, oldToken.wipeKey, oldToken.adminKey, oldToken.feeScheduleKey, oldToken.pauseKey, oldToken.frozenByDefault, oldToken.treasury, oldToken.autoRenewAccount, oldToken.deleted, oldToken.paused, oldToken.autoRemoved, oldToken.expiry, oldToken.createdTimestamp, oldToken.isNew, memo, oldToken.name, oldToken.symbol, oldToken.decimals, oldToken.autoRenewPeriod, oldToken.lastUsedSerialNumber, oldToken.customFees); } /** * Minting fungible tokens increases the supply and sets new balance to the treasuryRel * * @param treasuryRel * @param amount * @param ignoreSupplyKey * @return new instance of {@link Token} with updated fields to keep the object's immutability */ public TokenModificationResult mint( final TokenRelationship treasuryRel, final long amount, final boolean ignoreSupplyKey) { validateTrue(amount >= 0, INVALID_TOKEN_MINT_AMOUNT, errorMessage("mint", amount, treasuryRel)); validateTrue( type == TokenType.FUNGIBLE_COMMON, FAIL_INVALID, "Fungible mint can be invoked only on fungible token type"); return changeSupply(treasuryRel, amount, INVALID_TOKEN_MINT_AMOUNT, ignoreSupplyKey); } /** * Minting unique tokens creates new instances of the given base unique token. Increments the serial number of the * given base unique token, and assigns each of the numbers to each new unique token instance. * * @param treasuryRel - the relationship between the treasury account and the token * @param metadata - a list of user-defined metadata, related to the nft instances. * @param creationTime - the consensus time of the token mint transaction * @return new instance of {@link Token} with updated fields to keep the object's immutability */ public TokenModificationResult mint( final TokenRelationship treasuryRel, final List<ByteString> metadata, final RichInstant creationTime) { final var metadataCount = metadata.size(); validateFalse(metadata.isEmpty(), INVALID_TOKEN_MINT_METADATA, "Cannot mint zero unique tokens"); validateTrue( type == TokenType.NON_FUNGIBLE_UNIQUE, FAIL_INVALID, "Non-fungible mint can be invoked only on non-fungible token type"); validateTrue((lastUsedSerialNumber + metadataCount) <= MAX_NUM_ALLOWED, SERIAL_NUMBER_LIMIT_REACHED); var tokenMod = changeSupply(treasuryRel, metadataCount, FAIL_INVALID, false); long newLastUsedSerialNumber = this.lastUsedSerialNumber; Token tokenWithMintedUniqueTokens = null; for (final ByteString m : metadata) { newLastUsedSerialNumber++; // The default sentinel account is used (0.0.0) to represent unique tokens owned by the // Treasury final var uniqueToken = new UniqueToken(id, newLastUsedSerialNumber, creationTime, Id.DEFAULT, Id.DEFAULT, m.toByteArray()); mintedUniqueTokens.add(uniqueToken); tokenWithMintedUniqueTokens = tokenMod.token().setMintedUniqueTokens(mintedUniqueTokens); } var newTreasury = treasury.setOwnedNfts(treasury.getOwnedNfts() + metadataCount); var newToken = createNewTokenWithNewTreasury( tokenWithMintedUniqueTokens != null ? tokenWithMintedUniqueTokens : tokenMod.token(), newTreasury); return new TokenModificationResult( createNewTokenWithNewLastUsedSerialNumber(newToken, newLastUsedSerialNumber), tokenMod.tokenRelationship()); } /** * Burning fungible tokens reduces the supply and sets new balance to the treasuryRel * * @param treasuryRel- the relationship between the treasury account and the token * @param amount * @return new instance of {@link Token} with updated fields to keep the object's immutability */ public TokenModificationResult burn(final TokenRelationship treasuryRel, final long amount) { validateTrue(amount >= 0, INVALID_TOKEN_BURN_AMOUNT, errorMessage("burn", amount, treasuryRel)); return changeSupply(treasuryRel, -amount, INVALID_TOKEN_BURN_AMOUNT, false); } /** * Burning unique tokens effectively destroys them, as well as reduces the total supply of the token. * * @param treasuryRel- the relationship between the treasury account and the token * @param serialNumbers - the serial numbers, representing the unique tokens which will be * destroyed. */ public TokenModificationResult burn(final TokenRelationship treasuryRel, final List<Long> serialNumbers) { validateTrue(type == TokenType.NON_FUNGIBLE_UNIQUE, FAIL_INVALID); validateFalse(serialNumbers.isEmpty(), INVALID_TOKEN_BURN_METADATA); final var treasuryId = treasury.getId(); for (final long serialNum : serialNumbers) { final var uniqueToken = loadedUniqueTokens.get(serialNum); validateTrue(uniqueToken != null, FAIL_INVALID); // Compare directly owner to treasury, oposed to hedera-services logic where owner is set to Id.DEFAULT if // it is treasury. // We have a different workflow in setting the owner value final var treasuryIsOwner = uniqueToken.getOwner().equals(treasuryId); validateTrue(treasuryIsOwner, TREASURY_MUST_OWN_BURNED_NFT); removedUniqueTokens.add( new UniqueToken(id, serialNum, RichInstant.MISSING_INSTANT, treasuryId, Id.DEFAULT, new byte[] {})); } final var numBurned = serialNumbers.size(); var newTreasury = treasury.setOwnedNfts(treasury.getOwnedNfts() - numBurned); var tokenMod = changeSupply(treasuryRel, -numBurned, FAIL_INVALID, false); var newToken = createNewTokenWithNewTreasury(tokenMod.token(), newTreasury); return new TokenModificationResult(newToken, tokenMod.tokenRelationship()); } /** * Wiping fungible tokens removes the balance of the given account, as well as reduces the total supply. * * @param accountRel - the relationship between the account which owns the tokens and the token * @param amount - amount to be wiped * @return new instance of {@link Token} with updated fields to keep the object's immutability */ public TokenModificationResult wipe(final TokenRelationship accountRel, final long amount) { validateTrue( type == TokenType.FUNGIBLE_COMMON, FAIL_INVALID, "Fungible wipe can be invoked only on Fungible token type."); baseWipeValidations(accountRel); amountWipeValidations(accountRel, amount); final var newTotalSupply = totalSupply - amount; final var newAccBalance = accountRel.getBalance() - amount; var newAccountRel = accountRel; if (newAccBalance == 0) { final var currentNumPositiveBalances = accountRel.getAccount().getNumPositiveBalances(); var newAccount = accountRel.getAccount().setNumPositiveBalances(currentNumPositiveBalances - 1); newAccountRel = accountRel.setAccount(newAccount); } return new TokenModificationResult( createNewTokenWithNewTotalSupply(this, newTotalSupply), newAccountRel.setBalance(newAccBalance)); } /** * Wiping unique tokens removes the unique token instances, associated to the given account, as * well as reduces the total supply. * * @param accountRel - the relationship between the account, which owns the tokens, and the * token * @param serialNumbers - a list of serial numbers, representing the tokens to be wiped */ public TokenModificationResult wipe(final TokenRelationship accountRel, final List<Long> serialNumbers) { validateTrue(type == TokenType.NON_FUNGIBLE_UNIQUE, FAIL_INVALID); validateFalse(serialNumbers.isEmpty(), INVALID_WIPING_AMOUNT); baseWipeValidations(accountRel); for (final var serialNum : serialNumbers) { final var uniqueToken = loadedUniqueTokens.get(serialNum); validateTrue(uniqueToken != null, FAIL_INVALID); final var wipeAccountIsOwner = uniqueToken.getOwner().equals(accountRel.getAccount().getId()); validateTrue(wipeAccountIsOwner, ACCOUNT_DOES_NOT_OWN_WIPED_NFT); } final var newTotalSupply = totalSupply - serialNumbers.size(); final var newAccountBalance = accountRel.getBalance() - serialNumbers.size(); var account = accountRel.getAccount(); for (final long serialNum : serialNumbers) { removedUniqueTokens.add(new UniqueToken( id, serialNum, RichInstant.MISSING_INSTANT, account.getId(), Id.DEFAULT, new byte[] {})); } if (newAccountBalance == 0) { final var currentNumPositiveBalances = account.getNumPositiveBalances(); account = account.setNumPositiveBalances(currentNumPositiveBalances - 1); } var newAccountRel = accountRel.setAccount(account.setOwnedNfts(account.getOwnedNfts() - serialNumbers.size())); newAccountRel = newAccountRel.setBalance(newAccountBalance); return new TokenModificationResult(createNewTokenWithNewTotalSupply(this, newTotalSupply), newAccountRel); } public TokenRelationship newRelationshipWith(final Account account, final boolean automaticAssociation) { var newRel = new TokenRelationship( this, account, 0, false, !hasKycKey(), false, false, automaticAssociation, false, 0); if (hasFreezeKey() && frozenByDefault) { newRel = newRel.setFrozen(true); } return newRel; } /** * Creates new {@link TokenRelationship} for the specified {@link Account} IMPORTANT: The provided account is set to * KYC granted and unfrozen by default * * @param account the Account for which to create the relationship * @return newly created {@link TokenRelationship} */ public TokenRelationship newEnabledRelationship(final Account account) { return new TokenRelationship(this, account, 0, false, true, false, false, false, false, 0); } private TokenModificationResult changeSupply( final TokenRelationship treasuryRel, final long amount, final ResponseCodeEnum negSupplyCode, final boolean ignoreSupplyKey) { validateTrue(treasuryRel != null, FAIL_INVALID, "Cannot mint with a null treasuryRel"); validateTrue( treasuryRel.hasInvolvedIds(id, treasury.getId()), FAIL_INVALID, "Cannot change " + this + " supply (" + amount + ") with non-treasury rel " + treasuryRel); if (!ignoreSupplyKey) { validateTrue(supplyKey != null, TOKEN_HAS_NO_SUPPLY_KEY); } final long newTotalSupply = totalSupply + amount; validateTrue(newTotalSupply >= 0, negSupplyCode); if (supplyType == TokenSupplyType.FINITE) { validateTrue( maxSupply >= newTotalSupply, TOKEN_MAX_SUPPLY_REACHED, "Cannot mint new supply (" + amount + "). Max supply (" + maxSupply + ") reached"); } var treasuryAccount = treasuryRel.getAccount(); final long newTreasuryBalance = treasuryRel.getBalance() + amount; validateTrue(newTreasuryBalance >= 0, INSUFFICIENT_TOKEN_BALANCE); if (treasuryRel.getBalance() == 0 && amount > 0) { // for mint op treasuryAccount = treasuryAccount.setNumPositiveBalances(treasuryAccount.getNumPositiveBalances() + 1); } else if (newTreasuryBalance == 0 && amount < 0) { // for burn op treasuryAccount = treasuryAccount.setNumPositiveBalances(treasuryAccount.getNumPositiveBalances() - 1); } var newTreasuryRel = treasuryRel.setAccount(treasuryAccount); newTreasuryRel = newTreasuryRel.setBalance(newTreasuryBalance); return new TokenModificationResult(createNewTokenWithNewTotalSupply(this, newTotalSupply), newTreasuryRel); } private void baseWipeValidations(final TokenRelationship accountRel) { validateTrue(hasWipeKey(), TOKEN_HAS_NO_WIPE_KEY, "Cannot wipe Tokens without wipe key."); validateFalse( treasury.getId().equals(accountRel.getAccount().getId()), CANNOT_WIPE_TOKEN_TREASURY_ACCOUNT, "Cannot wipe treasury account of token."); } private void amountWipeValidations(final TokenRelationship accountRel, final long amount) { validateTrue(amount >= 0, INVALID_WIPING_AMOUNT, errorMessage("wipe", amount, accountRel)); final var newTotalSupply = totalSupply - amount; validateTrue( newTotalSupply >= 0, INVALID_WIPING_AMOUNT, "Wiping would negate the total supply of the given token."); final var newAccountBalance = accountRel.getBalance() - amount; validateTrue(newAccountBalance >= 0, INVALID_WIPING_AMOUNT, "Wiping would negate account balance"); } private String errorMessage(final String op, final long amount, final TokenRelationship rel) { return "Cannot " + op + " " + amount + " units of " + this + " from " + rel; } public Token delete() { validateTrue(hasAdminKey(), TOKEN_IS_IMMUTABLE); return createNewTokenWithDeletedFlag(this, true); } public Token setIsDeleted(boolean isDeleted) { return createNewTokenWithDeletedFlag(this, isDeleted); } public boolean hasAdminKey() { return adminKey != null; } public Account getTreasury() { return treasury; } public Token setTreasury(Account treasury) { return createNewTokenWithTreasury(this, treasury); } public Account getAutoRenewAccount() { return autoRenewAccount; } public Token setAutoRenewAccount(Account autoRenewAccount) { return createNewTokenWithAutoRenewAccount(this, autoRenewAccount); } public boolean hasAutoRenewAccount() { return autoRenewAccount != null; } public long getTotalSupply() { return totalSupply; } public long getMaxSupply() { return maxSupply; } public Token setMaxSupply(long maxSupply) { return createNewTokenWithNewMaxSupply(this, maxSupply); } public JKey getSupplyKey() { return supplyKey; } public boolean hasSupplyKey() { return supplyKey != null; } public Token setSupplyKey(JKey supplyKey) { return createNewTokenWithSupplyKey(this, supplyKey); } public Token setMintedUniqueTokens(final List<UniqueToken> mintedUniqueTokens) { return createNewTokenWithMintedUniqueTokens(this, mintedUniqueTokens); } public boolean hasFreezeKey() { return freezeKey != null; } public boolean hasKycKey() { return kycKey != null; } public boolean hasWipeKey() { return wipeKey != null; } public JKey getWipeKey() { return wipeKey; } public Token setWipeKey(JKey wipeKey) { return createNewTokenWithWipeKey(this, wipeKey); } public JKey getKycKey() { return kycKey; } public Token setKycKey(JKey kycKey) { return createNewTokenWithKycKey(this, kycKey); } public JKey getFreezeKey() { return freezeKey; } public Token setFreezeKey(JKey freezeKey) { return createNewTokenWithFreezeKey(this, freezeKey); } public JKey getPauseKey() { return pauseKey; } public Token setPauseKey(JKey pauseKey) { return createNewTokenWithPauseKey(this, pauseKey); } public boolean hasPauseKey() { return pauseKey != null; } /* supply is changed only after the token is created */ public boolean hasChangedSupply() { return supplyHasChanged && !isNew; } public boolean isFrozenByDefault() { return frozenByDefault; } public boolean isPaused() { return paused; } public Token setPaused(boolean paused) { return createNewTokenWithPaused(this, paused); } public Long getEntityId() { return entityId; } public Id getId() { return id; } public TokenType getType() { return type; } public Token setType(TokenType tokenType) { return createNewTokenWithTokenType(this, tokenType); } public boolean isFungibleCommon() { return type == TokenType.FUNGIBLE_COMMON; } public boolean isNonFungibleUnique() { return type == TokenType.NON_FUNGIBLE_UNIQUE; } public long getLastUsedSerialNumber() { return lastUsedSerialNumber; } public Token setLastUsedSerialNumber(final long lastUsedSerialNumber) { return createNewTokenWithNewLastUsedSerialNumber(this, lastUsedSerialNumber); } public List<CustomFee> getCustomFees() { return customFees; } public boolean hasMintedUniqueTokens() { return !mintedUniqueTokens.isEmpty(); } public List<UniqueToken> mintedUniqueTokens() { return mintedUniqueTokens; } public boolean isDeleted() { return deleted; } public long getExpiry() { return expiry; } public Token setExpiry(long expiry) { return createNewTokenWithExpiry(this, expiry); } public boolean hasRemovedUniqueTokens() { return !removedUniqueTokens.isEmpty(); } public List<UniqueToken> removedUniqueTokens() { return removedUniqueTokens; } public Map<Long, UniqueToken> getLoadedUniqueTokens() { return loadedUniqueTokens; } public Token setLoadedUniqueTokens(final Map<Long, UniqueToken> loadedUniqueTokens) { return createNewTokenWithLoadedUniqueTokens(this, loadedUniqueTokens); } public boolean isBelievedToHaveBeenAutoRemoved() { return autoRemoved; } public JKey getAdminKey() { return adminKey; } public Token setAdminKey(JKey adminKey) { return createNewTokenWithAdminKey(this, adminKey); } public String getMemo() { return memo; } public Token setMemo(String memo) { return createNewTokenWithMemo(this, memo); } public boolean isNew() { return isNew; } public TokenSupplyType getSupplyType() { return supplyType; } public String getName() { return name; } public Token setName(String name) { return createNewTokenWithName(this, name); } public String getSymbol() { return symbol; } public Token setSymbol(String symbol) { return createNewTokenWithSymbol(this, symbol); } public int getDecimals() { return decimals; } public Token setDecimals(int decimals) { return createNewTokenWithDecimals(this, decimals); } public long getAutoRenewPeriod() { return autoRenewPeriod; } public Token setAutoRenewPeriod(long autoRenewPeriod) { return createNewTokenWithAutoRenewPeriod(this, autoRenewPeriod); } public long getCreatedTimestamp() { return this.createdTimestamp; } /* NOTE: The object methods below are only overridden to improve readability of unit tests; this model object is not used in hash-based collections, so the performance of these methods doesn't matter. */ @Override public boolean equals(final Object obj) { return EqualsBuilder.reflectionEquals(this, obj); } @Override public int hashCode() { return HashCodeBuilder.reflectionHashCode(this); } @Override public String toString() { return MoreObjects.toStringHelper(Token.class) .add("id", id) .add("type", type) .add("deleted", deleted) .add("autoRemoved", autoRemoved) .add("treasury", treasury) .add("autoRenewAccount", autoRenewAccount) .add("kycKey", kycKey) .add("freezeKey", freezeKey) .add("frozenByDefault", frozenByDefault) .add("supplyKey", supplyKey) .add("currentSerialNumber", lastUsedSerialNumber) .add("pauseKey", pauseKey) .add("paused", paused) .toString(); } public boolean hasFeeScheduleKey() { return feeScheduleKey != null; } public JKey getFeeScheduleKey() { return feeScheduleKey; } public Token setFeeScheduleKey(JKey feeScheduleKey) { return createNewTokenWithFeeScheduleKey(this, feeScheduleKey); } }
package org.example.snovaisg.myuploadFCT; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; import org.example.snovaisg.myuploadFCT.BarCampus.BarCampusVisualiza; import org.example.snovaisg.myuploadFCT.Cantina.CantinaVisualiza; import org.example.snovaisg.myuploadFCT.CasaPessoal.CasaPVisualiza; import org.example.snovaisg.myuploadFCT.Come.ComeVisualiza; import org.example.snovaisg.myuploadFCT.Girassol.GirassolVisualiza; import org.example.snovaisg.myuploadFCT.Lidia.BarLidiaVisualiza; import org.example.snovaisg.myuploadFCT.MySpot.mySpotVisualiza; import org.example.snovaisg.myuploadFCT.Sector7.Sector7Visualiza; import org.example.snovaisg.myuploadFCT.SectorDep.SectorDepVisualiza; import org.example.snovaisg.myuploadFCT.Teresa.TeresaVisualiza; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Atualizado extends AppCompatActivity { Button notificar; DataHolder DH = new DataHolder().getInstance(); String fileToInternal = DH.fileToInternal(); String ServerRestauranteFilename = DH.getServerFilename(); String restaurante = DH.getData(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_atualizado); initMenu(); notificar = (Button) findViewById(R.id.button11); Button visualizar = (Button) findViewById(R.id.button); visualizar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent; if(restaurante.equals("Cantina")) { intent = new Intent(Atualizado.this, CantinaVisualiza.class); } else { if(restaurante.equals("Teresa")) { intent = new Intent(Atualizado.this, TeresaVisualiza.class); } else { if(restaurante.equals("My Spot")) { intent = new Intent(Atualizado.this, mySpotVisualiza.class); } else { if(restaurante.equals("Bar Campus")) { intent = new Intent(Atualizado.this, BarCampusVisualiza.class); } else { if(restaurante.equals("Casa do P.")) { intent = new Intent(Atualizado.this, CasaPVisualiza.class); } else { if(restaurante.equals("C@m. Come")) { intent = new Intent(Atualizado.this, ComeVisualiza.class); } else { if(restaurante.equals("Sector + Dep")) { intent = new Intent(Atualizado.this, SectorDepVisualiza.class); } else { if(restaurante.equals("Sector + Ed.7")) { intent = new Intent(Atualizado.this, Sector7Visualiza.class); } else { if(restaurante.equals("Girassol")) { intent = new Intent(Atualizado.this, GirassolVisualiza.class); } else { intent = new Intent(Atualizado.this, BarLidiaVisualiza.class); } } } } } } } } } startActivity(intent); } }); notificar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(Atualizado.this, Notificacoes.class); startActivity(intent); } }); } public void initMenu(){ String[] semana = { "Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"}; Date a = new Date(); Calendar c = Calendar.getInstance(); c.setTime(a); int dayOfWeek = c.get(Calendar.DAY_OF_WEEK); TextView date1 = (TextView) findViewById(R.id.date1); date1.setText(semana[dayOfWeek-1]); String timeStamp = new SimpleDateFormat("dd-MM-yyyy").format(Calendar.getInstance().getTime()); TextView date2 = (TextView) findViewById(R.id.date2); date2.setText(timeStamp); TextView tv = (TextView) findViewById(R.id.tv10); tv.setText(DataHolder.getInstance().getData()); } }
package model; public class Artista { private String nom, id, tipus, idSerie, nacionalitat; public Artista(String id, String nom, String tipus, String idSerie, String nacionalitat){ this.nom = nom; this.id = id; this.tipus = tipus; this.idSerie = idSerie; this.nacionalitat = nacionalitat; } }
import java.util.Scanner; /** * author : sangeun lee */ public class p2 { public static void main(String[] args) { System.out.println("What is the input String?"); String input = new Scanner(System.in).nextLine(); while(input.length() <= 0) { System.out.println("Input is null. What is the input String?"); input = new Scanner(System.in).nextLine(); } System.out.println(input + " has " + input.length() + " characters"); } }
package Sudoku_Logica; import javax.swing.ImageIcon; abstract class ImagenClaseGeneral { //Atributos protected ImageIcon im; protected String[] imagenes; //Constructor public ImagenClaseGeneral() { im= new ImageIcon(); } //Metodos public void actualizar(int indice) { if (indice<=imagenes.length) { ImageIcon imagen= new ImageIcon(this.getClass().getResource(imagenes[indice-1])); im.setImage(imagen.getImage()); } } public ImageIcon getim() { return im; } public void setim(ImageIcon im) { this.im=im; } public String[] getimagenes() { return imagenes; } public void setimagenes(String[] imagenes) { this.imagenes=imagenes; } }